I have created a subclass of the QwtPlotPicker (aka MyPlotPicker) and overridden the trackerTextF() function because I want it to display more than X/Y values. In my trackerTextF() function, all I do for the moment is print out the function name to the terminal using cout.
While the application is running, when I press the left mouse button down, my functions name appears in the terminal four times -- but I only expected to it to appear once.
I am guessing that for some reason the trackerTextF() function is being called four times, but I cannot figure out why that would be so. Is this by design? One thing I did notice is that if I change the picker machine from Drag to Click, my trackerTextF() function only gets called twice.
Here is my code...
{
public:
pCanvas), mp_Gui(pGui)
{
setRubberBandPen
(QColor(Qt
::white));
}
protected:
{
cout << "trackerTextF" << endl;
return text;
}
private:
Gui* mp_Gui;
};
class MyOtherPicker: public QwtPlotPicker
{
public:
MyOtherPicker(QwtPlotCanvas* pCanvas, Gui* pGui): QwtPlotPicker(QwtPlot::xBottom,
QwtPlot::yLeft, QwtPlotPicker::CrossRubberBand, QwtPicker::ActiveOnly,
pCanvas), mp_Gui(pGui)
{
setStateMachine(new QwtPickerClickPointMachine());
setRubberBandPen(QColor(Qt::white));
}
protected:
virtual QwtText trackerTextF(const QPointF &pos) const
{
cout << "trackerTextF" << endl;
QwtText text;
return text;
}
private:
Gui* mp_Gui;
};
To copy to clipboard, switch view to plain text mode
Bookmarks