KeyPatternCode and QwtPlotZoomer/QwtPlotPicker
I have a QwtPlot that works with a QwtPlotPicker fine. I also implemented a QwtPlotZoomer that works fine. So when I left-click into the plot, both of them appear. What I really want is that the zoomer only appears when I synchronously press the Shift button on the keyboard, or the Ctrl key. I tried to catch this by implementing the keyPressEvent in the surrounding QMainWindow. But it turns out that the picker and the zoomer are not activated at all when the shift key is pressed. What is the hidden magic? I did not manage to make use of the KeyPatternCode. :confused:
Re: KeyPatternCode and QwtPlotZoomer/QwtPlotPicker
Quote:
Originally Posted by
eehmke
What I really want is that the zoomer only appears when I synchronously press the Shift button on the keyboard
Code:
zoomer
->setMousePattern
( QwtEventPattern::MouseSelect1, Qt
::LeftButton, Qt
::ShiftModifier );
HTH,
Uwe
Re: KeyPatternCode and QwtPlotZoomer/QwtPlotPicker
Quote:
Originally Posted by
Uwe
Code:
zoomer
->setMousePattern
( QwtEventPattern::MouseSelect1, Qt
::LeftButton, Qt
::ShiftModifier );
I tried this already. With or without this code, as soon a I press the shift button, zoomer and picker will not appear at all. As a workaround, I activate the zoomer with a toolbar button, as in the BodeDemo example. I forgot to mention I use PyQt/Qwt5. With the line above in the initializer, the zoomer stops working completely.
Re: KeyPatternCode and QwtPlotZoomer/QwtPlotPicker
Quote:
Originally Posted by
eehmke
I forgot to mention I use PyQt/Qwt5. With the line above in the initializer, the zoomer stops working completely.
There should be no difference between Qwt 5.x and Qwt 6.x here. Test this line with Qwt 5.2 in the spectrogram example. When it works there try to find out what makes the difference to your application.
Uwe