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:

Qt Code:
  1. QList<QGraphicsItem *> groups;
  2. groups << group1;
  3. groups << group2;
  4. // Add both groups to one parent group
  5. QGraphicsItemGroup *twoGroups = scene->createItemGroup(groups);
To copy to clipboard, switch view to plain text mode 

...or:

Qt Code:
  1. foreach (QGraphicsItem *child, group1->childItems())
  2. group2->addToGroup(child);
  3. delete group1;
To copy to clipboard, switch view to plain text mode