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;
As far as I understand the Qt documentation and by my Qt 4&5 experience, both should be correct, however your last delete
should be the Pointer you get returned by takeItem
so delete pItem
instead of delete item
in your second snippet.