Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-78674

QGraphicsScene::addPath(QPainterPath(QPointF)) always initiates path at origin

    XMLWordPrintable

Details

    • Bug
    • Resolution: Out of scope
    • P2: Important
    • None
    • 5.12.4
    • Widgets: GraphicsView
    • None
    • Windows

    Description

      I had the following code in my program, where I am trying to make a pen tool similar to adobe illustrator. 

      pathBeingDrawn = mainScene->addPath(QPainterPath(mouseClickPosition));
      

      Here, the classes are

      QGraphicsPathItem *pathBeingDrawn; QGraphicsScene *mainScene; QPointF mouseClickPosition;

      Anyways, any attempt to draw the path results in the pathBeingDrawn initiating at the origin, even if mouseClickPosition is not QPointF(0,0). I know I can easily resolve this in my code with 

      QPainterPath p(); p.moveTo(mouseClickPosition); pathBeingDrawn->setPath(p);
      

      But I only wish to point out the bug here. Ideally, if there's

      QPainterPath(mouseClickPosition);
      

      then I shouldn't have to substitute it with

      QPainterPath p(); p.moveTo(mouseClickPosition); pathBeingDrawn->setPath(p);

      on the graphics scene. 

      If this is not really a bug, let me know. Though I'm not sure I understand the point of the constructor

      QPainterPath(QPointF &startPoint)

      The image attached should give a good example of what I mean.

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            vgt Eirik Aavitsland
            jirauser54228 user-3c5c2 (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes