PDA

View Full Version : How to set previous Zoom positions using Qwt



seguprasad
23rd November 2007, 11:43
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,

bhs-ittech
23rd November 2007, 12:58
From reading the QwtPlotZoomer Class Reference

I'd say you should use:


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

seguprasad
26th November 2007, 06:55
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,

Uwe
26th November 2007, 09:18
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:



virtual void YourPanner::moveCanvas(int dx, int dy)
{
QwtPlotPanner::moveCanvas(dx, 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