[Qt-qml] Loader: How to "unset" the sourceComponent ?

Nigel.Hietala at nokia.com Nigel.Hietala at nokia.com
Sat Apr 17 10:40:03 CEST 2010


You set it to "".
e.g. Loader {
      sourceComponent: myCondition ? myComponent : ""
}

Hi there,

I ve a situation where I want to dynamic load a component when it is needed, and then release it for performance reasons.

So, the idea was to use a loader, and change its sourceComponent based on something, but I don t see how I could unset the component.

In other words, I wanted to do something like:

Loader {
      sourceComponent: myCondition ? myComponent : null
}

I know that works with the source property, as it is string-based... but in this case myCondition is an already loaded component, other parts of my code require it to be this way thus I cant simply move that to a component.qml file.

Is there a way to handle that? This also applies to other QObject * properties. There isn t the concept of zero / null / empty for them.

Cheers,
--
Eduardo M. Fleury
OpenBossa - INdT
http://eduardofleury.com/
http://www.openbossa.org/
<ATT00001..txt>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt.nokia.com/pipermail/qt-qml/attachments/20100417/303f6391/attachment.html 


More information about the Qt-qml mailing list