Important: Please read the Qt Code of Conduct -

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

  • 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*
    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);
    return true;    

Log in to reply