mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-09-09 00:07:52 -06:00
Fix the RadioCheckbar to work in Cura
This commit is contained in:
parent
a275e3de2b
commit
ae406e2480
1 changed files with 22 additions and 11 deletions
|
@ -14,7 +14,7 @@ Item
|
||||||
property int barSize: 2
|
property int barSize: 2
|
||||||
|
|
||||||
implicitWidth: 200
|
implicitWidth: 200
|
||||||
implicitHeight: buttonBar.height
|
implicitHeight: checkboxSize
|
||||||
|
|
||||||
property var model: null
|
property var model: null
|
||||||
|
|
||||||
|
@ -23,8 +23,12 @@ Item
|
||||||
{
|
{
|
||||||
id: inactiveLine
|
id: inactiveLine
|
||||||
color: inactiveColor
|
color: inactiveColor
|
||||||
anchors.verticalCenter: buttonBar.verticalCenter
|
|
||||||
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
|
||||||
|
@ -37,15 +41,16 @@ Item
|
||||||
RowLayout
|
RowLayout
|
||||||
{
|
{
|
||||||
id: buttonBar
|
id: buttonBar
|
||||||
anchors.centerIn: parent
|
anchors.top: parent.top
|
||||||
height: childrenRect.height
|
height: checkboxSize
|
||||||
width: parent.width
|
width: parent.width
|
||||||
spacing: 0
|
spacing: 0
|
||||||
|
|
||||||
Repeater
|
Repeater
|
||||||
{
|
{
|
||||||
id: repeater
|
id: repeater
|
||||||
model: base.model
|
model: base.model
|
||||||
|
height: checkboxSize
|
||||||
Item
|
Item
|
||||||
{
|
{
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
|
@ -53,7 +58,7 @@ Item
|
||||||
// the horizontal bar. The others should essentially not be limited.
|
// the horizontal bar. The others should essentially not be limited.
|
||||||
Layout.maximumWidth: index + 1 === repeater.count ? activeComponent.width: 200000000
|
Layout.maximumWidth: index + 1 === repeater.count ? activeComponent.width: 200000000
|
||||||
height: activeComponent.height
|
height: activeComponent.height
|
||||||
property bool isEnabled: model.enabled
|
property bool isEnabled: model.available
|
||||||
// The horizontal bar between the checkable options.
|
// The horizontal bar between the checkable options.
|
||||||
// Note that the horizontal bar points towards the previous item.
|
// Note that the horizontal bar points towards the previous item.
|
||||||
Rectangle
|
Rectangle
|
||||||
|
@ -67,7 +72,6 @@ Item
|
||||||
anchors
|
anchors
|
||||||
{
|
{
|
||||||
right: activeComponent.left
|
right: activeComponent.left
|
||||||
verticalCenter: activeComponent.verticalCenter
|
|
||||||
}
|
}
|
||||||
visible: previousItem !== null && previousItem.isEnabled && isEnabled
|
visible: previousItem !== null && previousItem.isEnabled && isEnabled
|
||||||
}
|
}
|
||||||
|
@ -75,6 +79,10 @@ Item
|
||||||
{
|
{
|
||||||
id: activeComponent
|
id: activeComponent
|
||||||
sourceComponent: isEnabled? checkboxComponent : disabledComponent
|
sourceComponent: isEnabled? checkboxComponent : disabledComponent
|
||||||
|
width: checkboxSize
|
||||||
|
// 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
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -87,9 +95,13 @@ Item
|
||||||
{
|
{
|
||||||
height: checkboxSize
|
height: checkboxSize
|
||||||
width: checkboxSize
|
width: checkboxSize
|
||||||
|
|
||||||
Rectangle
|
Rectangle
|
||||||
{
|
{
|
||||||
anchors.centerIn: parent
|
// 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.horizontalCenter: parent.horizontalCenter
|
||||||
height: inactiveMarkerSize
|
height: inactiveMarkerSize
|
||||||
width: inactiveMarkerSize
|
width: inactiveMarkerSize
|
||||||
radius: width / 2
|
radius: width / 2
|
||||||
|
@ -109,11 +121,10 @@ Item
|
||||||
height: checkboxSize
|
height: checkboxSize
|
||||||
indicator: Rectangle
|
indicator: Rectangle
|
||||||
{
|
{
|
||||||
height: checkbox.height
|
height: checkboxSize
|
||||||
width: checkbox.width
|
width: checkboxSize
|
||||||
radius: width / 2
|
radius: width / 2
|
||||||
|
|
||||||
anchors.centerIn: checkbox
|
|
||||||
border.color: defaultItemColor
|
border.color: defaultItemColor
|
||||||
|
|
||||||
Rectangle
|
Rectangle
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue