[Qt-interest] weird QTableItem behavior

Malyushytsky, Alex alex at wai.com
Sat Sep 12 03:43:30 CEST 2009


There is nothing wrong in deleting QTreeWidgetItem*

delete item; // is perfectly legal and imo the normal way to do it

You don't have to use takeItem().
Item has a reference to the treeWidget and everything required will be done automatically.

Regards,

   Alex



-----Original Message-----
From: qt-interest-bounces at trolltech.com [mailto:qt-interest-bounces at trolltech.com] On Behalf Of R. Reucher
Sent: Friday, September 11, 2009 6:56 AM
To: qt-interest at trolltech.com
Subject: Re: [Qt-interest] weird QTableItem behavior

On Fri, 11 Sep 2009 16:36:47 +0300, Andrei Sebastian Cimpean wrote:
> QList<QTreeWidgetItem* >items = m_ui->treeWidget->findItems("/",
> Qt::MatchRecursive | Qt::MatchExactly,0); QList<QTreeWidgetItem*
> >selectedShit = m_ui->treeWidget->selectedItems();
> selectedShit[0]->setSelected(false);
> delete selectedShit[0];
^^^ I'm really not sure I can follow on what you want to do, but THIS
isn't a good idea. If you really want to remove the first selected item,
use takeItem() first, then delete it.

HTH, René
--
René Reucher
rene.reucher at batcom-it.net
http://www.batcom-it.net/

Love your enemies: they'll go crazy trying to figure out what you're up
to.
_______________________________________________
Qt-interest mailing list
Qt-interest at trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-interest


---------------------------------------------------------------------------------------------------
Weidlinger Associates, Inc. made the following annotations.

“This message and any attachments are solely for the intended recipient and may contain confidential or privileged information. If you are not the intended recipient, any disclosure, copying, use, or distribution of the information included in this message and any attachments is prohibited. If you have received this communication in error, please notify us by reply e-mail and immediately and permanently delete this message and any attachments. Thank you.”

“Please consider our environment before printing this email.”




More information about the Qt-interest-old mailing list