Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Delete a element from QList

    General and Desktop
    1
    1
    1187
    Loading More Posts
    • 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
      opengpu last edited by

      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 Reply Quote 0
      • First post
        Last post