qt-interest@trolltech.com
[Top] [All Lists]

Re: new and delete question

Subject: Re: new and delete question
From: Kamil Klimek
Date: Thu, 20 Sep 2007 10:47:25 +0200

On Sep 20, 2007, at 10:41 AM, matteo wrote:

I see in Qt documentation examples where there are new of qt objects but not delete.
Is it correct?
Why?

In Qt if you specify parent for QObject, then it's automaticly destroyed when parent is destroyed. So if you have only one main window, and inside of it you will create bunch of "new" widgets with parent set to your main window, then with example:

int main(int argc, char *argv[])
{
        QApplication app(argc, argv);

        MyMainWindow window;
        window.show();

        return app.exec();
}

all children of window will be deleted automaticly when your application quits.

--
To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx with 
"unsubscribe" in the subject or the body.
List archive and information: http://lists.trolltech.com/qt-interest/

<Prev in Thread] Current Thread [Next in Thread>