View Full Version : Add two QGraphicsItemGroup
ashishsaryar
5th February 2008, 13:56
hi to all,
I have a problem ....
How to add two QGraphicsItemGroup .
Thanks
jpn
5th February 2008, 14:50
What do you mean? How to add two QGraphicsItemGroup what?
Bitto
5th February 2008, 18:00
Add, as in A + B = {A, B} probably. :-)
There are two approaches. Either you just add both QGraphicsItemGroup items to a new group, or move all children of one group to the other, then delete the empty group. So:
QList<QGraphicsItem *> groups;
groups << group1;
groups << group2;
// Add both groups to one parent group
QGraphicsItemGroup *twoGroups = scene->createItemGroup(groups);
...or:
foreach (QGraphicsItem *child, group1->childItems())
group2->addToGroup(child);
delete group1;
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.