Results 1 to 5 of 5

Thread: How to use QwtEventPattern correctly?

  1. #1
    Join Date
    Nov 2009
    Posts
    94
    Thanks
    14
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11

    Question How to use QwtEventPattern correctly?

    Hello,

    I just wanted to change the behaviour of my Zoomer, so that the zoom in effect is not affected from the Leftbutton, but from the Rightbutton, thus I could use LeftButton for selection in QwtPlotPicker.
    Unfortunately, I don't understand what the statement means:
    Qt Code:
    1. zoomer->setMousePattern(QwtEventPattern::MouseSelect2,
    2. Qt::RightButton, Qt::ControlModifier);
    To copy to clipboard, switch view to plain text mode 
    QwtEventPattern::MouseSelect2 means already that the Rightbutton will be used, why then the second parameter Qt::RightButton? How can I change zoom function from LeftButton to Rightbutton? I use the zoomer from spectrogram example.

    Qt Code:
    1. QwtPlotZoomer* zoomer = new MyZoomer(canvas());
    2. #if QT_VERSION < 0x040000
    3. zoomer->setMousePattern(QwtEventPattern::MouseSelect2,
    4. Qt::RightButton, Qt::ControlButton);
    5. #else
    6. zoomer->setMousePattern(QwtEventPattern::MouseSelect2,
    7. Qt::RightButton, Qt::ControlModifier);
    8. #endif
    9. zoomer->setMousePattern(QwtEventPattern::MouseSelect3,
    10. Qt::RightButton);
    11.  
    12. QwtPlotPanner *panner = new QwtPlotPanner(canvas());
    13. panner->setAxisEnabled(QwtPlot::yRight, false);
    14. panner->setMouseButton(Qt::MidButton);
    To copy to clipboard, switch view to plain text mode 

    For the panning function it is straightforward, that the MidButton will take over this action, but for zoom in and zoom out, it is not clear for me. Please explain it to me.

    Thank you.

    best regards

  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 use QwtEventPattern correctly?

    Depending on the selection type the patterns are used differently. In your case the following code assigns all user interactions (zoom in, zoom out 1 and unzoom (0) to the right mouse button.
    Qt Code:
    1. zoomer->setMousePattern(QwtEventPattern::MouseSelect1, Qt::RightButton);
    2. zoomer->setMousePattern(QwtEventPattern::MouseSelect2, Qt::RightButton, Qt::ControlModifier);
    3. zoomer->setMousePattern(QwtEventPattern::MouseSelect3, Qt::RightButton, Qt::ShiftModifier);
    To copy to clipboard, switch view to plain text mode 

    Uwe

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

    rambo83 (23rd November 2009)

  4. #3
    Join Date
    Nov 2009
    Posts
    94
    Thanks
    14
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: How to use QwtEventPattern correctly?

    Thank you, Uwe.

    Meanwhile, I have separated the PlotPicker and Zoomer interactions by a Toolbutton which enables or disables the on of the QwtPickers.
    But probably I will test your suggestion, to make the interaction faster.

    regards

  5. #4
    Join Date
    Aug 2016
    Posts
    3
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Windows

    Default MouseSelect1,Qt::RightButton

    picker->setMousePattern(QwtEventPattern::MouseSelect1,Qt: :RightButton); // crashes reason i installed UFT 12.53 automation testing tool and added QT Add-in while installing UFT

    please suggest me

  6. #5
    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: MouseSelect1,Qt::RightButton

    I don't know the UFT test tool and I have no idea what it does. So I'm afraid you have to use your debugger to find out what part of the application crashes - maybe coming back with a call stack.
    At least you have to feed me with more information, than posting a line of your code.

    Uwe

    PS: please start a new thread instead of continuing to another almost unrelated one.

Similar Threads

  1. Replies: 11
    Last Post: 24th November 2009, 00:30
  2. Closing correctly sqlite connection?
    By 0xl33t in forum Newbie
    Replies: 1
    Last Post: 9th August 2009, 13:22
  3. correctly installed Qt4
    By Salazaar in forum Installation and Deployment
    Replies: 31
    Last Post: 7th May 2007, 07:24
  4. Replies: 1
    Last Post: 23rd August 2006, 18:02
  5. how to correctly compile threads support?
    By srhlefty in forum Installation and Deployment
    Replies: 9
    Last Post: 25th June 2006, 19:15

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.