[ fromfile: qobject-lifecycle.xml id: qobject-lifecycle ]
This section describes a few best practices for managing the QObject lifecycle.
No static QObject s |
|
---|---|
It is important to ensure that every QObject you
construct is created after the QApplication,
and destroyed before the QApplication
is destroyed. Objects created in |
Stack or Heap? | |
---|---|
In general, a QObject
without a parent should be created on the stack or defined as an subobject of another class.
A QObject with
a parent should not be on the stack
because then it might get deleted twice accidentally.
All |
deleteLater() | |
---|---|
It is not recommended to This is actually required from slots where you may wish to delete the |
Generated: 2012-03-02 | © 2012 Alan Ezust and Paul Ezust. |