[Qt-interest] Removing the QListWidget Item

Malyushytsky, Alex alex at wai.com
Mon Jul 27 20:21:14 CEST 2009


Yuvaraj,

It is not clear what you want to do.

If you need to delete item, just delete it:
"delete item;"

takeItem should be used only, if you want to use it after it was removed and you are responsible to delete it later anyway or you will get a memory leak.


Regards,
     Alex

From: qt-interest-bounces at trolltech.com [mailto:qt-interest-bounces at trolltech.com] On Behalf Of Yuvaraj R
Sent: Monday, July 27, 2009 5:45 AM
To: qt-interest
Subject: Re: [Qt-interest] Removing the QListWidget Item

Hi All


  I ma used the takeItem instead of removeItem widget.. It is working..


Thanks

Yuvaraj R
On Mon, Jul 27, 2009 at 5:39 PM, Yuvaraj R <yuvaraj at ongobiz.com> wrote:
Hi All

 I am facing problem with removing item from QListWidget.

I am trying with

for(int i=0; i< m_ui->listWidget->count();i++)
{
qDebug() << "dropping ";
if(user == m_ui->listWidget->item(i)->text())
{
QListWidgetItem *item = m_ui->listWidget->item(i);
qDebug() << item->text();
qDebug() << "drop";
m_ui->listWidget->removeItemWidget(item);
qDebug() << "Removed";
return;
}

 i don't get any errors..

Please help me to solve this issue


Thanks


Yuvaraj R



---------------------------------------------------------------------------------------------------
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