Results 1 to 8 of 8

Thread: Distance measuring in plot.

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Feb 2006
    Location
    Munich, Germany
    Posts
    3,326
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows
    Thanked 880 Times in 828 Posts

    Default Re: Distance measuring in plot.

    More coffee !

    Uwe

  2. #2

    Default Re: Distance measuring in plot.

    Instead of more coffee i think i need joint or something.....

    when i throw : setMousePattern( QwtEventPattern::MouseSelect4, Qt::LeftButton, Qt::NoButton ); in the zoomer, and
    setMousePattern( QwtEventPattern::MouseSelect2, Qt::LeftButton, Qt::NoButton ); in the distancepicker

    i would have expected different behavior than described above... ?
    what am i doing wrong ?

  3. #3
    Join Date
    Feb 2006
    Location
    Munich, Germany
    Posts
    3,326
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows
    Thanked 880 Times in 828 Posts

    Default Re: Distance measuring in plot.

    Quote Originally Posted by thejester View Post
    Instead of more coffee i think i need joint or something.....
    ... really boring like reading the 2 lines of documentation ?

    QwtPickerClickRectMachine implements a state machine with an input alphabet of 2 symbols:
    • QwtEventPattern::MouseSelect1
    • QwtEventPattern::KeySelect1.


    So don't be surprised, that changing the mouse/key bindings of other symbols doesn't have any effect on this state machine.

    Uwe

  4. #4

    Default Re: Distance measuring in plot.

    Uwe,

    I can understand your frustration, i assume its as big as mine

    You said : Use QwtEventPattern::setMousePattern() and redefine the input events for your distance picker.
    I looked up, where the setMousePattern could be called on, and discovered that QwtPlotPicker is derived from QwtEventPattern. Since my DistancePicker is a QwtPlotPicker i assumed calling the setMousePattern in DistancePicker's constructor would do it.

    I see now that all is handled through the statemachines.

    For me, as qwt newbie, its still confusing why QwtPlotPicker is derived from QwtEventPattern then.

    But anyway, ill create my own QwtPickerClickRectMachine for the distance picker then.

    Thanks for all help !

  5. #5
    Join Date
    Feb 2006
    Location
    Munich, Germany
    Posts
    3,326
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows
    Thanked 880 Times in 828 Posts

    Default Re: Distance measuring in plot.

    Quote Originally Posted by thejester View Post
    I see now that all is handled through the statemachines.
    Not all - the picker translates real mouse/key events into something abstract like QwtEventPattern::MouseSelect1 etc. Then this abstract symbol is handled by the state machine.

    You can easily implement your own state machine - f.e, when you want to terminate your selection with a different input as you have started it. But as long as you start and terminate your measurement with the same operations there is no need to implement your own state machine: all you need to do is to redefine QwtEventPattern::MouseSelect1, so that it doesn't interfere with your zoomer.

    You can call the whole system a bit "over-engineered" - but in the end it is very flexible and powerful.

    Something you should always have in mind when you are dealing with open source software: instead of playing hours around with parameters of a method you can always try to look into the implementation of this method.

    Uwe

Similar Threads

  1. Increase the distance between two lines in QTextEdit
    By ansar in forum Qt Programming
    Replies: 1
    Last Post: 30th March 2010, 23:08
  2. Distance Transform on a QImage
    By Franckesh in forum Qt Programming
    Replies: 2
    Last Post: 20th January 2010, 09:58
  3. pixel distance of gaps in scaleWidget
    By KosyakOFF in forum Qwt
    Replies: 1
    Last Post: 3rd November 2008, 11:02
  4. Double click distance
    By jbd in forum Qt Programming
    Replies: 3
    Last Post: 28th December 2007, 23:13
  5. QProgress Bar-Time Measuring
    By aegis in forum Qt Programming
    Replies: 4
    Last Post: 13th May 2007, 17:47

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
  •  
Qt is a trademark of The Qt Company.