[Interest] qqmlcomponent loaded synchronously when it should be loaded asynchronously

Morgan McKenzie speedin_up at hotmail.com
Thu Aug 30 22:57:24 CEST 2012

I've been making a bit of a program built in QT, using C++ and qtquick. I've been working in QT5 (built from git).
The issue I'm having is that I'm trying to load a few qml files from the C++ end (the qml files are in a resource), and I've tried to make it happen asynchronously - I've followed the documentation as closely as I can. However, it is still loading synchronously. 
This is what happens in the system:
- create the main QQuickCanvas - make a new QQmlComponent(engine, "qrc:/path/to/file",QQmlComponent::Asynchronous, parent)- wait for it to be loaded using a signal.- (when loaded) make a context object: context = new QQmlContext(engine, parent)- make an incubator (actually a subclass of QQMlIncubator with signal for loading done...): incubator =  new QQmlIncubator(QQmlIncubator::Asynchronous)- qmlComponent->create(*incubator, context, 0);- when creating is done (signal from incubator), assign reparent the qquickitem to the qquickcanvas's root.

When it gets to the qmlComponent->create, the window freezes for a couple seconds while loading (the qml file is fairly large and includes a 3d resource that is loaded - could this also be the cause and if so is it possible to set a resource to load asynchronously??)

The reason I can tell it is freezing is that I have loaded a qml file with particles that move, and after 15 seconds try to load the qml file with the 3d asset, and the particles all freeze for a few seconds before working again.

If you need full source code I could write up an example to show this but I'm hoping there's an easy answer I've missed!

Morgan McKenzie

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20120830/d19f25af/attachment.html>

More information about the Interest mailing list