Results 1 to 4 of 4

Thread: How to disable QwtPlotMagnifier right click

  1. #1
    Join Date
    Apr 2008
    Posts
    53
    Thanks
    10

    Default How to disable QwtPlotMagnifier right click

    Hi,

    When I use QwtPlotMagnifier for zooming, it assigns the right mouse button for zooming in and out when u hold right mouse button and move up/down. How do I disable this so that I can use it for the QwtPlotZoomer rubberband? Thank you.

    -James

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

    Default Re: How to disable QwtPlotMagnifier right click


  3. #3
    Join Date
    Apr 2008
    Posts
    53
    Thanks
    10

    Default Re: How to disable QwtPlotMagnifier right click

    Thanks Uwe,

    The solution is to do:

    mMagnify->setMouseButton(QwtEventPattern::MouseSelect6, Qt::NoButton);

    I didn't realize that MouseSelect6 was the one I need to set, thanks

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

    Default Re: How to disable QwtPlotMagnifier right click

    Quote Originally Posted by jmsbc View Post
    I didn't realize that MouseSelect6 was the one I need to set, thanks
    No, QwtEventPattern::MousePatternCode has absolutely nothing to do with the parameter you have to set in QwtMagnifier::setMouseButton. MouseSelect6 is simply the 6th enum value and is mapped to 5 by the compiler, what might be a value, that does what you want - but this by accident and passing the 6th value of any other enum (or a blank 5 ) would have the same effect.

    The values you have to use are those you find in a QMouseEvent:

    Qt Code:
    1. void QwtMagnifier::setMouseButton(int button, int buttonState)
    2. {
    3. d_data->mouseButton = button;
    4. d_data->mouseButtonState = buttonState;
    5. }
    6.  
    7. void QwtMagnifier::widgetMousePressEvent(QMouseEvent *me)
    8. {
    9. if ( me->button() != d_data->mouseButton || parentWidget() == NULL )
    10. return;
    11.  
    12. if ( (me->modifiers() & Qt::KeyboardModifierMask) !=
    13. (int)(d_data->mouseButtonState & Qt::KeyboardModifierMask) )
    14. {
    15. return;
    16. }
    17.  
    18. ...
    19. }
    To copy to clipboard, switch view to plain text mode 

    Uwe

  5. The following user says thank you to Uwe for this useful post:

    embeddedmz (20th June 2019)

Similar Threads

  1. QDockWidget: disable double click on title bar
    By ElectroQt in forum Qt Programming
    Replies: 2
    Last Post: 9th October 2008, 22:22
  2. Double click resize window disable
    By MarkoSan in forum Qt Programming
    Replies: 3
    Last Post: 13th May 2008, 11:35
  3. Disable QTextCursor Mouse click repositioning
    By VireX in forum Qt Programming
    Replies: 2
    Last Post: 3rd April 2007, 08:08
  4. Replies: 1
    Last Post: 9th February 2007, 09:41
  5. Replies: 4
    Last Post: 31st August 2006, 12:11

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.