Results 1 to 6 of 6

Thread: Keep PlotPicker rectangle after mouse button released

  1. #1
    Join Date
    Apr 2011
    Location
    Bayreuth, Bayern
    Posts
    24
    Thanks
    12
    Qt products
    Qt4
    Platforms
    Windows

    Default Keep PlotPicker rectangle after mouse button released

    Hey!
    I have trouble figuring out which behaviour of which class has to be overriden.

    I need to draw a rectangle when user presses left mouse button and drags mouse (like QwtPlotZoomer does), but after the button is released, the rectangle should not disappear. The drawn rectangle should remain until user starts drawing another rectangle or presses right mouse button to clear the plot area.

    I have tried inheriting from QwtPickerDragRectMachine, but I am not really sure which behavior should be overriden. What do the states mean? Does e.g. setState(0) in QList<QwtPickerMachine::Command> QwtPickerClickRectMachine::transition(const QwtEventPattern &eventPattern, const QEvent *event) reset the rectangle?

    I could create a second QwtPlotPicker, which would not be interactive and would only be triggered by a signal coming from the first QwtPlotPicker as soon as the rectangle is finished. I find such a solution not extraordinarily beautiful and if it possible to implement the functionality I am striving for in one class, I'd rather go for that option.

    Thanks in advance for any help!

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

    Default Re: Keep PlotPicker rectangle after mouse button released

    Insert a new QwtPlotShapeItem with the coordinates of the rectangle.

    Uwe

  3. #3
    Join Date
    Apr 2011
    Location
    Bayreuth, Bayern
    Posts
    24
    Thanks
    12
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Keep PlotPicker rectangle after mouse button released

    Quote Originally Posted by Uwe View Post
    Insert a new QwtPlotShapeItem with the coordinates of the rectangle.

    Uwe
    Hey Uwe,
    where do I find a QwtPlotShapeItem? It is not in Qwt 6.0.2, neither in the docs, nor in the sources.

  4. #4
    Join Date
    Mar 2013
    Posts
    19
    Thanks
    1
    Qt products
    Qt5
    Platforms
    Unix/X11

    Default Re: Keep PlotPicker rectangle after mouse button released

    You have to use 6.1
    svn checkout svn://svn.code.sf.net/p/qwt/code/trunk/qwt
    I had to upgrade mine also to use this item recently.

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

    Default Re: Keep PlotPicker rectangle after mouse button released

    Another option is to copy the code of the RectItem ( 6.0 only ) you find in the navigation example.

    Uwe

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

    missoni (12th March 2013)

  7. #6
    Join Date
    Apr 2011
    Location
    Bayreuth, Bayern
    Posts
    24
    Thanks
    12
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Keep PlotPicker rectangle after mouse button released

    Quote Originally Posted by Uwe View Post
    Another option is to copy the code of the RectItem ( 6.0 only ) you find in the navigation example.

    Uwe
    Awesome, thanks!

    Quote Originally Posted by raphael.lencrerot View Post
    You have to use 6.1
    svn checkout svn://svn.code.sf.net/p/qwt/code/trunk/qwt
    I had to upgrade mine also to use this item recently.
    Thanks for your advice. I tried copying only the necessary files, but there have been too many changes since 6.0.2. I will have to upgrade whole Qwt soon.

Similar Threads

  1. PlotPicker: TrackerText Position
    By FelixB in forum Qwt
    Replies: 2
    Last Post: 14th December 2010, 09:27
  2. Replies: 1
    Last Post: 24th May 2010, 12:57
  3. mouse event: right button
    By mattia in forum Newbie
    Replies: 1
    Last Post: 30th October 2007, 09:00
  4. Mouse Over event on button
    By vishal.chauhan in forum Qt Programming
    Replies: 9
    Last Post: 10th January 2007, 06:03
  5. Middle Button Mouse
    By jaime in forum Qt Programming
    Replies: 1
    Last Post: 25th August 2006, 04:01

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.