what is the meaning of "qrc::-1 File is empty"
-
wrote on 22 Sept 2021, 07:56 last edited by
I'm trying to learn qt and I encountered such an error in my project, but I couldn't find any examples. Can you help?
QmlApplicationEngine failed to load component
qrc::-1 File is emptymy code at main.cpp
#include <QGuiApplication>
#include <QtQml/QQmlApplicationEngine>int main(int argc, char *argv[]){
QGuiApplication app(argc,argv);
QQmlApplicationEngine engine;
engine.load(QUrl("qrc://main.qml"));
return app.exec();
}my code at main.qml
import QtQuick 2.0
import QtQuick.Controls 1.0
import QtQuick.Window 2.0ApplicationWindow{
width: 640
height: 480
visible: trueText{ anchors.centerIn: parent text: "hello world" }
}
-
wrote on 22 Sept 2021, 08:44 last edited by
I found my mistake. I made a mistake while typing the QUrl(it must be three / not two / ). Thanks for your concern. If someone hadn't answered, I would probably have given up.
-
I'm trying to learn qt and I encountered such an error in my project, but I couldn't find any examples. Can you help?
QmlApplicationEngine failed to load component
qrc::-1 File is emptymy code at main.cpp
#include <QGuiApplication>
#include <QtQml/QQmlApplicationEngine>int main(int argc, char *argv[]){
QGuiApplication app(argc,argv);
QQmlApplicationEngine engine;
engine.load(QUrl("qrc://main.qml"));
return app.exec();
}my code at main.qml
import QtQuick 2.0
import QtQuick.Controls 1.0
import QtQuick.Window 2.0ApplicationWindow{
width: 640
height: 480
visible: trueText{ anchors.centerIn: parent text: "hello world" }
}
wrote on 22 Sept 2021, 08:07 last edited by@hcaslan said in what is the meaning of "qrc::-1 File is empty":
Hello and welcome to Qt forum!
engine.load(QUrl("qrc://main.qml"));
With this, you want to read
main.qml
file from resources (cf. https://doc.qt.io/archives/qt-5.11/resources.html).
Do you have add a resources to your project?
Is this file part of this resource? -
@hcaslan said in what is the meaning of "qrc::-1 File is empty":
Hello and welcome to Qt forum!
engine.load(QUrl("qrc://main.qml"));
With this, you want to read
main.qml
file from resources (cf. https://doc.qt.io/archives/qt-5.11/resources.html).
Do you have add a resources to your project?
Is this file part of this resource?wrote on 22 Sept 2021, 08:13 last edited by@KroMignon Yes ı created and added the file "main.qml".
-
@KroMignon Yes ı created and added the file "main.qml".
wrote on 22 Sept 2021, 08:22 last edited by@hcaslan said in what is the meaning of "qrc::-1 File is empty":
Yes ı created and added the file "main.qml".
And is the resource part of your project?
Do you use cmake or qmake build system?
Which Qt version are you using (I mean Qt and not QtCreator)? -
@hcaslan said in what is the meaning of "qrc::-1 File is empty":
Yes ı created and added the file "main.qml".
And is the resource part of your project?
Do you use cmake or qmake build system?
Which Qt version are you using (I mean Qt and not QtCreator)?wrote on 22 Sept 2021, 08:33 last edited by@KroMignon cmake build system. And ı use QtCreator. ı have tried this to add resource --> Add new>qt>resource file then add prefix then add files. if that's what you're asking.
-
wrote on 22 Sept 2021, 08:44 last edited by
I found my mistake. I made a mistake while typing the QUrl(it must be three / not two / ). Thanks for your concern. If someone hadn't answered, I would probably have given up.
4/6