QML - Qt 6.4.1 - Android 10 - Wrong Text/Label alignment
-
Hi,
I am working on a smart home dashboard in Qt (QML) that should run in Linux or Android tablet.
Currently I have an issue in android: The verticalAlignment doesn't seems to be used to render the QML.
Here is my QML:
Rectangle { color: 'transparent' Layout.fillHeight: true Layout.fillWidth: true Layout.columnSpan: 1 Layout.rowSpan: 1 Layout.row: 2 Layout.column: 0 GridLayout { anchors.fill: parent flow: GridLayout.TopToBottom Rectangle { color: 'transparent' Layout.fillWidth: true Layout.fillHeight: true Label { color: Constants.fontColorBold anchors.fill: parent text: "65%" font.pixelSize: 40 horizontalAlignment: Text.AlignHCenter verticalAlignment: Text.AlignBottom font.styleName: "Bold" } } Rectangle { color: 'transparent' Layout.fillWidth: true Layout.fillHeight: true Label { color: Constants.fontColor1 anchors.fill: parent text: "Humidity" font.pixelSize: 40 horizontalAlignment: Text.AlignHCenter verticalAlignment: Text.AlignTop font.styleName: "Light" } } } }The label "65%" must appear vertically aligned to bottom
The label "Humidity" must appear vertically aligned to topIn Linux: It's correctly displayed
In Android: it's centered vertically (bottom/top doesn't take effect)Any help will be appreciated
-
Have you tried simply aligning the label itself instead of the text inside the label?
So, instead of your Label you'd write;
Label { color: Constants.fontColorBold anchors.right: parent.right anchors.bottom: parent.bottom text: "65%" font.pixelSize: 40 font.styleName: "Bold" }