Hi. I'm playing around with a project that requires asynchronous loading of QQuickItems. Specifically, each item has some basic visuals, and some Box2D types to construct. The items should be loaded asynchronously as there will be a large amount of them, and they should only be loaded when the view is close by (the items are within a Flickable).
I thought I'd use QQmlIncubator for this. Having never used it before, I went to the detailed description [1] to find an example: QQmlIncubator incubator; component->create(incubator); while (incubator.isReady()) { QCoreApplication::processEvents(QEventLoop::AllEvents, 50); } QObject *object = incubator.object(); My first thought is that the "Performance Considerations And Suggestions" documentation [2] explicitly suggests against such code, saying things like: "never manually spin the event loop" and: "Note: A pattern which is tempting, but should never be used, is creating your own QEventLoop or calling QCoreApplication::processEvents() in order to avoid blocking within a C++ code block invoked from QML. This is dangerous, because when an event loop is entered in a signal handler or binding, the QML engine continues to run other bindings, animations, transitions, etc. Those bindings can then cause side effects which, for example, destroy the hierarchy containing your event loop." I'd rather not have to handle all this stuff myself, if possible. So, is there a way to asynchronously create Qt Quick Items from a QQmlComponent (without using Loader), without having to write my own incubator? Or have I misunderstood the point of QQmlIncubator? The reason why I want to avoid Loader is that, from my experience with Qt Quick Controls, it doesn't perform so well with a large number of items. Cheers. [1] http://doc.qt.io/qt-5/qqmlincubator.html#details [2] http://doc.qt.io/qt-5/qtquick-performance.html#timing-considerations _______________________________________________ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest