Zakaria
Zakaria

Reputation: 1735

how to dynamically add a QWidget based to QGraphicsScene?

I want to add a QWidget based class(composed by buttons and labels an so on...) to my QGraphicScene scene in a special position and respecting the graphic style of my scene.?

I am using QT 4.7.

Upvotes: 1

Views: 1020

Answers (1)

Yulia Rogovaya
Yulia Rogovaya

Reputation: 934

You may use QGraphicsScene::addWidget() to add your widget to the scene and use the returned QGraphicsProxyWidget * to reposition your widget with QGraphicsItem::setPos(). Alternatively, you may look into QGraphicsWidget class.

Upvotes: 3

Related Questions