View Full Version : qlistvidget
Morea
25th March 2006, 13:32
How do I remove something that I've added with addItem ?
zlatko
25th March 2006, 13:37
Use delete for this item
Morea
25th March 2006, 13:45
You mean like
delete MyListWidget->currentItem();
zlatko
25th March 2006, 13:50
Yesssssssssssss :)
Morea
25th March 2006, 13:52
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.
Morea
27th March 2006, 00:23
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?
wysota
27th March 2006, 01:49
No problem. At least according to the standard.
vBulletin® v3.7.1, Copyright ©2000-2008, Jelsoft Enterprises Ltd.