Hi, Does the Connections element have a Component.onDestruction of its own, which gets hooked in this case?
- Timo On 11/22/11 7:53 AM, "pekka.e.jok...@nokia.com" <pekka.e.jok...@nokia.com> wrote: >Anyone? So the get-Me-Item function returns any QObject derivates. > >-----Original Message----- >From: qt-qml-bounces+pekka.e.jokela=nokia....@qt.nokia.com >[mailto:qt-qml-bounces+pekka.e.jokela=nokia....@qt.nokia.com] On Behalf >Of Jokela Pekka.E (Nokia-MP-Qt/Tampere) >Sent: 16 November, 2011 13:34 >To: Kennedy Aaron (Nokia-DES-Qt/Brisbane) >Cc: qt-qml@qt.nokia.com >Subject: Re: [Qt-qml] how to connect to destroyed signal in QML/javascrit? > >Hi, >can you be a bit more specific? > >I've tried it as: > >var someItem = getMeItem() >connectionsElement.target = someItem >someItem.destroy() > > >With helper functions/QML: > function getMeItem() { > // dummy > return Qt.createQmlObject('import QtQuick 2.0; Rectangle >{ Component.onDestruction: console.log(\"XXX ~Rectangle. this I cannot >access") }', root) > } > > Connections { > id: connectionsElement > target: null > Component.onDestruction: someItemDeleted() > } > > function someItemDeleted() { > console.log("XXX someItem deleted. This I want get called >") > } > >The ~Rectangle gets called but not someItemDeleted function. > > -P >________________________________________ >From: Kennedy Aaron (Nokia-DES-Qt/Brisbane) >Sent: Wednesday, November 16, 2011 12:03 PM >To: Jokela Pekka.E (Nokia-MP-Qt/Tampere) >Cc: <qt-qml@qt.nokia.com> >Subject: Re: [Qt-qml] how to connect to destroyed signal in QML/javascrit? > >Hi, > >Try connecting to the "Component.onDestruction" signal. > >Cheers, > >Aaron > >On 16/11/2011, at 8:46 AM, ext >pekka.e.jok...@nokia.com<mailto:pekka.e.jok...@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@qt.nokia.com<mailto:Qt-qml@qt.nokia.com> >http://lists.qt.nokia.com/mailman/listinfo/qt-qml > >_______________________________________________ >Qt-qml mailing list >Qt-qml@qt.nokia.com >http://lists.qt.nokia.com/mailman/listinfo/qt-qml >_______________________________________________ >Qt-qml mailing list >Qt-qml@qt.nokia.com >http://lists.qt.nokia.com/mailman/listinfo/qt-qml _______________________________________________ Qt-qml mailing list Qt-qml@qt.nokia.com http://lists.qt.nokia.com/mailman/listinfo/qt-qml