[Qt-interest] QFormLayout memory leak??
Tony Thompson
Tony.Thompson at stone-ware.com
Wed Nov 18 04:36:15 CET 2009
Sorry, I wasn't trying to be rude. I duplicated my issue by creating a new project that has just one main window. I used the designer and added a form layout object and two push buttons to the main window. The two push buttons I hooked to slots. Here is the code for the slots:
void MainWindow::on_pushButton_clicked()
{
QFormLayout *form = ui->formLayout;
for( int i=0; i<4; i++ ) {
QLineEdit *editor = new QLineEdit();
QString label( "Test:" );
form->addRow( new QLabel( label ), editor );
}
}
void MainWindow::on_pushButton_2_clicked()
{
QFormLayout *form = ui->formLayout;
QLayoutItem *child;
while( (form->count() > 0) && ((child = form->takeAt( 0 )) != 0) ) {
delete child;
}
}
I click the first button which adds the elements and the second removes them but they are not removed from the UI. If I click the first button again, the labels appear to change to bold and become more bold as you click the add and delete buttons.
Thanks for the help.
Tony
-----Original Message-----
From: qt-interest-bounces at trolltech.com [mailto:qt-interest-bounces at trolltech.com] On Behalf Of Andre Somers
Sent: Tuesday, November 17, 2009 3:49 AM
To: Qt-interest
Subject: Re: [Qt-interest] QFormLayout memory leak??
Tony Thompson wrote:
> I delete them as the example shows but they are not removed from the screen.
>
>
Show us your code then, because claiming there is a bug in Qt without some evidence is rude at best. There are a *lot* of users that use Qt and QFormLayout without having your problem, and while it is possible that you have triggered a bug nobody else has triggered or just spotted it where nobody else did, that is unlikely. The likely cause is in your code, so let's start the analysis there.
André
_______________________________________________
Qt-interest mailing list
Qt-interest at trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-interest
This message (and any associated files) is intended only for the
use of the individual or entity to which it is addressed and may
contain information that is confidential, subject to copyright or
constitutes a trade secret. If you are not the intended recipient
you are hereby notified that any dissemination, copying or
distribution of this message, or files associated with this message,
is strictly prohibited. If you have received this message in error,
please notify us immediately by replying to the message and deleting
it from your computer. Messages sent to and from Stoneware, Inc.
may be monitored.
More information about the Qt-interest-old
mailing list