Keep PlotPicker rectangle after mouse button released
Hey!
I have trouble figuring out which behaviour of which class has to be overriden.
I need to draw a rectangle when user presses left mouse button and drags mouse (like QwtPlotZoomer does), but after the button is released, the rectangle should not disappear. The drawn rectangle should remain until user starts drawing another rectangle or presses right mouse button to clear the plot area.
I have tried inheriting from QwtPickerDragRectMachine, but I am not really sure which behavior should be overriden. What do the states mean? Does e.g. setState(0) in QList<QwtPickerMachine::Command> QwtPickerClickRectMachine::transition(const QwtEventPattern &eventPattern, const QEvent *event) reset the rectangle?
I could create a second QwtPlotPicker, which would not be interactive and would only be triggered by a signal coming from the first QwtPlotPicker as soon as the rectangle is finished. I find such a solution not extraordinarily beautiful and if it possible to implement the functionality I am striving for in one class, I'd rather go for that option.
Thanks in advance for any help!
Re: Keep PlotPicker rectangle after mouse button released
Insert a new QwtPlotShapeItem with the coordinates of the rectangle.
Uwe
Re: Keep PlotPicker rectangle after mouse button released
Quote:
Originally Posted by
Uwe
Insert a new QwtPlotShapeItem with the coordinates of the rectangle.
Uwe
Hey Uwe,
where do I find a QwtPlotShapeItem? It is not in Qwt 6.0.2, neither in the docs, nor in the sources.
Re: Keep PlotPicker rectangle after mouse button released
You have to use 6.1
svn checkout svn://svn.code.sf.net/p/qwt/code/trunk/qwt
I had to upgrade mine also to use this item recently.
Re: Keep PlotPicker rectangle after mouse button released
Another option is to copy the code of the RectItem ( 6.0 only ) you find in the navigation example.
Uwe
Re: Keep PlotPicker rectangle after mouse button released
Quote:
Originally Posted by
Uwe
Another option is to copy the code of the RectItem ( 6.0 only ) you find in the navigation example.
Uwe
Awesome, thanks!
Quote:
Originally Posted by
raphael.lencrerot
You have to use 6.1
svn checkout svn://svn.code.sf.net/p/qwt/code/trunk/qwt
I had to upgrade mine also to use this item recently.
Thanks for your advice. I tried copying only the necessary files, but there have been too many changes since 6.0.2. I will have to upgrade whole Qwt soon.