Details
-
Bug
-
Resolution: Fixed
-
P2: Important
-
QDS 4.3.1, QDS 4.3.2
-
-
c0b7b4646 (qds/dev), b19ad01a5 (qds/4.5)
-
QDS Berlin - 2024 Week 23/24
Description
Summary of the issue
Auto genereated code for image files doesn't work propery for MCU projects. When Qt for MCUs is installed on the machine, QDS executes qmlprojectexporter when [Live Preview] is executed and it failes by not finding the image files.
Reproducible steps
- Install both QDS and Qt for MCUs on the same machine. (With this setup, qmlprojectexporter will be executed when [Launch Preview] is executed for sanity code checking.)
- Create a new project for Qt for MCUs.
- In Assets panel, press [\+] button and choose an image to import it into the project.
- The image files is copied and stored under images directory of the project. Drag the image file under the images directory and drop it on the QML screen.
- Press [Run] or [Live Preview] to preview the project.
Expected result
The QML is executed propery, the image is shown on the screen.
Actual result
Execution fails at the sanity code checing functionality of qmlprojectexporter. Following is an example of the error output.
22:35:08: 起動中: "C:\Qt\QtMCUs.6.0\bin\qmlprojectexporter.exe" C:/Users/81701/Documents/UntitledProject26/UntitledProject26.qmlproject --platform qt --toolchain mingw --include-dirs "C:/Qt/QtMCUs/2.6.0/include/qul,C:/Qt/QtMCUs/2.6.0/include/qul/Timeline" --outdir C:/Users/81701/AppData/Local/Temp/QtDesignStudio-BGKYdu [qmlprojectexporter] warning: Problem during load of qmlproject file [qmlprojectexporter] C:/Users/81701/Documents/UntitledProject26/UntitledProject26.qmlproject:10:5: warning: It is not recommended to use the 'directory' property. The build system might not be able to correctly track the contents of the directory, so always clean and rebuild whenever adding or removing files. Additionally, every file present in the directory at configure time will be added to the application binary, which might increase the memory footprint. Prefer explicit inclusion of the needed files using the 'files' property to avoid these issues. QmlFiles { ^~~~~~~~ [qmlprojectexporter] C:/Users/81701/Documents/UntitledProject26/UntitledProject26.qmlproject:18:5: warning: It is not recommended to use the 'directory' property. The build system might not be able to correctly track the contents of the directory, so always clean and rebuild whenever adding or removing files. Additionally, every file present in the directory at configure time will be added to the application binary, which might increase the memory footprint. Prefer explicit inclusion of the needed files using the 'files' property to avoid these issues. ImageFiles { ^~~~~~~~~~ C:/Users/81701/Documents/UntitledProject26/Screen01.ui.qml:24:9: error: Failed to find image in the resource system source: "images/bg1.png" ^~~~~~ qmltocpp -IC:/Qt/QtMCUs/2.6.0/include/qul -IC:/Qt/QtMCUs/2.6.0/include/qul/Timeline --mapModule=QtQuick.Controls=QtQuick.Controls.StyleDefault --qulrcc-json-file=C:/Users/81701/AppData/Local/Temp/QtDesignStudio-BGKYdu/resources/qulrcc_qmlproject_output.json --depfile=C:/Users/81701/AppData/Local/Temp/QtDesignStudio-BGKYdu/Screen01.d --outputDir=C:/Users/81701/AppData/Local/Temp/QtDesignStudio-BGKYdu --resources=C:/Users/81701/Documents/UntitledProject26/Screen01.ui.qml,UntitledProject26.qml,Screen01.ui.qml,UntitledProject26.qml --projectDir=C:/Users/81701/Documents/UntitledProject26 --qmlImportPath=C:/Users/81701/AppData/Local/Temp/QtDesignStudio-BGKYdu,C:/Qt/QtMCUs/2.6.0/src/controls/styles/Default,C:/Qt/QtMCUs/2.6.0/include,C:/Users/81701/Documents/UntitledProject26,C:/Qt/QtMCUs/2.6.0/include/qul/Default,C:/Qt/QtMCUs/2.6.0/src/controls,C:/Qt/QtMCUs/2.6.0/include/qul/Templates,C:/Users/81701/AppData/Local/Temp/QtDesignStudio-BGKYdu C:/Users/81701/Documents/UntitledProject26/Screen01.ui.qml Error: process failed with exit code 1. 22:35:09: プロセス "C:\Qt\QtMCUs.6.0\bin\qmlprojectexporter.exe" はコード 1 で終了しました。 プロジェクト UntitledProject26 のビルド・デプロイ中にエラーが発生しました (キット Desktop Qt 6.5.2) この問題は、キット Desktop Qt 6.5.2 の設定が原因かもしれません。 ステップ "Qt for MCUs Deploy Step" 実行中 ``` <p></p> ## The insight and the workaround <p></p> I can see this issue is caused by the mismatch between the spec of QmlProject file and the project file QDS generate. <p></p> Initial qmlproject file QDS generate only have following for image files. <p></p> ```java ImageFiles { directory: "." } ``` And the spec for ImageFiles.directory says: <p></p> > **Warning:** Images placed in subdirectories are not included. [ImageFiles.directory | QmlProject Manual 2.6 (qt.io)](https://doc.qt.io/QtForMCUs-2.6/qtul-qmlproject-imagefilesnode-directory.html) <p></p> One possible workground is adding following to the qmlproject file. ```java ImageFiles { directory: "images" } ``` I can see autogenerated code through Qt Bridge also produces this problem. I belive this is quite a serious problem many would encouneter in many different situations. <p></p>