Load QML window asynchronous
-
wrote on 20 Jan 2017, 13:26 last edited by
Hi all
Since loading of my QML app take some time I would to show a splashscreen with an animation just for show the app is alive. The problem is loading of QML from C++ side lock the main message cycle and doesn't allow to update the animation into splashscreen. I tried to set QML object loading using QQmlComponent::Asynchronous param but the next call to create object is still blocking:
QQmlEngine QmlEngine; QQmlComponent MainComponent(&QmlEngine); MainComponent.loadUrl(QUrl("qrc:/Main.qml"), QQmlComponent::Asynchronous); MainComponent.create(); // <-- this call doesn't return until QML window created
Using QQmlIncubator and QQmlIncubationController doesn't help and the QML loading return errors (I suspect the problem came from the large quantity of QML compinent and resource to load).
I still didn't find a way to make asynchronous all the steps of QML loading and creation. Also making the splahscreen using QML and loading the main app window using Loader with asynchronous flag set to true show the same problem, all locks for some seconds before show the main app window (animation too).
Someone can suggest an alterative way for this issue?
Thank you -
wrote on 22 Jan 2017, 09:30 last edited by
Nobody have suggestion? I have to suppose is currently impossible with current implementation of QML to get such result...
-
@Suppaman First why does QML takes so much time to load ?
Can you lazy load some of the non essential items ? -
wrote on 22 Jan 2017, 22:20 last edited by
Yes, I could but this is not what I asked for. I'm looking for a way to make anitmated splahscreen since it would be an useful feature for my app. I'm very close to the solution, QML code optimization will come later. My app load a lot of svg images and this take time, all the images have to be ready to show when user start to use the app.
-
wrote on 23 Jan 2017, 12:47 last edited by
If someother is interested in same topic here there is a working solution:
http://falsinsoft.blogspot.com/2017/01/qml-show-animated-splash-screen-at.html
1/5