Results 1 to 4 of 4

Thread: How to set previous Zoom positions using Qwt

  1. #1
    Join Date
    Jun 2007
    Posts
    18
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default How to set previous Zoom positions using Qwt

    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,

  2. #2
    Join Date
    Aug 2006
    Posts
    25
    Thanks
    8
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How to set previous Zoom positions using Qwt

    From reading the QwtPlotZoomer Class Reference

    I'd say you should use:
    Qt Code:
    1. class abc
    2. {
    3. ...
    4. QwtPlotZoomer *some_zoomer;
    5. ...
    6. public:
    7. void last_zoom(void) {
    8. if(0 == some_zoomer->zoomRectIndex()) return;
    9. some_zoomer->zoom(-1);
    10. }
    11. ...
    12. };
    To copy to clipboard, switch view to plain text mode 

    hope this helps

    for more info see http://qwt.sourceforge.net/ or
    http://qwt.sourceforge.net/class_qwt_plot_zoomer.html

  3. #3
    Join Date
    Jun 2007
    Posts
    18
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How to set previous Zoom positions using Qwt

    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,

  4. #4
    Join Date
    Feb 2006
    Location
    Munich, Germany
    Posts
    3,296
    Thanked 878 Times in 826 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: How to set previous Zoom positions using Qwt

    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:

    Qt Code:
    1. virtual void YourPanner::moveCanvas(int dx, int dy)
    2. {
    3. QwtPlotPanner::moveCanvas(dx, dy);
    4.  
    5. QStack<QwtDoubleRect> &zoomStack =
    6. const_cast< QStack<QwtDoubleRect> >zoomer->zoomStack();
    7. zoomStack.push(zoomer->scaleRect());
    8. zoomer->zoom(1);
    9. }
    To copy to clipboard, switch view to plain text mode 

    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
    Last edited by Uwe; 26th November 2007 at 09:33.

Similar Threads

  1. Qwt zoom vs. Qt move
    By user in forum Qwt
    Replies: 6
    Last Post: 14th November 2007, 22:09

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.