Results 1 to 2 of 2

Thread: I do not understand QwtEventPattern. Can someone explain?

  1. #1
    Join Date
    Mar 2008
    Location
    Colorado, USA
    Posts
    10
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default I do not understand QwtEventPattern. Can someone explain?

    What does make sense to me:

    Qt Code:
    1. QwtPlotMagnifier * magnifier;
    2. magnifier->setMouseButton(Qt::MiddleButton);
    To copy to clipboard, switch view to plain text mode 
    This makes sense. I assign the middle button to the magnifying function.

    What doesn't make sense:
    Qt Code:
    1. QwtPlotPicker * picker;
    2. picker->setMousePattern(QwtEventPattern::MouseSelect2, Qt::RightButton);
    To copy to clipboard, switch view to plain text mode 
    I simply don't understand the event patterns. I want to assign the right mouse button to the picker, but I don't know where the QwtEventPattern::MouseSelect2 fits in.

    I see the header that, for instance QwtEventPattern::MouseSelect2
    is
    Qt Code:
    1. /*!
    2.   The default setting for 1, 2 and 3 button mice is:
    3.  
    4.   - Qt::LeftButton + Qt::ControlModifier
    5.   - Qt::RightButton
    6.   - Qt::RightButton
    7.   */
    To copy to clipboard, switch view to plain text mode 
    but I simply don't know what this means, and how it relates to the buttons I want to assign. (I mean, I know what each individual component is, like Qt::RightButton, but I don't know what the 3 mean collectively).

  2. #2
    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: I do not understand QwtEventPattern. Can someone explain?

    QwtPickerMachine is a mealy machine ( http://en.wikipedia.org/wiki/Mealy_machine ), where QwtEventPattern::MousePatternCode/KeyPatternCode defines the input and QwtPickerMachine::Command the output alphabet.

    So what you can do on application side is:


    • Change the type of machine - mapping an inputs to a command sequence
    • change the mapping of mouse/keyboard events to the input alphabet
    • implement what to do on the commands ( f.e by overloading QwtPicker::move() )


    Not sure if this makes it more understandable when you are unfamiliar with the concept of state machines, but my experience is, that application requirements how to select things on a plot canvas is so different, that a simpler API like for QwtPlotMagnifier would not be enough.

    Uwe

Similar Threads

  1. How to use QwtEventPattern correctly?
    By rambo83 in forum Qwt
    Replies: 4
    Last Post: 24th August 2016, 01:45
  2. Replies: 11
    Last Post: 17th March 2011, 20:17
  3. Can anybody explain me this 'kind of casting'¿?
    By tonnot in forum General Programming
    Replies: 6
    Last Post: 28th November 2010, 19:39
  4. Can't explain these errors
    By Petr_Kropotkin in forum Newbie
    Replies: 4
    Last Post: 23rd January 2010, 19:06
  5. could somebody please explain const to me?
    By mikro in forum General Programming
    Replies: 4
    Last Post: 29th September 2006, 14:34

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.