Thermo: fixes in project configuration for MCUs
Task-number: QDS-9838
Changes:
- fixed qmlproject configuration
- added MCU modules for Thermo and ThermoConfiguration
- fixed UI glitches (scrollbar painted on the TopBar and english translation non-checked by default)
- fixed translations - I added .qm files so we can use it as read-only example.
We can consider adding a full translations support in DS, along with:
https://doc.qt.io/qtdesignstudio/multilanguage-tutorial.html
Tested with DS and QtCreator (CMake), looks and works fine. To avoid the '0error' as temperature issue (appropriate file selector support), the following patch is required: https://codereview.qt-project.org/c/qt-creator/qt-creator/+/602773
Merge request reports
Activity
requested review from @thhartma
assigned to @thhartma
50 117 /* List of plugin directories passed to QML runtime */ 51 importPaths: [ "imports", "asset_imports", "i18n" ] 118 importPaths: [ "imports" ] 119 120 ModuleFiles { 121 files: [ 122 "imports/Thermo/Thermo.qmlproject", 123 "imports/ThermoConfiguration/ThermoConfiguration.qmlproject" 124 ] 125 } 52 126 53 127 /* Required for deployment */ 54 128 targetDirectory: "/opt/thermo" 55 129 56 130 //selectors: "metric" or "imperial", "big", "static" 57 fileSelectors: [ "metric" ] Instead of removing it, replace it with
QDS.fileSelectors: ["metric"]
QDS prefix tells MCUs configurator to skip it. MCU prefix in turn should be skipped by QDS. Nodes and properties without prefixes are common and shared between configurations unless they are unknown/ignored by environment.
Also notice that it's fileselector_S_ in qtquick. FileSelector without S was a mistake on MCUs side and should be replaced eventually, they are aware of it.
Also add "big" selector to look similar to MCUs build.
52 126 53 127 /* Required for deployment */ 54 128 targetDirectory: "/opt/thermo" 55 129 56 130 //selectors: "metric" or "imperial", "big", "static" 57 fileSelectors: [ "metric" ] 131 MCU.Config { 132 fileSelector: [ "metric" ] 133 defaultFontFamily: "Roboto" 134 } 58 135 59 136 qtForMCUs: true 60 137 61 138 qt6Project: true 139 140 multilanguageSupport: true changed this line in version 2 of the diff
- If you build this project with real Qt for MCUs, you can notice that it's a build of "big" config. But QtQuick in QDS runs a "small" config because it's a default one without fileselectors.
You can verify it by adding "big" in fileselectors of the main qmlproject.
I think it might be caused by us still using old CMakeLists here that is used by MCUs and it uses big config if it's a desktop build (line 165 in CMakeLists).
If we don't want to change CMakeLists right now, you can just add "big" to fileselectors and leave it for now, it will look kind of the same. Or we have to ditch the current CMakeLists and replace it with the new template and verify that qmlproject is good enough.
-
While we are on the fileselectors - qmlproject nodes and properties with "MCU." prefix are considered MCU-specific and should be ignored or deprioritized by QDS. You can use "QDS." prefix if the property exists only for QDS/QtQuick compatibility, it will make the property or node invisible for Qt for MCUs qmlproject build. So you can use QDS.fileSelectors and MCU.Config { fileSelector } at the same time in the same file. The patch that is linked in the MR description should consider that as well, however I think that the patch breaks the intended prefix logic.
-
After running and building the demo in QDS and in MCUs, translations in QDS stopped working. I noticed that .qm files changed on the disk. They are binary, but de_DE clearly changed from 3KB to 33Bytes. I think it might be linked to multilanguageSupport overriding the translation binaries you provided. I think maybe it's worth deactivating it.
-
Also I encountered a visual issue in QtQuick related to "Places View" or something adjusted to it. To reproduce it: run the example in QDS, select any room, go back to places. Now you have an almost 100px gap on the most-left side of the rooms view and if you scroll to the end of the list you'll notice that the last card can't be fully displayed - it ends behind the screen.
- I updated the CMakeLists.txt according to the current MCU template, saving the 'big' and 'small' run targets
- I removed the MCU.Config.fileSelector because there must be a bug here. The property interferes with CMake selectors (according to the docs it shouldn't, so to me it's a buggy behavior) and makes the mess in the UI.
This is what it looks like when we have MCU.Config.fileSelector: ["metric", "big"] + thermo_small target (just 'metric' selector). The same thing happens if we define the CMake target without any selectors:
- Added QDS.fileSelectors: [ "metric", "big" ], so 'big' is now the default in QDS
- The 'big' variant is the default in QtCreator because it seems to sort the available targets alphabetically
- I removed the multilanguageSupport property, didn't see any translation problems afterwards
- I wasn't aware of the fileSelector[s] bug + separation of QDS and MCU properties. With that in mind + checking that QDS.fileSelectors works fine without any changes to QDS, I'm rolling back my patch: https://codereview.qt-project.org/c/qt-creator/qt-creator/+/604996
- I fixed the positioning bug in the places view
Edited by Rafal Stawarski
added 2 commits
mentioned in commit 414082fd