Reputation: 608
I'm drawing a QGraphicsPolygonItem like this:
I need to have the dimensions information on the scene, like this:
I'm using QGraphicsPolygonItem, QGraphicsScene and QGraphicsView.
Upvotes: -1
Views: 329
Reputation: 27611
There are several ways to achieve what is being asked here.
Personally, I'd opt for not using a QGraphicsPolygonItem, but creating a class derived from QGraphicsItem. This class would store a QPolygonF to store the required points. Then you'd overload the following functions:-
In the paint function the class draws the polygon and all the dimensions with it.
Alternatively, you could create separate QGraphicsItem classes for just the dimensions, set their parent as the QGraphicsPolygonItem and then set their positions, but this can get a bit messy.
Upvotes: 1