Results 1 to 3 of 3

Thread: Move the Center of QwtPlot to specific coordinates

  1. #1
    Join Date
    Nov 2014
    Posts
    4
    Thanks
    1
    Qt products
    Qt5
    Platforms
    Unix/X11

    Default Move the Center of QwtPlot to specific coordinates

    Hello,

    I've created a class that inherits from QwtPlot, and then added a slot connected to a signal caught at mouse drag/move events:

    Qt Code:
    1. class UI : public QwtPlot
    2. {
    3. public:
    4.  
    5. UI ( ) : ...
    6. {
    7. ...
    8. _pickerMachine = std::make_shared<QwtPickerDragPointMachine>();
    9. _picker->setStateMachine( _pickerMachine.get() );
    10. connect( _picker.get(), SIGNAL ( moved ( QPoint ) ), this, SLOT ( callback ( QPoint ) ) );
    11. ...
    12. }
    13.  
    14. public slots:
    15.  
    16. void callback ( QPoint point )
    17. {
    18. std::cout << "move callback to: " << point.x() << "," << point.y() << std::endl;
    19. }
    20.  
    21. private:
    22. ...
    23. }
    To copy to clipboard, switch view to plain text mode 

    I understand that I can ask for a replot, although I'm not sure how. Been searching for a few hours but couldn't find much info.
    My callback does get signaled the position of the mouse click, how can I move the plot to use as center the QPoint where the mouse click occured?

  2. #2
    Join Date
    Dec 2013
    Location
    Toronto, Canada
    Posts
    62
    Thanked 16 Times in 15 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Move the Center of QwtPlot to specific coordinates

    If you are looking for panning functionality, check-out QwtPanner class

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

    alexge233 (22nd November 2014)

  4. #3
    Join Date
    Nov 2014
    Posts
    4
    Thanks
    1
    Qt products
    Qt5
    Platforms
    Unix/X11

    Default Re: Move the Center of QwtPlot to specific coordinates

    Thanks very much Cah, I managed to solve it without the QwtPickerDragPointMachine, but with QwtPlotPanner as you suggested!

    Alex

Similar Threads

  1. Replies: 1
    Last Post: 3rd December 2013, 22:19
  2. Move text rigth,left and center
    By askatuak in forum Qt Quick
    Replies: 0
    Last Post: 20th September 2013, 15:09
  3. Replies: 1
    Last Post: 25th July 2013, 07:27
  4. QGraphicsTextItem center based coordinates
    By mihnen in forum Qt Programming
    Replies: 3
    Last Post: 19th September 2012, 17:48
  5. QListView: How to move the cursor to a specific row
    By muellerp in forum Qt Programming
    Replies: 2
    Last Post: 21st November 2008, 08:29

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.