PDA

View Full Version : How do you embed a widget in a graphics item?



technoViking
9th November 2009, 19:57
Hi guys,

So I was wondering if anyone can point me to a resource that shows me how to embed a Widget into a graphic items.

I'm currently doing animation to the graphics item and want the widget to also see these effects.

Thanks

JohannesMunk
9th November 2009, 21:34
QGraphicsProxyWidget.

You can use the QGraphicsScene's AddWidget function, to get one..

HIH

Joh

technoViking
10th November 2009, 03:31
Hi thanks, I used the add widget function, and that adds the widget in the graphics scene. I then can manipulate the widget with the proxy widget.

But my question is...is this really embedding the Widget into a graphics item? or is it simply putting a widget on the graphic scene?

Can I transform the widget just like a graphics item once its in the scene or do I have to some how combine a graphic item with the widget?

aamer4yu
10th November 2009, 06:17
You can use QGraphicsScene::addWidget to add a widget to a scene.
This returns a QGraphicsProxyWidget * which is inherited from QGraphicsWidget which in turn is inherited from QGraphicsItem.
So you can use it to transform purposes as you do on a graphics item.

technoViking
10th November 2009, 07:09
ah!! thanks so much for the explanation. Makes perfect sense :D