Am I misunderstanding the docs, or is Qt.createQmlObject (almost) useless?
Unsolved
QML and Qt Quick
-
From the Qt docs:
Note that this function returns immediately, and therefore may not work if the qml string loads new components (that is, external QML files that have not yet been loaded). If this is the case, consider using Qt.createComponent() instead.
But as far as I know, all QML files are "external", and any of them may have its load delayed arbitrarily long.
E.g. if I do this:
Qt.createQmlObject('\ import QtQuick 2.0\n\ Rectangle { } ', parentObject, "myRect");
What happens if Rectangle has not been loaded by the time I execute this code? By this logic any code that uses
Qt.createQmlObject
with imports in the passed string is risky. So we should always useQt.createComponent
instead.I'm pretty sure I'm misunderstanding these docs, but I don't know what the right interpretation of them is.