Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Delete a element from QList
Forum Updated to NodeBB v4.3 + New Features

Delete a element from QList

Scheduled Pinned Locked Moved General and Desktop
1 Posts 1 Posters 1.3k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • O Offline
    O Offline
    opengpu
    wrote on 18 Nov 2014, 09:07 last edited by
    #1

    i write like this:
    @
    for(QList<A*>::iterator it = listA.begin(); it != listA.end(); ++it)
    {
    A* a = *it;
    if(a)
    {
    if (a->shouldDelete())
    {
    listA.removeAll(a); //removeOne & erase are alsoo tried, but crash the same.....
    delete a;
    a = NULL;
    }
    else
    a->func(); //crashed here!!!
    }
    }
    @
    what is the error i made?
    thank you

    1 Reply Last reply
    0

    1/1

    18 Nov 2014, 09:07

    • Login

    • Login or register to search.
    1 out of 1
    • First post
      1/1
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved