Qt World Summit: Submit your Presentation

[Solved] QPainterPath: add (open) polyline

  • I feel a little stupid asking the obvious, but I just can't find the method to add an (open) polyline to a QPainterPath.


  • You can use a QPolygonF. It does not have to be closed.

    The questions is what you do with the QPainterPath afterwards that might auto-close any polygon to do what is thinks it has to do.

  • Thank you. That's a good question.

    I was assuming from the name "addPolygon" that this closed the path. However, I was calling path.united(otherPath) after that, and there the docs say that any open subpath is closed.

    Now, I use addPath instead, and have the desired outcome.

Log in to reply