PDA

View Full Version : rubberbanding with coordinates



shoyeb
8th December 2011, 05:59
hi,
i have designed a spectrogram. and now i want to enable rubberbanding on it. for this purpose am having a class as below:

class MyPicker: public QwtPlotPicker
{
public:

MyPicker(QwtPlotCanvas *canvas):
QwtPlotPicker(canvas)
{
setTrackerMode(AlwaysOn);
setRubberBand( RectRubberBand );
setStateMachine( new QwtPickerDragRectMachine() );

}

virtual QwtText trackerTextF(const QPointF &pos) const
{
QColor bg(Qt::white);
bg.setAlpha(200);

QwtText text = QwtPlotPicker::trackerTextF(pos);
text.setBackgroundBrush( QBrush( bg ));
return text;
}
};

with the help of this i am able to track the position of cursor and draw the rubberband but now i have two issues:

1. as soon as i release the rubberband the, the rubberband is disabled, and i want to show the rubberband.

2. also i want to have the plot coordinates of rubberband.

please tell me how to do this.