In general it might be wrong to connect to mouse event, as the zoomer also works with key events.
So the answer depends on what exactly you want to do.
Uwe
In general it might be wrong to connect to mouse event, as the zoomer also works with key events.
So the answer depends on what exactly you want to do.
Uwe
I have to set QwtPlotMarker value.
I have some lines(Marker) on the the plot, but due to zoom they get hidden behind the widget, so I just want to set it within the widget in that event.
And Yes I have tried to connect with SIGNAL(zoomed),
Qt Code:
{ public: { //setTrackerMode(QwtPicker::ActiveOnly); // RightButton: zoom out by 1 // Ctrl+RightButton: zoom out to full size //setZoomBase(true); } };To copy to clipboard, switch view to plain text modeQt Code:
To copy to clipboard, switch view to plain text modeBut unable to connect, got error like below,Qt Code:
To copy to clipboard, switch view to plain text mode
err_method_notfound(2304)[13984]: QObject::connect: No such signal QwtPlotZoomer::zoomed(const QRectF &rect)
Last edited by npatil15; 21st January 2019 at 06:04.
I already gave you an explicit answer on how to handle changes of the scales. This question looks like just another version of the same question.
Uwe
I'm not asking about how to handle the changes on scale but I want to know which signal get invoked on zooming using QwtPlotZoomer.
As I know I can use zoomed signal, but in my case the signal not connecting its showing some error as mentioned already.
I dont understand why signal is unable to connect ?
Okay, so it doesnt invoke any signal after zooming or during zooming ?
Or else is their any possibility that I can invoke signal manually after zooming ?
I'm not sure, but when I checked "qwt_plot_zoomer.h", it shows signal zoomed. So you mean it doesn't work here ?
Qt Code:
{ Q_OBJECT Q_SIGNALS: /*! A signal emitting the zoomRect(), when the plot has been zoomed in or out. \param rect Current zoom rectangle. */ }To copy to clipboard, switch view to plain text mode
I mean, that you try to solve a problem that is related to scale changes, where zooming is one reason for those to happen. So don't spend any time on handling zooming in a specific way, when you have a solution, that covers all situations.
Uwe
I'm not handling zooming in the specif way. Thats okay how it works. But after zooming their is something on my plot that gets hidden.
Actually what happens, after zooming on, plot get zoomed, that's okay for me, but here I already have some QwtPlotMarker(Lines(Horizontal and vertical)) on the plot which are sets on some specific position(based on pixel of widget) and when I zoom on plot the lines get hidden behind the plot. So If I know that zoom has done, then I can again set this line within the widget.
Yes I can get this lines back by just scroll again(as I have scroll event in that I can set the line as per the widget pixel area). So like that after zoom I want to set this line within the widget, so that lines always on the plot.
The markers disappear, when their position gets outside the boundaries of the scales. So you have to adjust their positions according to scale changes.
This solves the problem in a general way - not only, when scale changes happen because of zooming.
I already gave you all the details in https://www.qtcentre.org/threads/699...-QwtPlotMarker. If there is something unclear please continue in this thread, but don't expect any further responses to this one until you have explained why you can't follow my advice.
Uwe
npatil15 (22nd January 2019)
Thanks, I got what you want to say,
I have tried with your solution
Qt Code:
connect(m_plot->axisWidget(QwtPlot::xBottom), &QwtScaleWidget::scaleDivChanged, this, &OscilloscopeWidget::scaleChanged);To copy to clipboard, switch view to plain text modeBut getting this error below, Where is the mistake ?Qt Code:
void OscilloscopeWidget::scaleChanged() { qDebug()<<"Scale Changed"; }To copy to clipboard, switch view to plain text mode
oscilloscopewidget.obj:-1: error: LNK2019: unresolved external symbol "public: static struct QMetaObject const QwtScaleWidget::staticMetaObject" (?staticMetaObject@QwtScaleWidget@@2UQMetaObject@@ B) referenced in function "public: static class QMetaObject::Connection __cdecl QObject::connect<void (__cdecl QwtScaleWidget::*)(void),void (__cdecl OscilloscopeWidget::*)(void)>(class QwtScaleWidget const *,void (__cdecl QwtScaleWidget::*)(void),class OscilloscopeWidget const *,void (__cdecl OscilloscopeWidget::*)(void),enum Qt::ConnectionType)" (??$connect@P8QwtScaleWidget@@EAAXXZP8Oscilloscope Widget@@EAAXXZ@QObject@@SA?AVConnection@QMetaObjec t@@PEBVQwtScaleWidget@@P83@EAAXXZPEBVOscilloscopeW idget@@P84@EAAXXZW4ConnectionType@Qt@@@Z)
The second option from my resonse, that derives from QwtPlotMarker should be the better one.I have tried with your solution
This is a linker error, that depends on what you are linking and how those objects have been build.IBut getting this error below, Where is the mistake ?
The reason for this should be the same as the one that is responsible for the missing zoomed symbol.
Uwe
npatil15 (22nd January 2019)
Okay,
The 2nd solution works perfectly for me, without error.
For the reference, mentioned the solution here,
Qt Code:
{ public: YourMarker( ... ) { } void updateScaleDiv( const QwtScaleDiv& xMap, const QwtScaleDiv& ) override { const double margin = ...; // pixels const double min = xMap.invTransform( xMap.p1() + margin ); const double max = xMap.invTransform( xMap.p2() - margin ); setXValue( qBound( min, xValue(), max ) ); } };To copy to clipboard, switch view to plain text mode
Thank you so much![]()
Bookmarks