[SOLVED]will clear also delete all the QTreeWidgetItem/QListWidgetItem?
-
Yes. The items will be deleted by
clear()
as stated in the docs.QTreeWidget has takeTopLevelItem and each item has takeChild / takeChildren.
QListWidget has takeItem and it's a flat structure. List items don't have children so there's nothing there to take. -
while(auto item = listWidget->takeItem(0)) { //do something with item }