Results 1 to 2 of 2

Thread: Map QwtPlotMagnifier to a button

  1. #1
    Join Date
    Jul 2009
    Posts
    4
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Map QwtPlotMagnifier to a button

    Hey guys,

    I have a QwtPlotMagnifier object that I can control fine with the scroll wheel of a mouse, however I want to implement 2 QPushButton's (for zoom in and zoom out) and control the zooming from here.

    Any ideas on how I can achieve this?

  2. #2
    Join Date
    Jul 2009
    Posts
    4
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Map QwtPlotMagnifier to a button

    Just posting for anyone who's trying to achieve the same thing, I came up with a solution when I had another look at it (it pretty obvious actually).

    I simply subclassed the QwtPlotMagnifier class, and then used the rescale() function.

    I then create two slots as below, and then connected them to a toggled() signal.

    Qt Code:
    1. // Zoom in
    2. void MyPlotZoom::zoomIn(void)
    3. {
    4. QwtPlotMagnifier::rescale(0.8);
    5. }
    6.  
    7. // Zoom out
    8. void MyPlotZoom::zoomOut(void)
    9. {
    10. QwtPlotMagnifier::rescale(1.2);
    11. }
    To copy to clipboard, switch view to plain text mode 

Similar Threads

  1. Replies: 2
    Last Post: 10th November 2009, 06:17
  2. Button Text Position
    By Slewman in forum Qt Tools
    Replies: 1
    Last Post: 29th September 2009, 16:35
  3. button background color when it is clicked
    By navi1084 in forum Qt Programming
    Replies: 4
    Last Post: 9th December 2008, 15:02
  4. button with backgr and icon using stylesheets
    By s_p_t10 in forum Qt Programming
    Replies: 0
    Last Post: 7th May 2008, 20:19
  5. question about button
    By narumi in forum Newbie
    Replies: 2
    Last Post: 21st January 2008, 05:44

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.