How do I remove something that I've added with addItem ?
How do I remove something that I've added with addItem ?
Use delete for this item
a life without programming is like an empty bottle
You mean like
delete MyListWidget->currentItem();
Yesssssssssssss
a life without programming is like an empty bottle
Well I'll be damned, it worked. The Qt people has really been doing a great work :-)
Much shorter than
QListWidgetItem* p=ui.lista->takeItem(ui.lista->currentRow());
delete p;
that I first used.
But what happens if
MyListWidget->currentItem();
returns 0 when there is no items or no currentItem?
Is running delete on a 0 pointer no problem?
No problem. At least according to the standard.
Bookmarks