View Full Version : QGraphicsWidget Position Promble

25th February 2011, 10:49
Hi, everyone,

I want to implement a custom QGraphicsLayout that works in the following manner.The item added to the custom layout can be position absolutely by call setpos() function. I don't want to use QGraphicsAnchorLayout, QGraphicsGridLayout, and QGraphicsLinearLayout, because when the item was added to the common layout, setpos() function not work.

Or Is there method after the item was added to the common layout , i still can move the item's anywhere within the parent coordinate?

QGraphicsLinearLayout *layout = new QGraphicsLinearLayout;

proxyForName["helpBtn"]->setPos(100,100); -> not work

27th February 2011, 09:40
If the item is in a layout then you can't change its position because it would break the layout.

28th February 2011, 17:43
Is any other way i can work around? I want to put a QGraphicsWidget into the other QGraphicsWidget, the fronter widget locate above the later, so i want to know is any method position the fronter one absolutly within the later widget's coordinate, other than binding to layout.

28th February 2011, 20:51
Is any other way i can work around?
You can just not use layouts.

4th March 2011, 06:53
If i just not use layout, how can i put QGraphicsWidget into another QGraphicsWidget, QGraphicsWidget doesn't supports the api, but addLayout() api is available.

4th March 2011, 09:18
give a parent during construction or use QGraphicsItem::setParentItem.