Reputation: 14052
I have a QGraphicsScene
for drawing, where I now want to "add" a QWidget
to a QGraphicsItem
(display on top of the item, which can of course be moved).
How could this be accomplished? Is there any QGraphicsItem
, which may function as a Widget container?
Upvotes: 4
Views: 5154
Reputation: 32635
You can use QGraphicsScene::addWidget
which creates a new QGraphicsProxyWidget
for widget, adds it to the scene, and returns a pointer to the proxy :
QGraphicsProxyWidget * item = myScene->addWidget(myWidget);
item->setParentItem(anOtherItem);
item->setPos(100,100);
item->setZValue(1);
Upvotes: 5