Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

QPainterPath will not add a null element



  • AFAIK it is undocumented that appending a null element, for example a lineTo(the current end point of the path), doesn't actually add anything to a QPainterPath.

    @
    path = QPainterPath(QPointF(0,0))
    path.lineTo(QPointF(1,1))
    previousCount = path.elementCount()
    path.lineTo(QPointF(1,1))
    assert path.elementCount() > previousCount@

    The assertion fails. I can understand the reason for it, but it did catch me by surprise.


Log in to reply