Hi,

I hope something like this will work:

Qt Code:
  1. bool bDeletion = true;
  2. while (bDeletion)
  3. {
  4. //Search element to delete. We have to get the number of elements every start of searching
  5. int i=0;
  6. bool bFound = false;
  7. int iNumElements = m_qListWidget.count();
  8. while (!bFound && (i<iNumElements))
  9. {
  10. if (m_qListWidget.at(i)->elementHasToBeDeleted()) //Implement your method
  11. bFound = true; // "i" points to element to delete
  12. else
  13. i++; //Jump to next element
  14. }
  15.  
  16. //If we have found one element to delete, just delete it
  17. if (bFound)
  18. delete m_qListWidget.takeAt(i);
  19. //If we have not found any element to delete just exit the loop (job finished)
  20. else
  21. bDeletion = false;
  22. }
To copy to clipboard, switch view to plain text mode 

As I supose that no many items are there on the list, the search of an item to be deleted starts every time from item 0. You could save the deletion position and start the search againg from this value but you have to get the number of items again and check that it is not out of bounds.