Results 1 to 3 of 3

Thread: How do I dynamically adjust the position of QwtPlotMarker using mouse click & drag ?

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    May 2012
    Location
    Bangalore, India
    Posts
    271
    Thanks
    29
    Thanked 50 Times in 47 Posts
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: How do I dynamically adjust the position of QwtPlotMarker using mouse click & dra

    hey, you have already plotted that curve, so now Symbol by the click of mouse, for that use---->

    initialize this
    Qt Code:
    1. QwtPlotMarker *mark[1000];
    2. int i=0;
    3. QPoint pt;
    To copy to clipboard, switch view to plain text mode 

    Qt Code:
    1. void mousePressEvent(QMouseEvent *event){
    2. mark[i]=new QwtPlotMarker;
    3. mark[i]->setSymbol(your_symbol);
    4. mark[i]->setValue(pt.x(),pt.y());
    5. mark[i]->attach(your_plot);
    6. i++;
    7. }
    To copy to clipboard, switch view to plain text mode 

    Now wherever you click on the curve it will plot it.

  2. The following user says thank you to sonulohani for this useful post:

    rawfool (8th June 2012)

Similar Threads

  1. Replies: 3
    Last Post: 11th May 2011, 18:57
  2. Get mouse position on click?
    By N3wb in forum Qt Programming
    Replies: 2
    Last Post: 21st August 2010, 23:33
  3. how to get the position of mouse click on a label
    By qt_user in forum Qt Programming
    Replies: 1
    Last Post: 9th August 2010, 09:14
  4. Replies: 1
    Last Post: 10th July 2009, 09:54
  5. Word at mouse click position in QGraphicsTextItem
    By pherthyl in forum Qt Programming
    Replies: 2
    Last Post: 3rd November 2008, 04:56

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.