From 836e7c0c9bc3c02b23ff51c8cda9c62d3aab3fcd Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Mon, 7 Jun 2021 18:00:32 +0200 Subject: [PATCH] Fix overlap of unit and setting value with RTL-languages The unit was hard-coded to be anchored to the right. The text was getting the full width and aligned implicitly by the language. We'll keep the layout of the text properly internationalised, but make sure that the unit is opposite of wherever the text is. Fixes CURA-8206. Fixes #9667. --- resources/qml/Settings/SettingTextField.qml | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/resources/qml/Settings/SettingTextField.qml b/resources/qml/Settings/SettingTextField.qml index 9fc3d0a554..a5647e2d3a 100644 --- a/resources/qml/Settings/SettingTextField.qml +++ b/resources/qml/Settings/SettingTextField.qml @@ -1,4 +1,4 @@ -// Copyright (c) 2017 Ultimaker B.V. +// Copyright (c) 2021 Ultimaker B.V. // Cura is released under the terms of the LGPLv3 or higher. import QtQuick 2.7 @@ -92,11 +92,18 @@ SettingItem Label { - anchors.right: parent.right - anchors.rightMargin: Math.round(UM.Theme.getSize("setting_unit_margin").width) - anchors.verticalCenter: parent.verticalCenter + anchors + { + left: parent.left + leftMargin: Math.round(UM.Theme.getSize("setting_unit_margin").width) + right: parent.right + rightMargin: Math.round(UM.Theme.getSize("setting_unit_margin").width) + verticalCenter: parent.verticalCenter + } text: definition.unit + //However the setting value is aligned, align the unit opposite. That way it stays readable with right-to-left languages. + horizontalAlignment: (input.effectiveHorizontalAlignment == Text.AlignLeft) ? Text.AlignRight : Text.AlignLeft textFormat: Text.PlainText renderType: Text.NativeRendering color: UM.Theme.getColor("setting_unit")