Why code doesnt work?
-
Why this code doesnt work?
@ for(int a=0;a<=listWidget->count();++a)
listWidget->removeItemWidget(listWidget->item(a));@
There are no errors, item just donr removes -
Why don't you just use the clear function to remove all the items?
-
Thank you, i just dont see it
-
In addition, your loop should probably terminate at "a < listWidget.count()", not "a <= listWidget.count()".
-
The code cannot work, as you remov items from the beginning. After processing half of the items your counter exceeds the count of the remaining items. Call remove on item(0), then the code should work.
clear() is the more elegant solution, though :-)