I want to make something like a hud. I have a QGraphicsScene
with a huge QPixmap
, that I added to a much smaller QGraphicsView
. Now I need to add some control elements, like QLabel
, QPushButton
and QGraphicsEllipseItem
. That's, I think, is not a problem. I found this helpful page Graphics View Classes. But how do I anchor this control elements to the View or maybe better said how do I not anchor them? When I drag the QPixmap
, then I don't want that the hud is moving with the QPixmap
out of the QGraphicsView
.
What do I need to do, to solve this problem. Hope someone can help me.
Asked
Active
Viewed 2,307 times
2

Mark Chackerian
- 21,866
- 6
- 108
- 99

user427305
- 131
- 1
- 6
- 12
1 Answers
4
You should just have to create your widgets and specify the QGraphicsView
in the constructor like this:
QPushButton *button1 = new QPushButton(view);

Arnold Spence
- 21,942
- 7
- 74
- 67
-
This doesn't work for `QGraphicsEllipseItem`, or any other non-widget graphics item. – Yakov Galka Feb 02 '15 at 19:46