Important: Please read the Qt Code of Conduct -

[Solved]Can't load the image after I register the qml file to Qt resource system

  • Before I register the main.qml to Qt resource system, everything are fine
    after I register the main.qml to Qt resource system, I can't open the file

    import QtQuick 2.0

    Rectangle {
    width: 360
    height: 360

        anchors.fill: parent
        source: "/Pictures/img_0000.jpg"


    #include <QtGui/QGuiApplication>
    #include "qtquick2applicationviewer.h"

    int main(int argc, char *argv[])
    QGuiApplication app(argc, argv);

    QtQuick2ApplicationViewer viewer;
    return app.exec&#40;&#41;;


    error message

    qrc:///qml/qmlResource/main.qml:7:5: QML Image: Cannot open: qrc:///Pictures/img_0000.jpg

    looks like the Image complain it can not find the image from qrc
    but I don't want the program to load the image from qrc
    it is not my intention

Log in to reply