PDA

View Full Version : qlistvidget



Morea
25th March 2006, 12:32
How do I remove something that I've added with addItem ?

zlatko
25th March 2006, 12:37
Use delete for this item

Morea
25th March 2006, 12:45
You mean like

delete MyListWidget->currentItem();

zlatko
25th March 2006, 12:50
Yesssssssssssss :)

Morea
25th March 2006, 12: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
26th March 2006, 23: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, 00:49
No problem. At least according to the standard.