Important: Please read the Qt Code of Conduct -

CONFIG += qtquickcompiler doesn't seem to work

  • Hi

    I created a project in Qt Creator. Added CONFIG += qtquickcompiler to the .pro file in order to compile my .qml files in to .cpp and then compile them into the binary. When I build, I don't see any corresponding .cpp files for my .qml files in the build directory. How do I know if this is even using qtquickcompiler to compile .qml files? I don't see any sign of it in the compile output either.

    I am using Qt 5.9/msvc2015

  • I think the compiler just generates .qmlc files which are binary and not source files

  • No. That is what happens if you don't use qtquickcompiler or resourcecompiler. By default, qt uses JIT compiler to convert qml into machine code on the fly, but this adds to the load time when the app is loaded first time. You can see .qmlc files in the same folder as your .qml files during run time. This is what I am trying to avoid.

    I want to use qtquickcompiler to compile during build time and add it to executable binary. But when I build, my project is using rcc.exe to compile the qml into the binary directly.

  • @Naveen_AC
    I guess that Qt Quick Compiler is available for commercial license only.
    I don't know if this is the case.

    Qt 5.9 also comes with a brand new QML caching infrastructure, offering similar benefits to our users — just like the commercially available Qt Quick Compiler, but in a much more transparent way.
    (Taken from Qt 5.9 released)

  • Release builds using the QtQuick compiler generate a qtquickcompiler_loader.cpp file and *_qml.cpp files where * matches the name of your individual *.qml files all within a ".qtquickcompiler" folder within the "build-*-Release" output folder. I verified this with a commercial license Qt 5.9.

    Debugging QML is not compatible with the QtQuick compiler; using default settings to build a Debug executable will not use the QtQuick compiler.