Results 1 to 2 of 2

Thread: QList with pointers item

  1. #1
    Join Date
    Oct 2009
    Posts
    70

    Default QList with pointers item

    I've a QList with pointers:

    QList <MyClass *> list;

    I've a worker thread that pass to the MainWindow a list with signal and slot mechanism.

    When the slot on the MainWindow is finished, the list is removed on the stack.

    My question is:

    when the list is removed from the stack...or If I try list.clear() are the pointers deallocate or they are only disconnected from the list?!

    If they are deallocated...how can I only disconnect the pointer from the list?!

    Thanks

  2. #2
    Join Date
    Aug 2008
    Location
    Ukraine, Krivoy Rog
    Posts
    1,963
    Thanked 370 Times in 336 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: QList with pointers item

    no, you should destruct pointers by yourself. take a look at qDeleteAll in docs.
    Qt Assistant -- rocks!
    please, use tags [CODE] & [/CODE].

Similar Threads

  1. Sorting using qSort(), - if QList contains POINTERS
    By joseph in forum Qt Programming
    Replies: 13
    Last Post: 18th August 2013, 18:55
  2. QList with pointers
    By Rockem in forum Qt Programming
    Replies: 9
    Last Post: 12th August 2009, 18:53
  3. QList Pointers
    By coderbob in forum Newbie
    Replies: 2
    Last Post: 20th November 2007, 18:50
  4. BEst way to search QList for item
    By steg90 in forum Qt Programming
    Replies: 11
    Last Post: 18th July 2007, 09:41
  5. QList of pointers
    By Farcaller in forum Newbie
    Replies: 4
    Last Post: 24th January 2006, 16:48

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.