How delete item and itemWidget correctly from QListWidget

  c++, qlistwidget, qlistwidgetitem, qt

i dont understand how correctly delete item and itemWidget from QListWidget.
I should at first delete itemWidget, then item

lstWgt->removeItemWidget(item);
delete item;

Or i can

auto *pItem = lstWgt->takeItem(2);
delete item;

Source: Windows Questions C++

LEAVE A COMMENT