Results 1 to 3 of 3

Thread: Add two QGraphicsItemGroup

  1. #1
    Join Date
    Jul 2007
    Location
    Noida
    Posts
    46
    Thanks
    7
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Add two QGraphicsItemGroup

    hi to all,
    I have a problem ....

    How to add two QGraphicsItemGroup .

    Thanks
    Ashish Kumar Saryar

  2. #2
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: Add two QGraphicsItemGroup

    What do you mean? How to add two QGraphicsItemGroup what?
    J-P Nurmi

  3. #3
    Join Date
    Jan 2006
    Location
    Norway
    Posts
    124
    Thanked 38 Times in 30 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Add two QGraphicsItemGroup

    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 
    Bitto / Andreas Aardal Hanssen - andreas dot aardal dot hanssen at nokia
    Nokia Software Manager, Qt Development

Similar Threads

  1. incorrect QGraphicsItemGroup mouse drag behavior
    By Gopala Krishna in forum Qt Programming
    Replies: 1
    Last Post: 25th January 2008, 10:05
  2. QGraphicsItemGroup problem
    By init2null in forum Qt Programming
    Replies: 2
    Last Post: 20th November 2006, 22:45
  3. setZValue of QGraphicsItemGroup
    By forrestfsu in forum Qt Programming
    Replies: 3
    Last Post: 6th November 2006, 19:40
  4. Delete all members in a QGraphicsItemGroup
    By vmferreira in forum Qt Programming
    Replies: 3
    Last Post: 17th August 2006, 18:47

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.