From fe5910dd9619bd0ad89a7a0bb4bcd6de73e7f67d Mon Sep 17 00:00:00 2001 From: ChrisTerBeke Date: Fri, 22 Sep 2017 11:54:59 +0200 Subject: [PATCH] CURA-4182 final tweaks to quality slider color and position --- resources/qml/SidebarSimple.qml | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/resources/qml/SidebarSimple.qml b/resources/qml/SidebarSimple.qml index 1528ed26a7..3cc65f47d3 100644 --- a/resources/qml/SidebarSimple.qml +++ b/resources/qml/SidebarSimple.qml @@ -150,7 +150,7 @@ Item color: UM.Theme.getColor("text") } - //Show titles for the each quality slider ticks + // Show titles for the each quality slider ticks Item { y: -5; @@ -164,10 +164,20 @@ Item anchors.verticalCenter: parent.verticalCenter anchors.top: parent.top anchors.topMargin: UM.Theme.getSize("sidebar_margin").height / 2 - color: UM.Theme.getColor("text") + + color: UM.Theme.getColor("quality_slider_unavailable") ? UM.Theme.getColor("quality_slider_available") : UM.Theme.getColor("quality_slider_unavailable") text: Cura.ProfilesModel.getItem(index).layer_height_without_unit - width: 1 - x: (index != qualityModel.totalTicks) ? (base.width * 0.55 / qualityModel.totalTicks) * index : (base.width * 0.55 / qualityModel.totalTicks) * index - 15 + + x: { + // Make sure the text aligns correctly with each tick + if (index == 0) { + return (base.width * 0.55 / qualityModel.totalTicks) * index + } else if (index == qualityModel.totalTicks) { + return (base.width * 0.55 / qualityModel.totalTicks) * index - width + } else { + return (base.width * 0.55 / qualityModel.totalTicks) * index - (width / 2) + } + } } } } @@ -202,7 +212,7 @@ Item Rectangle { anchors.verticalCenter: parent.verticalCenter - color: qualityModel.count > 1 ? UM.Theme.getColor("quality_slider_available") : UM.Theme.getColor("quality_slider_unavailable") + color: Cura.ProfilesModel.getItem(index).available ? UM.Theme.getColor("quality_slider_available") : UM.Theme.getColor("quality_slider_unavailable") width: 1 height: 6 y: 0