QtCreator and QML files

  • Hello,

    i have a troubles with understanding how QtCreator manages QtQuick projects. In general I have problems with understanding how to structure an application which uses both .qml files and some C++ as well. When I create a QtQuick project i see my .qml files listed in project view under a 'qml icon'. Later they are copied to out-of-source build folder.
    Recently I have created a normal Qt GUI application and later decided to add some QML.. I was suprised when I noticed that .qml files are visible as 'other files' rather than 'qml files' on the project tree and they are not copied to the out-of-source build directory.

    So what makes the difference?

    thanks for all suggestions, it is probably something simple which Im for some reason not able to see.

  • When you start a C++ project with QML, a file qmlapplicationviewer.pri is included in your .pro file and a new variable DEPLOYMENTFOLDERS is added:
    #folder where the qml files are
    folder_01.source = qml/projectName
    #destination folder in the build directory and the install directory
    folder_01.target = qml


    The function qtcAddDeployment() from the .pri file takes care of copying the file from that directory to the out-of-source build folder and to the install folder (through the use of the variables QMAKE_EXTRA_TARGET and INSTALLS).
    Apparently everything in the INSTALLS variable is also automagically displayed in the project tree in QtCreator without being listed as OTHER_FILES in the .pro.

  • Thanks, so there is a chance that it will work. Anyway it is still hard to make this working for Qt application to which QML is added later.

Log in to reply

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