Solved How to get a stroked path of a QPainterPath with just one line?
-
I am trying to get a stroked path 10 pixels around a
QPainterPath
with nothing but a single vertical line in it. But the bounding rect of the stroked path still has a width of zero. For example:def test_strokedPath(): path = QPainterPath() path.moveTo(0, 0) path.lineTo(0, 100) stroker = QPainterPathStroker() stroker.setWidth(10) sPath = stroker.createStroke(path) print(path.boundingRect())
outputs:
PyQt5.QtCore.QRectF(0.0, 0.0, 0.0, 100.0)
It seems the stroked path should have a width of 10. How can I do this?
-
Hi,
Isn't sPath you should use for that bounding rect retrieval ?
-
Hi,
Isn't sPath you should use for that bounding rect retrieval ?
-
@SGaist Yes it is, it it works there. Funny enough, it was yet another bug in my code that cause led a zero-width shape.