[Qt-interest] Dialogs and [X] close button
Scott Aron Bloom
Scott.Bloom at sabgroup.com
Sat Feb 14 18:14:11 CET 2009
It will depend on how you create the dialog.
If you put it on the stack, then the widgets destructor will be called
when it goes out of scope. Assuming you used the correct parent-child
relationships for all widgets (or created proper destructors) as
necessary.
If its on the heap, you will either have to call delete when the pointer
goes out of scope, or make sure the widget has the WA_DeleteOnClose
attribute set.
This is all very well described and documented in the QT documentation.
If you read them, your doubts will be removed.
Scott
From: qt-interest-bounces at trolltech.com
[mailto:qt-interest-bounces at trolltech.com] On Behalf Of Miguel Cardenas
Sent: Saturday, February 14, 2009 8:14 AM
To: qt-interest
Subject: [Qt-interest] Dialogs and [X] close button
Hello list
I have a doubt... when creating dialogs on the fly, for example when you
have a menu Help->About and a QDialog window is created, it shows
something and then you can have a [Close] button or perhaps somebody
clicks on the [X] close window button...
Does the [X] button destroy (delete) the object or just hides it?
I have connected a menu action signal to a slot function that creates a
QDialog and shows it, but how should I close it? do I have to hide the
window or kill it?
I want to kill it so it does not use memory after using it and to avoid
that several calls to Help->About or other menu items that require to
create a dialog build lots of repeated objects if the created dialog is
only hidden after [Close] or [X] button is clicked...
Can an object destroy itself, for example when the user clicks a [Close]
or maybe a [Done] button?
Thanks
--
Miguel Cardenas
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090214/b1e316a1/attachment.html
More information about the Qt-interest-old
mailing list