QQmlApplicationEngine failed to load component
-
The code you're showing does not contain any errors.
Loading of main.qml fails at runtime, which suggests that:
- QRC file was not compiled
- QRC file was not included in the compiled binary
- main.qml is not in the QRC file
-
The code you're showing does not contain any errors.
Loading of main.qml fails at runtime, which suggests that:
- QRC file was not compiled
- QRC file was not included in the compiled binary
- main.qml is not in the QRC file
-
But what should I explain?
I see you are using Visual Studio, so your setup is probably unusual. I do not know what build system you are using (qmake, cmake, something else?). I do not know if you are using QRC file at all (are you?). I have not seen the code of your QRC file, nor your build system files (*.pro or CMakeLists.txt). I can't guess all that.
-
But what should I explain?
I see you are using Visual Studio, so your setup is probably unusual. I do not know what build system you are using (qmake, cmake, something else?). I do not know if you are using QRC file at all (are you?). I have not seen the code of your QRC file, nor your build system files (*.pro or CMakeLists.txt). I can't guess all that.
-
Because it's either wrong (do you have
main.qml
file? Is it added to QRC? Is the path and QRC syntax correct?) or the resource file is not properly added / linked into the binary.Since you have still not shown any code, I can only keep guessing.
-
Because it's either wrong (do you have
main.qml
file? Is it added to QRC? Is the path and QRC syntax correct?) or the resource file is not properly added / linked into the binary.Since you have still not shown any code, I can only keep guessing.
-
See the "Resource URL" field: this is what you need to paste into your source code.
So it's:
engine.load(QUrl("qrc:/qrc/mian.qml"));
Notice it's
mian
and and notmain
- you've made a typo.BTW. In the future, please paste code, not pictures. This way I can copy-paste and tweak your stuff to help you, instead of typing everything myself.
-
This post is deleted!