How to add Button on Legend to enable/disable QwtPlotZoomer ?
Hi Everyone,
I have working on graph, where I have using 2 vertical and 2 horizontal lines(Draggable and droppable along the graph).
Not if I enable QwtPlotZoomer then while dragging Lines on the graph QwtPlotZoomer takes control, so on that node dragging and zooming both comes into effect.
Here I want a small button or something on the Legend which help me to enable or disable QwtPlotZoomer, so that on dragging lines zooming should not work and vice versa.
Thanks :)
Re: How to add Button on Legend to enable/disable QwtPlotZoomer ?
Hi ??? [npatil15],
there's an easy way to avoid zooming while dragging - define an additional keyboard modifier to distinguish between dragging or zooming.
If you really want a button, simply create a new curve, make the line attribute NoLine and make the legend button reacting on mouse clicks (see explanation in QwtBook https://ghorwin.github.io/qwtbook/in...isse-reagieren)
Bye,
Andreas
Re: How to add Button on Legend to enable/disable QwtPlotZoomer ?
Thanks ghorwin,
Yes by setting additional keyword will help but that's not the task.
And the link/knowledge you share it surely help me for my next task. But now I have some different pain.
Here I'm unable to add any linked instance, button or something like below code for QwtPlotZoomer, where I can click and do something for this clicked event.
(say setItemAttribute(QwtPlotItem::Legend, true);)
Re: How to add Button on Legend to enable/disable QwtPlotZoomer ?
Please anyone has any solution or suggestions over it ?
Re: How to add Button on Legend to enable/disable QwtPlotZoomer ?
Hi ghorwin,
Can you just tell me how I can use ctrl to switch between zoom and dragging option ?
I don't understand properly how to use setMousePattern to enable plot zoomer.
Thanks
Added after 1 6 minutes:
I have done this, just for the reference I'll mention it here,
Code:
m_zoomer
->setMousePattern
(QwtEventPattern::MouseSelect1,Qt
::LeftButton, Qt
::ControlModifier);
:cool:
Re: How to add Button on Legend to enable/disable QwtPlotZoomer ?
Hi,
I'm facing issue regarding the same again,
I still need PushButton on legend, and other marker should not override on it.
I have done line this below,
But here this button is come over one of the QwtPlotMarker.
Please suggest, how I can do that ?
Re: How to add Button on Legend to enable/disable QwtPlotZoomer ?
I have done it,
Answer is mention at the end of this post
https://www.qtcentre.org/threads/699...fier)?p=304315
:cool: