Fix hardcoded entries in radioCheckbar

CURA-6598
This commit is contained in:
Jaime van Kessel 2019-09-03 11:13:47 +02:00
parent 001c2ec753
commit f77ad22fe3
No known key found for this signature in database
GPG Key ID: 3710727397403C91

View File

@ -1,18 +1,19 @@
import QtQuick 2.0 import QtQuick 2.0
import QtQuick.Controls 2.3 import QtQuick.Controls 2.3
import QtQuick.Layouts 1.3 import QtQuick.Layouts 1.3
import UM 1.1 as UM
Item Item
{ {
id: base id: base
property ButtonGroup buttonGroup: null property ButtonGroup buttonGroup: null
property color activeColor: "#3282ff" property color activeColor: UM.Theme.getColor("primary")
property color inactiveColor: "#cccccc" property color inactiveColor: UM.Theme.getColor("slider_groove")
property color defaultItemColor: "#0a0850" property color defaultItemColor: UM.Theme.getColor("small_button_active")
property int checkboxSize: 14 property int checkboxSize: UM.Theme.getSize("radio_button").height * 0.75
property int inactiveMarkerSize: 4 property int inactiveMarkerSize: 2 * barSize
property int barSize: 2 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. property var isCheckedFunction // Function that accepts the modelItem and returns if the item should be active.
implicitWidth: 200 implicitWidth: 200
@ -28,15 +29,13 @@ Item
height: barSize 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 anchors
{ {
left: buttonBar.left left: buttonBar.left
right: buttonBar.right right: buttonBar.right
leftMargin: (checkboxSize - inactiveMarkerSize) / 2 leftMargin: (checkboxSize - inactiveMarkerSize) / 2
rightMargin: (checkboxSize - inactiveMarkerSize) / 2 rightMargin: (checkboxSize - inactiveMarkerSize) / 2
verticalCenter: parent.verticalCenter
} }
} }
@ -72,12 +71,11 @@ Item
height: barSize height: barSize
width: buttonBar.width / (repeater.count - 1) - activeComponent.width - 2 width: buttonBar.width / (repeater.count - 1) - activeComponent.width - 2
color: defaultItemColor 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 anchors
{ {
right: activeComponent.left right: activeComponent.left
verticalCenter: parent.verticalCenter
} }
visible: previousItem !== null && previousItem.isEnabled && isEnabled 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 // 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. // but not when using the exact same QML in Cura.
y: 0.5 * checkboxSize - 1 anchors.verticalCenter: parent.verticalCenter
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
height: inactiveMarkerSize height: inactiveMarkerSize
width: inactiveMarkerSize width: inactiveMarkerSize