Hi all,
I am experiencing a problem when using the Curvetracker-Example to display data of my curve. While modifying the trackertext Function works perfectly for my purposes I do not seem to be able to modify the drawrubberband function properly.
I simply want to move the V-Line-Rubberband to a position, where the Curve actually has a sample, while the trackerlabel keeps aligned to my Cursor.
To accomplish that, I modified drawRubberband the following way:
While pos_x definitely calculates the right x-Coordinate, the Rubberband is only visible when moving the Cursor exactly at the point, where the Rubberband should be drawn.void CurveTracker::drawRubberBand( QPainter *painter ) const
{
const QRect pRect = pickArea().boundingRect().toRect();
QwtScaleMap xmap= plot()->canvasMap(QwtPlot::xBottom);
float pos_x = xmap.transform(QwtDate::toDouble( QDateTime( Dates[dates_index], QTime( 0, 0 ), Qt::UTC)));
QLineF line;
line.setLine( pos_x, pRect.top(), pos_x, pRect.bottom() );
QwtPainter::drawLine( painter,line);
}
I have already looked into QwtPicker.cpp, but cannot figure out, what I am missing.
I am using Qwt 6.1rc3 an Qt 4.7.3.
Help would be highly appreciated .
Edit: Looked into it for days, and when posting here, I got it. Of course one has to reimplement QwtPicker::rubberBandMask() as well. Hope it helps someone at least.
Bookmarks