Hi All,
I am zooming the selected region of the plot using the QwtPlotZoomer.How can i set the previous zoomed position using QwtPlotZoomer.
Thanks,
Printable View
Hi All,
I am zooming the selected region of the plot using the QwtPlotZoomer.How can i set the previous zoomed position using QwtPlotZoomer.
Thanks,
From reading the QwtPlotZoomer Class Reference
I'd say you should use:
Code:
class abc { ... QwtPlotZoomer *some_zoomer; ... public: void last_zoom(void) { if(0 == some_zoomer->zoomRectIndex()) return; some_zoomer->zoom(-1); } ... };
hope this helps
for more info see http://qwt.sourceforge.net/ or
http://qwt.sourceforge.net/class_qwt_plot_zoomer.html
Thanks for your response...
That is working only for zooming,if i need to implement for panning.How can i set the previous panned position.
Thanks,
You need to implement a navigation history, where you have all zoomer and panner operations. One solution is to forward the rectangles of your panner into the zoom stack. Something like this:
Code:
virtual void YourPanner::moveCanvas(int dx, int dy) { QStack<QwtDoubleRect> &zoomStack = const_cast< QStack<QwtDoubleRect> >zoomer->zoomStack(); zoomStack.push(zoomer->scaleRect()); zoomer->zoom(1); }
Of course this is only a workaround for a design problem of Qwt, that should better organize the navigation history inside the plot widget.
Uwe