Results 1 to 4 of 4

Thread: How to delete QMap ?

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jul 2013
    Posts
    72
    Thanks
    1
    Qt products
    Qt5
    Platforms
    Unix/X11

    Default How to delete QMap ?

    I have a container like QMap<float, QList<QPair<float,float> *> *> *data, but I can't delete it.
    How to solve this problem?

    My code :

    {
    QMapIterator<float, QList<QPair<float,float> *> *> iterator(*data);
    while(iterator.hasNext()) {
    iterator.next();
    QList<QPair<float,float> *> *timeValues = iterator.value();
    qDeleteAll(*timeValues);
    timeValues->clear();
    }
    qDeleteAll(*data);
    data->clear();
    delete data;
    data = NULL;
    }

    but it doesn't work, at least the memory is not given back to OS immediately.
    Last edited by lwz; 28th September 2014 at 10:23.

Similar Threads

  1. Proper way to delete a QMap
    By jano_alex_es in forum Newbie
    Replies: 4
    Last Post: 28th February 2020, 17:31
  2. Delete item from QMap<int, QString> with shift
    By Usernаme in forum Newbie
    Replies: 1
    Last Post: 24th May 2010, 18:50
  3. QMap
    By sophister in forum Qt Programming
    Replies: 5
    Last Post: 25th May 2009, 10:05
  4. Replies: 4
    Last Post: 19th February 2009, 11:10
  5. How to use QMap::remove() to delete some item?
    By jedychen in forum Qt Programming
    Replies: 5
    Last Post: 18th September 2008, 07:29

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.