PDA

View Full Version : QGraphicsWidget - How does it work?



been_1990
31st July 2009, 12:03
I've been reading the Docs and searching for examples on QGraphicsWidget. I've been doing my project with QGraphicsItem, but now I found out only QGraphicsWidget has a layout. Now I want to use all the QGraphicsWidget functionality.
But I really cant understand how it works. Do I add a QGraphicsItem to it, or can I directly add a QPixmap?
It says
QGraphicsWidget::QGraphicsWidget ( QGraphicsItem * parent = 0, Qt::WindowFlags wFlags = 0 )
"The optional parent argument is passed to QGraphicsItem's constructor."
What does that mean? That to each QGraphicsItem I have I need to create a new QGraphicsWidget for it? :confused:
Thats it. If anyone can help me "see the light", I am most grateful.:)

yogeshgokul
31st July 2009, 12:12
I've been reading the Docs and searching for examples on QGraphicsWidget. I've been doing my project with QGraphicsItem, but now I found out only QGraphicsWidget has a layout. Now I want to use all the QGraphicsWidget functionality.
But I really cant understand how it works.
This approach is useful for widgets that only serve the purpose of organizing child widgets into a layout. QGraphicsWidget can be used as a base item for your own custom item if you require advanced input focus handling, e.g., tab focus and activation, or layouts.



Do I add a QGraphicsItem to it, or can I directly add a QPixmap?
:confused::confused::confused:

been_1990
31st July 2009, 14:15
Okay, so maybe I got the wrong idea about QGraphicsWidget.

This approach is useful for widgets that only serve the purpose of organizing child widgets into a layout.
So QGraphicsWidget is a "container" for Widgets inside QGraphicsView?
Can I organize QGraphicsItem with QGraphicsWidget?