Results 1 to 6 of 6

Thread: qwt zoomer: a complete user case scenario?

  1. #1
    Join Date
    Nov 2010
    Posts
    142
    Thanks
    24
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default qwt zoomer: a complete user case scenario?

    how should i modify the "bode" example in order to implement the following user case scenario?

    1. press the zoom button (on)
    2. zoom in, several times
    3. press the zoom button off( being satisfied with the zooming so far)
    4. later I realize that i want to zoom out a bit and press again the zoom button (on)
    5. zoom out and press the zoom button (off)
    6. open a new data file and plot a new plot (with axis rescaled)
    7. repeat steps 1-6 for the new plot
    8. end
    Last edited by fatecasino; 21st December 2010 at 14:43. Reason: updated contents

  2. #2
    Join Date
    Oct 2010
    Location
    Berlin, Germany
    Posts
    358
    Thanks
    18
    Thanked 68 Times in 66 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: qwt zoomer: a complete user case scenario?

    i'm not familiar with the bode example. is that the example with srollbars?

    you have to call "SetZoomBase()" after (6). If that does not work, you have to reinstall the zoomer. The first 5 points should work without problems...

  3. #3
    Join Date
    Nov 2010
    Posts
    142
    Thanks
    24
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: qwt zoomer: a complete user case scenario?

    the "bode" example is the very first one that implements the zoomer(see attached screenshot). The main problems are so far:

    STEP 3: when you unclick the zoom button, the plot resets to the initial status(totally unzoomed), so I am losing the initial work of zooming into a specific area. This means that I have to find the zooming area in my first go.

    I solved this by inserting setZoomBase() to the function that is called with the zoom button:

    Qt Code:
    1. void my2dPlot::enableZoomMode(bool on)
    2. {
    3. myPlot->replot();//i am not sure if this is actually needed
    4.  
    5. m_zoomer->setZoomBase();
    6.  
    7. m_zoomer->setEnabled(on);
    8. m_zoomer->zoom(0);
    9.  
    10. d_picker->setEnabled(!on);
    11.  
    12. }
    To copy to clipboard, switch view to plain text mode 

    The good thing now
    when I unclick the zoom button the plot stays as it is (zoomed).

    The bad thing now
    when I unclick the zoom button and then click again to correct my zooming area, I cannot go back (unzoom), I can only zoom further in (or pan)

    STEP 6: solved it using UWE recommendations and adding
    Qt Code:
    1. myPlot->setAxisAutoScale(QwtPlot::xBottom);
    2. myPlot->setAxisAutoScale(QwtPlot::yLeft);
    To copy to clipboard, switch view to plain text mode 
    at the constructor of the myPlot
    Attached Images Attached Images

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

    Default Re: qwt zoomer: a complete user case scenario?

    Quote Originally Posted by fatecasino View Post
    Qt Code:
    1. m_zoomer->setEnabled(on);
    2. m_zoomer->zoom(0);
    To copy to clipboard, switch view to plain text mode 
    From the documentation of QwtPlotZoomer::zoom:

    "A value of 0 zooms out to the zoom base."
    You might complain about the documentation, but this is no excuse for not reading what is there.

    Uwe

  5. #5
    Join Date
    Nov 2010
    Posts
    142
    Thanks
    24
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: qwt zoomer: a complete user case scenario?

    Hi,

    I had included these 2 lines

    Qt Code:
    1. m_zoomer->setEnabled(on);
    2. m_zoomer->zoom(0);
    To copy to clipboard, switch view to plain text mode 

    in my enableZoomMode(bool on) function

    Qt Code:
    1. void my2dPlot::enableZoomMode(bool on)
    2. {
    3. myPlot->replot();//i am not sure if this is actually needed
    4.  
    5. m_zoomer->setZoomBase();
    6.  
    7. m_zoomer->setEnabled(on);
    8. m_zoomer->zoom(0);
    9.  
    10. d_picker->setEnabled(!on);
    11.  
    12. }
    To copy to clipboard, switch view to plain text mode 

    And I managed to load plots,and then load other plots without having any problem with the axis. The problem as I mention above is that if I zoom in and press the zoom button off then I cannot zoom out again- i can only zoom further in.

    If I remove this line:

    Qt Code:
    1. m_zoomer->setZoomBase();
    To copy to clipboard, switch view to plain text mode 

    then whenever I push the button the plot will reset and this is not the actual purpose. The user must focus to select the exact area that s/he finds interesting. Perhaps the user wants to zoom in/out several times to get to the desired lever/area of zoom.

    Is there a way to make the zoomer remember all the zoom steps so it can zoom/unzoom as much as the user wants at any part of the application?

    PS:well, the documentation is good, but a few tutorials would make things grow and develop really faster!thanks anyway,after reading some tens of fora I find that you support qwt in an admirable manner.
    Last edited by fatecasino; 23rd December 2010 at 23:41. Reason: updated contents

  6. #6
    Join Date
    Feb 2006
    Location
    Munich, Germany
    Posts
    3,312
    Thanked 879 Times in 827 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: qwt zoomer: a complete user case scenario?

    This is the code you are looking for:

    Qt Code:
    1. void my2dPlot::enableZoomMode(bool on)
    2. {
    3. m_zoomer->setEnabled(on);
    4. d_picker->setEnabled(!on);
    5. }
    To copy to clipboard, switch view to plain text mode 

    In your previous code you had the following line:

    Qt Code:
    1. m_zoomer->zoom(0);
    To copy to clipboard, switch view to plain text mode 
    If you don't want it - don't do it.

    Uwe

Similar Threads

  1. qmake project setup - qtestlib scenario
    By dsaiko in forum Qt Programming
    Replies: 1
    Last Post: 6th June 2011, 15:52
  2. how to get zoomer to replot
    By kja in forum Newbie
    Replies: 3
    Last Post: 17th November 2010, 07:15
  3. LGPL License is sufficient or not for the below scenario
    By khan in forum Installation and Deployment
    Replies: 2
    Last Post: 22nd April 2010, 11:33
  4. Problem with Zoomer
    By rambo83 in forum Qwt
    Replies: 1
    Last Post: 10th March 2010, 12:35
  5. Replies: 2
    Last Post: 8th November 2009, 05:30

Tags for this Thread

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.