Hi,

QML now prohibits you from assigning to the ³onDestroyed² property of
objects.  Code like this is now banned:

Item {
    onDestroyed: print(³Goodbye cruel world!²)
}

Those of you familiar with C++ will know that QML inherits this property
because QObject happens to have a destroyed() signal.  This signal only ever
partially worked in QML, so it is best that it is disabled entirely.

If you want to know when your component is about to be destroyed, you can
use the new ³Component.onDestruction² attached property like this:

Item {
    Component.onDestruction: print(³Goodbye cruel world!²)
}

This signal is emitted before the destruction actually begins, so most of
the component and the application¹s state is still valid.

In all real-world cases that I am aware of the two methods are functionally
identical, but there is a subtle semantic difference.  The
³Component.onDestruction² signal is triggered when the component is being
destroyed, not the specific object to which it is applied.  There is no way
in QML to monitor an individual object for destruction ­ although thankfully
there is no need to either :)

The change is making its way through our CI system, and will appear in the
master branch shortly.

Cheers,

Aaron


_______________________________________________
Qt-qml mailing list
Qt-qml@trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-qml

Reply via email to