How to remove an item from a complex listwidget?
-
i use a embeded comlex QListwidget, which use the API setItemWidget when add the item.
but when i delete, is this right?
@QListWidgetItem* p = this->item(index);
this->removeItemWidget(p);
this->takeItem(index);@ -
If you just want to remove the item form the list, this is enough:
@
QListWidgetItem* p = list->takeItem(index);
@
Item widget will be deleted for you here. You need to delete the item manually.If you want to completely delete the item and its widget this is enough:
@
delete list->takeItem(index);
@