Results 1 to 12 of 12

Thread: How to pick line of QwtPlotMarker using QwtPlotPicker without affecting zooming

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #2
    Join Date
    Jun 2015
    Posts
    109
    Thanks
    20
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows

    Default Re: How to pick line of QwtPlotMarker using QwtPlotPicker without affecting zooming

    I have added event filter which identify the wheel up/down and based on that I have manage to increase the 5 using setting variable m_pickPoint in the event and it work for normal condition.
    Qt Code:
    1. if (sqrt( pow( (m_mark->xValue() - pos.x()), 2 )) <= m_pickPoint || sqrt( pow( (m_mark->yValue() - pos.y()), 2 )) <=m_pickPoint )
    To copy to clipboard, switch view to plain text mode 

    So here I'm unable to understand at what factor I should increase or decrease the value m_pickPoint, so that the above logic work properly and pick the exact line.
    Qt Code:
    1. case QEvent::Wheel:
    2. QWheelEvent* we = static_cast<QWheelEvent*>(e);
    3. if(we->angleDelta().y()>0)
    4. {
    5. m_pickPoint = m_pickPoint + m_pickPoint*0.05;
    6. qDebug()<<"Position"<<m_pickPoint;
    7. }
    8. else
    9. {
    10. m_pickPoint = m_pickPoint - m_pickPoint*0.05;
    11. qDebug()<<"Negative"<<m_pickPoint;
    12. }
    To copy to clipboard, switch view to plain text mode 

    Please provide your solution, where as this above solution looks kind of dirty, so if their is some elegant solution then please suggest.
    Last edited by npatil15; 8th January 2019 at 11:32.

Similar Threads

  1. Replies: 2
    Last Post: 4th January 2019, 11:14
  2. Replies: 2
    Last Post: 20th July 2015, 06:14
  3. Replies: 2
    Last Post: 26th July 2013, 14:25
  4. QwtPlotMarker QwtPlotPicker
    By bss in forum Qwt
    Replies: 1
    Last Post: 15th June 2011, 12:55

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