Avoid manual rebuild after modifying qml files in Qt Creator
-
Hi there,
I am new to QML and I was wondering how I should include qml-files in the project in order to avoid having to rebuild the project manually every time I change some code in one of the qml files. So far I am basing myself on Qt examples such as qt quick controls 2 flatstyle, in which the qml files are listed under RESOURCES in the pro file. In Qt Creator they then appear in a subfolder of the qmqke_qmake_immediate.qrc file. Is there a recommended way how to include them best?
-
@markugra
since you added them to a Qt resource file they are included/compiled into the binary. Thus the necessary rebuild.
The only way to avoid that is to load the qml files from the filesystem and avoid rebuilding this way. But this approach is more error prone IMO. -
@raven-worx
Thank you for your reply. I'm afraid I still don't understand why a simple "build" is not enough. Would you mind to elaborate on that?
For now I take it that there is no better way and I have to live with cleaning the project before every run. -
@markugra
all files in qrc file are read and converted to plain c++ code (binary arrays). Thus the corresponding cpp-file changes whenever a file in your qrc file changes. -
@raven-worx
Do I understand correctly that a simple "build" would not cause the conversion from qml to c++ if there are already existing binary arrays (even if the qml code has changed)? As a consequence the binaries need to be removed for a QML update to have an effect?