Make QML executable on Mac (1.0.1)



  • Using the simplest QML application ever (the helloWord application), I'm just trying to make the executable.
    I created a blank application using New Project>Applications>Qt Quick Application
    So I get the following folder structure
    @myApplication
    |- myApplication.pro
    |- qtquick2applicationviewer
    | |- qtquick2applicationviewer.pri
    | |- Headers
    | |- Sources
    |- Sources
    | |- main.cpp
    |- QML
    |- qml/myApplication
    |- main.qml
    @

    so, from the command line, all I do is
    @

    qmake
    make install
    @

    and when I try to launch the application, I get
    @
    file:////<path_to_folder>/myApplication/main.qml: File not found
    @

    And if I do move the qml file at this location, it works.

    here is my .pro file
    @

    Add more folders to ship with the application, here

    folder_01.source = qml/myApplication
    folder_01.target = qml
    DEPLOYMENTFOLDERS = folder_01

    Additional import path used to resolve QML modules in Creator's code model

    QML_IMPORT_PATH =

    The .cpp file which was generated for your project. Feel free to hack it.

    SOURCES += main.cpp

    Installation path

    target.path =

    Please do not modify the following two lines. Required for deployment.

    include(qtquick2applicationviewer/qtquick2applicationviewer.pri)
    qtcAddDeployment()
    @

    As you can see, I can not make this application simpler… I guess I'm missing something basic but can't figure out which one.

    Thanks


  • Moderators

    You can move QML files into a Qt Resource file (qrc), then it will always work. Or run your app from Qt Creator (not command line) and it should also be working.



  • Thanks sierdzio.

    I will surely look into this Qt Resource file.

    I also figured out that to launch the application, I had to run (from the command line) the myApplication inside the myApplication.app/Contents/MacOs folder.

    Now I just need to figure out why, if I move that same folder into another Mac computer, it does not work !


Log in to reply
 

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