Results 1 to 2 of 2

Thread: Removing child item from QGRaphicsItem

  1. #1
    Join Date
    Jan 2011
    Posts
    5
    Thanks
    1
    Qt products
    Qt3 Qt4 Qt/Embedded Qt Jambi PyQt3 PyQt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Removing child item from QGRaphicsItem

    Hi,
    I have added few QGraphicsItems to a parent QGraphicsItem.Then I need to remove some child items from the parent QGraphicsItem. But there seems to be no function to remove child QGraphicsItems. QGraphicsScene provides functions(addItem and removeItem). Is there any way to remove child QGraphicsItems from the parent QGraphicsItem.

    Thanks,
    Mangesh

  2. #2
    Join Date
    Sep 2009
    Location
    Wroclaw, Poland
    Posts
    1,394
    Thanked 342 Times in 324 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: Removing child item from QGRaphicsItem

    Try
    Qt Code:
    1. childToRemove->setParentItem(NULL);
    To copy to clipboard, switch view to plain text mode 

    This will also add the "childToRemove" object to the parent's scene, if you want you must remove it from this scene yourself.

  3. The following user says thank you to stampede for this useful post:

    mangeshj (17th January 2011)

Similar Threads

  1. Replies: 7
    Last Post: 29th November 2010, 19:20
  2. removing an item from a treeWidget
    By user in forum Qt Programming
    Replies: 0
    Last Post: 13th November 2008, 01:19
  3. Casting QGraphicsItem child from QGraphicsItem
    By patrik08 in forum Qt Programming
    Replies: 3
    Last Post: 29th August 2008, 15:37
  4. removing child widget
    By db in forum Newbie
    Replies: 1
    Last Post: 16th August 2007, 12:19
  5. Replies: 9
    Last Post: 9th May 2006, 19:53

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.