Upgrade QGraphicsTextItem (and friends) to QGraphicsWidget?
General and Desktop
3
Posts
2
Posters
1.7k
Views
1
Watching
-
I'd like to use some of the ready-to-use QGraphicsItem classes, like QGraphicsTextItem, QGraphicsPixmapItem,...
However, I want to use layouts, so I need QGraphicsWidgets.
The only way I could come up with would be to create a class that derives from QObject, QGraphicsTextItem (or another) and QGraphicsLayoutItem, and then implement those methods that are implemented in QGraphicsObject or QGraphicsWidget, and missing in QGraphicsTextItem.
Sounds a bit tricky. Any better idea?
-
My best idea right now is to use a composition: A QGraphicsWidget containing the item I want. The tricky part is that one essential change notification (boundingRect changes) is missing, which makes things kinda awkward.