Hi Uwe,
Thanks a lot.
I try to implement drawSymbols like below
int from, int to) const
{
painter->setBrush(symbol.brush());
painter->setPen(symbol.pen());
rect.setSize(metricsMap .screenToLayout(symbol.size()));
if( to <= from || m_symboNumber <= 1 )
return ;
int step ;
if( m_symboNumber < to - from )
step = ( to - from ) / ( m_symboNumber - 1 ) ;
else
step = 1 ;
for (int i = from; i <= to; i += step )
{
const double xi = xMap.transform(x(i)); [COLOR="#FF0000"]//doesn't work in Qwt 6.0.1[/COLOR]
const double yi = yMap.transform(y(i)); //doesn't work in Qwt 6.0.1
rect.
moveCenter(QPoint(xi, yi
));
symbol.drawSymbol(painter, rect);
}
}
void mycurveplot::drawSymbols(QPainter *painter, const QwtSymbol &symbol,
const QwtScaleMap &xMap, const QwtScaleMap &yMap,
int from, int to) const
{
painter->setBrush(symbol.brush());
painter->setPen(symbol.pen());
const QwtMetricsMap &metricsMap = QwtPainter::metricsMap(); [COLOR="#FF0000"]//doesn't work in Qwt 6.0.1[/COLOR]
QRect rect;
rect.setSize(metricsMap .screenToLayout(symbol.size()));
if( to <= from || m_symboNumber <= 1 )
return ;
int step ;
if( m_symboNumber < to - from )
step = ( to - from ) / ( m_symboNumber - 1 ) ;
else
step = 1 ;
for (int i = from; i <= to; i += step )
{
const double xi = xMap.transform(x(i)); [COLOR="#FF0000"]//doesn't work in Qwt 6.0.1[/COLOR]
const double yi = yMap.transform(y(i)); //doesn't work in Qwt 6.0.1
rect.moveCenter(QPoint(xi, yi));
symbol.drawSymbol(painter, rect);
}
}
To copy to clipboard, switch view to plain text mode
I find similar implement, but it seems it only work in Qwt 5.
But where 'x()' come from in xMap.transform(x(i))?
Also, since QwtMetricsMap is deprecated in Qwt6, is any class can replace it?
Thanks!
Bookmarks