Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. what is the meaning of "qrc::-1 File is empty"
Forum Updated to NodeBB v4.3 + New Features

what is the meaning of "qrc::-1 File is empty"

Scheduled Pinned Locked Moved Solved QML and Qt Quick
6 Posts 2 Posters 1.0k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • H Offline
    H Offline
    hcaslan
    wrote on last edited by
    #1

    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 empty

    my 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.0

    ApplicationWindow{
    width: 640
    height: 480
    visible: true

    Text{
        anchors.centerIn: parent
        text: "hello world"
    }
    

    }

    KroMignonK 1 Reply Last reply
    0
    • H Offline
      H Offline
      hcaslan
      wrote on last edited by
      #6

      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.

      1 Reply Last reply
      2
      • H hcaslan

        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 empty

        my 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.0

        ApplicationWindow{
        width: 640
        height: 480
        visible: true

        Text{
            anchors.centerIn: parent
            text: "hello world"
        }
        

        }

        KroMignonK Offline
        KroMignonK Offline
        KroMignon
        wrote on last edited by
        #2

        @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?

        It is an old maxim of mine that when you have excluded the impossible, whatever remains, however improbable, must be the truth. (Sherlock Holmes)

        H 1 Reply Last reply
        0
        • KroMignonK KroMignon

          @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?

          H Offline
          H Offline
          hcaslan
          wrote on last edited by
          #3

          @KroMignon Yes ı created and added the file "main.qml".
          alt text

          KroMignonK 1 Reply Last reply
          0
          • H hcaslan

            @KroMignon Yes ı created and added the file "main.qml".
            alt text

            KroMignonK Offline
            KroMignonK Offline
            KroMignon
            wrote on last edited by
            #4

            @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)?

            It is an old maxim of mine that when you have excluded the impossible, whatever remains, however improbable, must be the truth. (Sherlock Holmes)

            H 1 Reply Last reply
            0
            • KroMignonK KroMignon

              @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)?

              H Offline
              H Offline
              hcaslan
              wrote on last edited by
              #5

              @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.

              1 Reply Last reply
              0
              • H Offline
                H Offline
                hcaslan
                wrote on last edited by
                #6

                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.

                1 Reply Last reply
                2

                • Login

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • Users
                • Groups
                • Search
                • Get Qt Extensions
                • Unsolved