Results 1 to 8 of 8

Thread: Clear a Scene

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Mar 2008
    Location
    Morocco
    Posts
    47
    Thanks
    7
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Clear a Scene

    Hi..
    I have a problem to clear a Scene !!
    I used the first methode :

    Qt Code:
    1. void myview::clearScene()
    2. {
    3. QList<QGraphicsItem*> itemsList = scene->items();
    4. QList<QGraphicsItem*>::iterator iter = itemsList.begin();
    5. QList<QGraphicsItem*>::iterator end = itemsList.end();
    6. while(iter != end)
    7. {
    8. QGraphicsItem* item = (*iter);
    9. delete item;
    10. iter++;
    11. }
    12. }
    To copy to clipboard, switch view to plain text mode 
    but it doesnt work !!
    then I used another methode:
    Qt Code:
    1. void myview::clear(){
    2. QList<QGraphicsItem*> itemsList = scene->items();
    3. QGraphicsItemGroup *group=scene->createItemGroup(itemsList);
    4. scene->destroyItemGroup(group);
    5. }
    To copy to clipboard, switch view to plain text mode 
    this that One stucks the application !!

    if someone could help !!
    thanks
    Last edited by jpn; 13th May 2008 at 08:25. Reason: missing [code] tags

Similar Threads

  1. QGraphicsView, QGraphicsItem, QGraphicsScene
    By Shuchi Agrawal in forum Newbie
    Replies: 10
    Last Post: 23rd March 2011, 20:50
  2. Creating new scene from a part of an old one
    By maverick_pol in forum Qt Programming
    Replies: 6
    Last Post: 28th November 2007, 18:14
  3. How to update scene after removing items
    By nileshsince1980 in forum Qt Programming
    Replies: 4
    Last Post: 20th September 2007, 09:56
  4. Creating a scene from piece of another scene
    By maverick_pol in forum Qt Programming
    Replies: 3
    Last Post: 23rd August 2007, 17:51
  5. How to use QGraphicsView and Scene right ...
    By Mike in forum Qt Programming
    Replies: 6
    Last Post: 22nd January 2007, 08:51

Tags for this Thread

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
  •  
Qt is a trademark of The Qt Company.