[Qt-qml] Removal of the Script element
alan.alpert at nokia.com
alan.alpert at nokia.com
Tue Mar 30 07:33:33 CEST 2010
>From: qt-qml-bounces at trolltech.com [qt-qml-bounces at trolltech.com] On Behalf Of Malmqvist Mathias
>(Nokia-SU/London)
>Sent: Tuesday, March 30, 2010 6:31 AM
>To: Kennedy Aaron (Nokia-D-Qt/Brisbane); qt-qml at trolltech.com
>Subject: Re: [Qt-qml] Removal of the Script element
>
>> If you want a *true* singleton (a single copy for the entire application)
>> you're in luck. If the JS file starts with ".pragma library" QML will
>> import it as a singleton.
>
>Brilliant! Just want I need. Thanks! :)
>
>A related question though:
>
>I'm using the Component.onComplete() signal to add QML elements to
>my JS singleton array when they are created, but I can't see any way of
>removing them when they are about to be deallocated. I'm using the
>ListView's delayRemove attached property to prevent the delegate items
>from being deleted, but it would be better if there was something like a
>Component.onDestruction() signal.
On the Item element there is an onDestroyed signal. And this is called just before oblivion so you can
just connect to that on your root item (even though it's the one being destroyed).
>
>Is there something I can use already, or should I raise it as a "defect"?
>
There is a 'suggestion' category in JIRA, in case the above method is inadequate for your use case.
--
Alan Alpert
More information about the Qt-qml
mailing list