PDA

View Full Version : How to use QwtEventPattern correctly?



rambo83
23rd November 2009, 08:07
Hello,

I just wanted to change the behaviour of my Zoomer, so that the zoom in effect is not affected from the Leftbutton, but from the Rightbutton, thus I could use LeftButton for selection in QwtPlotPicker.
Unfortunately, I don't understand what the statement means:

zoomer->setMousePattern(QwtEventPattern::MouseSelect2,
Qt::RightButton, Qt::ControlModifier);
QwtEventPattern::MouseSelect2 means already that the Rightbutton will be used, why then the second parameter Qt::RightButton? How can I change zoom function from LeftButton to Rightbutton? I use the zoomer from spectrogram example.


QwtPlotZoomer* zoomer = new MyZoomer(canvas());
#if QT_VERSION < 0x040000
zoomer->setMousePattern(QwtEventPattern::MouseSelect2,
Qt::RightButton, Qt::ControlButton);
#else
zoomer->setMousePattern(QwtEventPattern::MouseSelect2,
Qt::RightButton, Qt::ControlModifier);
#endif
zoomer->setMousePattern(QwtEventPattern::MouseSelect3,
Qt::RightButton);

QwtPlotPanner *panner = new QwtPlotPanner(canvas());
panner->setAxisEnabled(QwtPlot::yRight, false);
panner->setMouseButton(Qt::MidButton);


For the panning function it is straightforward, that the MidButton will take over this action, but for zoom in and zoom out, it is not clear for me. Please explain it to me.

Thank you.

best regards

Uwe
23rd November 2009, 14:03
Depending on the selection type the patterns are used differently. In your case the following code assigns all user interactions (zoom in, zoom out 1 and unzoom (0) to the right mouse button.
zoomer->setMousePattern(QwtEventPattern::MouseSelect1, Qt::RightButton);
zoomer->setMousePattern(QwtEventPattern::MouseSelect2, Qt::RightButton, Qt::ControlModifier);
zoomer->setMousePattern(QwtEventPattern::MouseSelect3, Qt::RightButton, Qt::ShiftModifier);

Uwe

rambo83
23rd November 2009, 14:33
Thank you, Uwe.

Meanwhile, I have separated the PlotPicker and Zoomer interactions by a Toolbutton which enables or disables the on of the QwtPickers.
But probably I will test your suggestion, to make the interaction faster.

regards

suresh.b
22nd August 2016, 17:49
picker->setMousePattern(QwtEventPattern::MouseSelect1,Qt:: RightButton); // crashes reason i installed UFT 12.53 automation testing tool and added QT Add-in while installing UFT

please suggest me

Uwe
24th August 2016, 01:45
I don't know the UFT test tool and I have no idea what it does. So I'm afraid you have to use your debugger to find out what part of the application crashes - maybe coming back with a call stack.
At least you have to feed me with more information, than posting a line of your code.

Uwe

PS: please start a new thread instead of continuing to another almost unrelated one.