1 Attachment(s)
reimplement drawTracker issue in my picker class derived from QwtPlotPicker
Hi,
I use QwtPlotPicker to track user's moving by Left/Right key in plot. I subclass QwtPlotPicker and reimplement trackerRect and drawTracker method to show one vertical dotline in plot, I got it but the vertical dotline is very short and not my expected. please see follow code and result. I need the vertical dotline to be as from bottom to top, anyone can give some suggestions? thanks.
Code:
{
const QwtPlot *pickerPlot
= plot
();
int min = scaleDiv->lowerBound();
int max = scaleDiv->upperBound();
QRect rect
(0, min,
100,
(max
-min
));
rect.moveTo(p.x(), min);
return rect;
}
void CsmPicker
::drawTracker(QPainter *painter
) const {
const QwtPlot *pickerPlot
= plot
();
int min = scaleDiv->lowerBound() + 5;
int max = scaleDiv->upperBound() - 5;
pen.setStyle(Qt::DotLine);
painter->setPen(pen);
QFont font
= painter
->font
();
painter->setClipRect(trackerRect(font));
painter->drawLine(p.x(), min, p.x(), max);
painter->drawText(p.x(), p.y(), "Test");
if (p.x() < 0) p.setX(0);
emit mouseMoving(p);
}
Attachment 7381
Re: reimplement drawTracker issue in my picker class derived from QwtPlotPicker
What about using QwtPicker::VLineRubberBand ?
Uwe
Re: reimplement drawTracker issue in my picker class derived from QwtPlotPicker
thanks for your reply. rubberBand only for stateMachine points selection mode, but in my case, it is mouse tracking mode.
Added after 31 minutes:
It is fixed using QwtPicker::VLineRubberBand and set QwtPickerMachine to QwtPickerTrackerMachine. thanks.