Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Call for Presentations - Qt World Summit

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

    3rd Party Software
    qwt
    1
    1
    577
    Loading More Posts
    • 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
      thippu last edited by thippu

      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 Reply Quote 0
      • First post
        Last post