Qt 5.11+ : How to use Qt Quick Compiler? (Qt Open Source Version)
-
Hi. I have seen Qt 5.11+ supports
QtQuickCompiler
anymore: http://doc.qt.io/qt-5/whatsnew511.html#qt-qml-module
I read QtQuickCompiler documentation but I can't use it. The documentation says:Create a .qrc file for your application and include all the files your project needs, including .qml , .js and qmldir files.
But there is already an
qml.qrc
file when we create an qqc2 project:
I addedCONFIG += qtquickcompiler
parameter to.pro
file but I get this error message when I compile my app:Cannot find the androiddeploy Json file. Error while building/deploying project qqc2-test-project (kit: Android for armeabi-v7a (GCC 4.9, Qt 5.11.0 for Android armv7)) When executing step "Deploy to Android device"
It is compiling when I choose
Desktop
but notAndroid
.
How can I useQtQuickCompiler
for Android?
How can I understand that QtQuickCompiler is working?
Thanks. -
Hi,
The error you are posting looks completely unrelated to QtQuickCompiler. It rather looks like your Android development setup is somehow broken.
-
@SGaist
It's compiling and running for Android when I removeCONFIG += qtquickcompiler
from.pro
file. There is no problem for Android settings.
Edit:
Interesting! I can compile it now.
Well, how can I understand that is QtQuickCompiler running? -
@Ibrahim said in Qt 5.11+ : How to use Qt Quick Compiler? (Qt Open Source Version):
Well, how can I understand that is QtQuickCompiler running?
I don't understand that question, can you rephrase it ?
-
@SGaist
I mean I wroteCONFIG += qtquickcompiler
and compiled but what changed?
Example of:
If I compiled my app for desktop withoutCONFIG += qtquickcompiler
, result is this:
If I compiled my app for desktop withCONFIG += qtquickcompiler
, result is this:
If I compiled my app for Android withoutCONFIG += qtquickcompiler
, result is this:
If I compiled my app for Android withCONFIG += qtquickcompiler
, result is this:
I don't understand that what happened when I putCONFIG += qtquickcompiler
parameter? Because both withQtQuickCompiler
and withoutQtQuickCompiler
I can see QML files (such asOpacityMask.qml
) and shared files (such aslibQt5Core.so
). I have read QtQuickCompiler documentation and it says:The Qt Quick Compiler is a development add-on for Qt Quick applications which allows you to compile QML source code into the final binary.
But I can see there iare still QML files and libQt5xxx.so files.
-
@Ibrahim
IIRC you dont see any result directly.
Your qml files are in-place replaced with .qmlc files in the final qrc binary. -
final qrc binary
What do you mean? I compiled my app with
release mode
but apk still includesxxx.qml
files andlibQt5xxx.so
. I can't seeqmlc
files. -
@Ibrahimthe
files specified in the qrc file are compiled into a cpp file by the rcc tool implicitly. thats how they are embedded into your app -
@raven-worx Well, does
QtQuikcCompiler
removelibQt5xxx.so
files andXXX.qml
files in my apk files or desktop app? Because I can still seelibQt5xxx.so
andXXX.qml
files in my apk file. I can seeqmlcache_loader.cpp
andqmlcache_loader.o
files in my desktop app. Do you mean these files?
I mean it's enough when I writeCONFIG += qtquickcompiler
parameter in.pro
file? Don't thelibQt5xxx.so
andXXX.qml
files from my apk have to be disappear when I compiled withCONFIG += qtquickcompiler
parameter? -
-
@raven-worx
Yes,main.qml
file is in the qrc. It's in qrc as default when I create an QQC2 project. Should I move main.qml to another qrc? I have not another qml files but just main.qml. -
@Ibrahim said in Qt 5.11+ : How to use Qt Quick Compiler? (Qt Open Source Version):
Well, how can I understand that is QtQuickCompiler running?
Since I think, that this is still not properly answered, here is a way to test, if your build used the Qt Quick compiler:
A benefit of the Qt Quick compiler, is that syntax errors are checked during compilation.
So you can just put some invalid QML syntax in your qml file and test if the build finds the error during compilation (then you are using the compiler) or if the error is only found when running the application (then you are using the interpreter).
So. e.g. put the following at the top of your
main.qml
and see what happens:imports asdf
-
@Ibrahim said in Qt 5.11+ : How to use Qt Quick Compiler? (Qt Open Source Version):
Well, how can I understand that is QtQuickCompiler running?
Since I think, that this is still not properly answered, here is a way to test, if your build used the Qt Quick compiler:
A benefit of the Qt Quick compiler, is that syntax errors are checked during compilation.
So you can just put some invalid QML syntax in your qml file and test if the build finds the error during compilation (then you are using the compiler) or if the error is only found when running the application (then you are using the interpreter).
So. e.g. put the following at the top of your main.qml and see what happens:
imports asdf
This trick worked fine for me. In my case my problem was that I was still using in my compilation options Qt5.10, after that I have to configure CONFIG += qtquickcompiler in the build steps inside qt.
I added CONFIG += qtquickcompiler parameter to .pro file but I get this error message when I compile my app:
I think that this was your error, you should not define it on .pro but in the compile options steps for qmake. I can even see checkbox that indicates me if the compiler is enabled or not.
Th