Need to implement 2 grabbable cursors(markers)
I will be needing to implement 2 cursors (markers) in my graph. One should be able to grab
and move each of the 2 cursors with a deltaX, deltaY being displayed somewhere that
shows the difference between cursor1 and cursor 2.
This seems like functionality that someone would have already done, so before I start to reinvent the wheel, are there any examples of similar functionality out there?
If not any suggestions on how to best approach it?
Thank you.
Mark
Re: Need to implement 2 grabbable cursors(markers)
Something like this ?
Code:
{
public:
protected:
virtual void drawRubberBand
(QPainter*) const;
virtual QwtText trackerText
(const QwtDoublePoint
& pos
) const;
};
{
/*
We don't have a picker for a line, but the rectangle
selection is also selection of 2 points, so all we
have to do is to change the rubberband.
*/
setRubberBand(PolygonRubberBand);
}
void DistancePicker
::drawRubberBand(QPainter *painter
) const {
painter->drawPolygon(selection());
}
QwtText DistancePicker
::trackerText(const QwtDoublePoint
&pos
) const {
QwtText text
( " selection() as distance string " );
bg.setAlpha(180);
text.
setBackgroundBrush(QBrush(bg
));
return text;
}