[solved]QQmlcomponent:component is not ready
-
i want to use QML object on C++ by these codes :
// Using QQmlComponentQQmlEngine engine; QQmlComponent component(&engine, QUrl::fromLocalFile("MyItem.qml")); QObject *object = component.create(); ... delete object;
(from QT help )
but get this mesage : QQmlcomponent:component is not ready
:(when write a wrong address insted of MyItem.qml (use a address dos not exist) i get that too !
i thing my Qml file is not accessable .
please help me . -
-
@mahadin Hmm, I guess the problem must be that the qml file is not present in the compiled executable's current working directory. Try giving a complete path of qml file instead.
Or you can add it in yourqrc
file and load it from there as follows:QQmlComponent component(&engine,QUrl(QStringLiteral("qrc:/MyItem.qml")))