[Qt-qml] how to connect to destroyed signal in QML/javascrit?

aaron.kennedy at nokia.com aaron.kennedy at nokia.com
Wed Nov 16 11:03:59 CET 2011


Hi,

Try connecting to the "Component.onDestruction" signal.

Cheers,

Aaron

On 16/11/2011, at 8:46 AM, ext Pekka.E.Jokela at nokia.com<mailto:Pekka.E.Jokela at nokia.com> wrote:

Hi,
How do I know when item is deleted (destructor called) in QML/JavaScript?

I tried:
Connections {
    target: someItem
    onDestroyed: console.log(“someItem deleted”)
}
==> results: QML Connections: Cannot assign to non-existing property “onDestroyed”

And in JavaScript:
someItem.destroyed.connect(loggingItem, someItemDeletedFunction)
==> results: TypeError: Cannot call method ´connect´of undefined.

Reading the documentation and the code (5.0), the QObject has signal destroyed(). The someItem is defined in cpp and it’s registed to QML (otherwise it works fine). Replacing the code snippets with any other signal works fine.

Any ideas?

Thanks,
-Pekka

P.s I do not control the construction of the item so I cannot override the Component.onCompleted: in the element definition.
_______________________________________________
Qt-qml mailing list
Qt-qml at qt.nokia.com<mailto:Qt-qml at qt.nokia.com>
http://lists.qt.nokia.com/mailman/listinfo/qt-qml

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt.nokia.com/pipermail/qt-qml/attachments/20111116/7f92f901/attachment.html 


More information about the Qt-qml mailing list