Results 1 to 9 of 9

Thread: Problem with the QwtPlotMagnifier

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

    Default Problem with the QwtPlotMagnifier

    Hi All,

    I am using QwtPlotMagnifier class to implement zoomIn and zoomOut functionalities for the plot.I am handling the Zooming functionality when the "Control" button and the two mouse buttons are pressed.I am able to ZoomIn the plot but once the mouse buttons are released the plot is coming to the original position.


    Can you help me to solve this problem

  2. #2
    Join Date
    Feb 2006
    Location
    Munich, Germany
    Posts
    3,253
    Thanked 860 Times in 809 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Problem with the QwtPlotMagnifier

    Please post the code, how you intialize your magnifier ?

    Uwe

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

    Default Re: Problem with the QwtPlotMagnifier

    Thanks for your response.

    i just created a pointer to QwtPlotMagnifier,
    QwtPlotMagnifier * m_ptrzoomIn = new QwtPlotMagnifier(plot()->canvas());
    m_ptrzoomIn->setMouseButton(Qt::RightButton,Qt::ControlModifie r);

    i am able to zoomIn and zoomout but if i release the right button it is coming to the original position.

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

    Default Re: Problem with the QwtPlotMagnifier

    I added your code to the simple example and everything works like expected. Do you have other navigation objects ( f.e. a zoomer, where CTRL + Right means to zoom out ) attached to your plot ?

    Uwe

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

    Default Re: Problem with the QwtPlotMagnifier

    I am handling that in MousePressEvent.If i click Ctrl+Right button then i am calling the above code.

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

    Default Re: Problem with the QwtPlotMagnifier

    All navigation objects ( panner, zoomer, magnifier ) filter the events of the plot canvas. You simply create/attach them in the setup of your plot widget and don't do any additional handling of the mouse/key/wheel events. Please move your code to the constructor of your plot widget.

    If you create/attach a magnifier inside the mouse press handler of your own event filter the magnifier will miss the press event, and starts with mouse release event ( beside you have activated mouse tracking manually). Looking at the code I would expect, that the magnifier does nothing.

    Obviously there is something else in your code that conflicts. Please remove all your own mouse handling code and try again.

    Uwe

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

    Default Re: Problem with the QwtPlotMagnifier

    It is working fine when i am disabling the zoomer i.e.,QwtPlotZoomer.If i disable the zoomer class it is working fine.But i need to handle both.How can i rectify this problem

    Thanks,

  8. #8
    Join Date
    Feb 2006
    Location
    Munich, Germany
    Posts
    3,253
    Thanked 860 Times in 809 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Problem with the QwtPlotMagnifier

    Quote Originally Posted by seguprasad View Post
    It is working fine when i am disabling the zoomer ...
    Didn't I ask explicitely for other navigation objects ?

    Anyway, the default configuration of the zoomer uses the left button to zoom in and the right mouse button to zoom out. You have to find a different combination, that doesn't conflict with your left+right button idea. The spectrogram example shows how to change the buttons.

    But note, that you will see often (always ?) a left or right mouse button click before you get the left+right click, simply because it's difficult to press both buttons synchronously.

    Uwe

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

    Default Re: Problem with the QwtPlotMagnifier

    Thank you for your reply,

    Now it is working fine.

    Thanks and Regards,

Similar Threads

  1. Graphics view display problem.
    By kiranraj in forum Qt Programming
    Replies: 3
    Last Post: 20th July 2007, 08:08
  2. [QMYSQL] connection problem
    By chaos_theory in forum Installation and Deployment
    Replies: 5
    Last Post: 2nd July 2007, 10:52
  3. Grid Layout Problem
    By Seema Rao in forum Qt Programming
    Replies: 2
    Last Post: 4th May 2006, 13:45
  4. Problem with bitBlt
    By yellowmat in forum Newbie
    Replies: 1
    Last Post: 5th April 2006, 15:08
  5. Replies: 16
    Last Post: 7th March 2006, 16:57

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.