Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. 3rd Party Software
  4. how to drag and drop of a QwtPlotCurve inside the QwtPlotCanvas?
QtWS25 Last Chance

how to drag and drop of a QwtPlotCurve inside the QwtPlotCanvas?

Scheduled Pinned Locked Moved Unsolved 3rd Party Software
qwt
1 Posts 1 Posters 738 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    T Offline
    thippu
    wrote on last edited by thippu
    #1

    Hi @uwer,
    I want a user to change the position of QwtPlotCurve on QwtPlotCanvas (like drag and drop on the canvas)
    So, I did refer the ItemEditor example of the Qwt lib.
    How do I convert these lines for QwtPlotCurve instead QwtPlotShapeItem?
    In the

    bool Editor::moved(const QPointF& pos)
    {
    //you can assume above this code is  same as the example code 
    //only part of the code which is not understood by me, I'm asking here
    //I don't know to how to convert following codes according to QwtPlotCurve instead of QwtPlotShapeItem, please help me
    
    #if QT_VERSION>=0x040600
    const QPainterPath shape=d_editedItem->shape().translated(p2-p1);// I have declared d_editedItem as QwtPlotCurve* instead of QwtPlotShapeItem*
    #else
    const double dx=p2.x()-p1.x();
    const double dy=p2.y()-p1.y();
    QPainterPath shape=d_editedItem->shape();
    for(int i=0;i<shape.elementCount();i++)
    {
     const QPainterPath::Element &el=shape.elementAt(i);
     shape.setElementPositionAt(i,el.x+dx,el.y+dy);
    }
    #endif
    d_editedItem->setShape(shape);
    d_currentPos=pos;
    return true;    
    
    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved