From f77ad22fe3a7637f7b099330c99cf89cc8969730 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Tue, 3 Sep 2019 11:13:47 +0200 Subject: [PATCH] Fix hardcoded entries in radioCheckbar CURA-6598 --- resources/qml/RadioCheckbar.qml | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/resources/qml/RadioCheckbar.qml b/resources/qml/RadioCheckbar.qml index 4f959fc8fd..6f5ed301fa 100644 --- a/resources/qml/RadioCheckbar.qml +++ b/resources/qml/RadioCheckbar.qml @@ -1,18 +1,19 @@ import QtQuick 2.0 import QtQuick.Controls 2.3 import QtQuick.Layouts 1.3 +import UM 1.1 as UM Item { id: base property ButtonGroup buttonGroup: null - property color activeColor: "#3282ff" - property color inactiveColor: "#cccccc" - property color defaultItemColor: "#0a0850" - property int checkboxSize: 14 - property int inactiveMarkerSize: 4 - property int barSize: 2 + property color activeColor: UM.Theme.getColor("primary") + property color inactiveColor: UM.Theme.getColor("slider_groove") + property color defaultItemColor: UM.Theme.getColor("small_button_active") + property int checkboxSize: UM.Theme.getSize("radio_button").height * 0.75 + property int inactiveMarkerSize: 2 * barSize + property int barSize: UM.Theme.getSize("slider_groove_radius").height property var isCheckedFunction // Function that accepts the modelItem and returns if the item should be active. implicitWidth: 200 @@ -28,15 +29,13 @@ Item height: barSize - // This can (and should) be done wiht a verticalCenter. For some reason it does work in QtCreator - // but not when using the exact same QML in Cura. - y: 0.5 * checkboxSize anchors { left: buttonBar.left right: buttonBar.right leftMargin: (checkboxSize - inactiveMarkerSize) / 2 rightMargin: (checkboxSize - inactiveMarkerSize) / 2 + verticalCenter: parent.verticalCenter } } @@ -72,12 +71,11 @@ Item height: barSize width: buttonBar.width / (repeater.count - 1) - activeComponent.width - 2 color: defaultItemColor - // This can (and should) be done wiht a verticalCenter. For some reason it does work in QtCreator - // but not when using the exact same QML in Cura. - y: 0.5 * checkboxSize + anchors { right: activeComponent.left + verticalCenter: parent.verticalCenter } visible: previousItem !== null && previousItem.isEnabled && isEnabled } @@ -105,7 +103,7 @@ Item { // This can (and should) be done wiht a verticalCenter. For some reason it does work in QtCreator // but not when using the exact same QML in Cura. - y: 0.5 * checkboxSize - 1 + anchors.verticalCenter: parent.verticalCenter anchors.horizontalCenter: parent.horizontalCenter height: inactiveMarkerSize width: inactiveMarkerSize