Qt Creator can't find QML file



  • I'm running Qt Creator 2.8.1 on windows 8 and have QtTestClient.pro, main.cpp and main.qml files in the QtTestClient project directory. The build succeeds but running with msvc++ (or minGW) fails with the error

    @
    file:///C:/Projects/build-QtTestClient-Desktop_Qt_5_1_1_MSVC2012_64bit-Release/main.qml:-1 File not found
    @

    QtTestClient.pro contains

    @
    QT += qml quick

    SOURCES += main.cpp
    TARGET = QtTestClient

    OTHER_FILES +=
    main.qml
    @

    and main.cpp contains the statement

    @
    component.loadUrl(QUrl::fromLocalFile("main.qml"));
    @

    Any assistance would be appreciated.



  • Its always better to use Resource file to store and access all your QML files. Then you dont need to worry about the file path...


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.