Results 1 to 11 of 11

Thread: QwtPlotPicker::getInvTransform does not map to correct plot coordinates

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jul 2010
    Posts
    21
    Qt products
    Qt4
    Platforms
    Windows

    Default QwtPlotPicker::getInvTransform does not map to correct plot coordinates

    Hello, I am implementing a curve widget in which the user can drag the curve by mouse move operations. The problem is the returned x dimension is not accurate in plot coordinates, there is no problem in the mapped y coordinate. There is always a shift or gap in the x dimension of the selected point(I guess this gap is about the width of the y-Axis ruler), please see the problem and the gap in my image attachment. Also I attach the code below.
    I am using QwtPlotPicker::getInvTransform as,

    Qt Code:
    1. class myCurveWidget : public QwtPlot
    2. {
    3. /////////
    4. }
    5.  
    6. class myCurvePicker : public QwtPlotPicker
    7. {
    8. //////////
    9. }
    10.  
    11. QPointF myCurveWidget::mapMousePoint(QPoint mousePoint)
    12. {
    13. myCurvePicker picker(this->canvas());
    14.  
    15. QPointF mappedPt = picker.getInvTransform(mousePoint);
    16.  
    17. if(mappedPt.x() < 0)
    18. mappedPt.setX(0);
    19. else if(mappedPt.x() > 255)
    20. mappedPt.setX(255);
    21. if(mappedPt.y() < 0)
    22. mappedPt.setY(0);
    23. else if(mappedPt.y() > 255)
    24. mappedPt.setY(255);
    25.  
    26. return mappedPt;
    27. }
    To copy to clipboard, switch view to plain text mode 

    How can I map to exact plot coordinates?
    Attached Images Attached Images

Similar Threads

  1. Replies: 1
    Last Post: 9th August 2010, 20:44
  2. Replies: 4
    Last Post: 18th March 2010, 11:11
  3. Replies: 0
    Last Post: 20th November 2009, 16:30
  4. QwtPlotPicker questions
    By ttvo in forum Qwt
    Replies: 7
    Last Post: 28th February 2009, 10:44
  5. Replies: 4
    Last Post: 25th October 2007, 13:23

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.