From 39d52556f41f7f776167d406d02f3a7939160edf Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Tue, 3 Sep 2019 11:16:50 +0200 Subject: [PATCH] Fix text alignments by using rounding CURA-6598 --- resources/qml/LabelBar.qml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/resources/qml/LabelBar.qml b/resources/qml/LabelBar.qml index 87cc825b3b..571c9f0bfb 100644 --- a/resources/qml/LabelBar.qml +++ b/resources/qml/LabelBar.qml @@ -32,8 +32,9 @@ Item Item { Layout.fillWidth: true - Layout.maximumWidth: index + 1 === repeater.count || repeater.count <= 1 ? itemSize : base.width / (repeater.count - 1) + Layout.maximumWidth: Math.round(index + 1 === repeater.count || repeater.count <= 1 ? itemSize : base.width / (repeater.count - 1)) height: label.height + Label { id: label @@ -52,7 +53,7 @@ Item // We want the center of the label to align with the center of the item, so we negatively offset by half the contentWidth right: index + 1 === repeater.count ? parent.right: undefined left: index + 1 === repeater.count || index === 0 ? undefined: parent.left - leftMargin: (0.5 * itemSize) - 0.5 * contentWidth + leftMargin: Math.round((itemSize - contentWidth) * 0.5) } } }