Qt 6.11 is out! See what's new in the release
blog
Reimplement QGraphicsPathItem 's boundingRect() & shape() ?
General and Desktop
4
Posts
1
Posters
1.3k
Views
1
Watching
-
i subclass a QGraphicsPathItem for custom lines and curves, as there are the control points for the curve which is out of the curve itself, and i wannt to dynamically click and move the control points, so i have to reimplement QGraphicsPathItem 's boundingRect() & shape().
Now, (1) shape(): QPainterPath path = QGraphicsPathItem::shape(), then path.addRect() //add all the control points.
(2) boundingRect(): QRectF rect = QGraphicsPathItem::boundingRect(), then rect = rect.united() //add all the control points.
I debugged the shape() method seems work fine, BUT the boundingRect() method NOT RIGHT, after i click and move the controls point to another poisition. is it because the rect.united() i used?
thank you!