how to drag and drop of a QwtPlotCurve inside the QwtPlotCanvas?
Unsolved
3rd Party Software
-
Hi @uwer,
I want a user to change the position ofQwtPlotCurve
onQwtPlotCanvas
(like drag and drop on the canvas)
So, I did refer the ItemEditor example of the Qwt lib.
How do I convert these lines forQwtPlotCurve
insteadQwtPlotShapeItem
?
In thebool 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;