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

Eduardo Fleury eduardo.fleury at openbossa.org
Sat Apr 17 00:08:58 CEST 2010


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/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt.nokia.com/pipermail/qt-qml/attachments/20100416/29d346a9/attachment.html 


More information about the Qt-qml mailing list