Replace all old controls 1 comboboxes with UM.Combobox

This commit is contained in:
Jaime van Kessel 2021-11-10 14:57:01 +01:00
parent e0ff70dc78
commit 0bb09a4783
7 changed files with 15 additions and 68 deletions

View file

@ -7,7 +7,7 @@ import QtQuick.Layouts 1.1
import QtQuick.Controls.Styles 1.1 import QtQuick.Controls.Styles 1.1
import QtGraphicalEffects 1.0 import QtGraphicalEffects 1.0
import UM 1.0 as UM import UM 1.5 as UM
import Cura 1.0 as Cura import Cura 1.0 as Cura
@ -187,7 +187,7 @@ Cura.ExpandableComponent
{ {
model: CuraApplication.getExtrudersModel() model: CuraApplication.getExtrudersModel()
CheckBox UM.CheckBox
{ {
id: extrudersModelCheckBox id: extrudersModelCheckBox
checked: viewSettings.extruder_opacities[index] > 0.5 || viewSettings.extruder_opacities[index] == undefined || viewSettings.extruder_opacities[index] == "" checked: viewSettings.extruder_opacities[index] > 0.5 || viewSettings.extruder_opacities[index] == undefined || viewSettings.extruder_opacities[index] == ""
@ -201,8 +201,6 @@ Cura.ExpandableComponent
UM.Preferences.setValue("layerview/extruder_opacities", viewSettings.extruder_opacities.join("|")); UM.Preferences.setValue("layerview/extruder_opacities", viewSettings.extruder_opacities.join("|"));
} }
style: UM.Theme.styles.checkbox
Rectangle Rectangle
{ {
id: swatch id: swatch
@ -277,7 +275,7 @@ Cura.ExpandableComponent
} }
} }
CheckBox UM.CheckBox
{ {
id: legendModelCheckBox id: legendModelCheckBox
checked: model.initialValue checked: model.initialValue
@ -285,8 +283,6 @@ Cura.ExpandableComponent
height: UM.Theme.getSize("layerview_row").height + UM.Theme.getSize("default_lining").height height: UM.Theme.getSize("layerview_row").height + UM.Theme.getSize("default_lining").height
width: parent.width width: parent.width
style: UM.Theme.styles.checkbox
Rectangle Rectangle
{ {
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
@ -315,24 +311,22 @@ Cura.ExpandableComponent
} }
} }
CheckBox UM.CheckBox
{ {
checked: viewSettings.only_show_top_layers checked: viewSettings.only_show_top_layers
onClicked: UM.Preferences.setValue("view/only_show_top_layers", checked ? 1.0 : 0.0) onClicked: UM.Preferences.setValue("view/only_show_top_layers", checked ? 1.0 : 0.0)
text: catalog.i18nc("@label", "Only Show Top Layers") text: catalog.i18nc("@label", "Only Show Top Layers")
visible: UM.SimulationView.compatibilityMode visible: UM.SimulationView.compatibilityMode
style: UM.Theme.styles.checkbox
width: parent.width width: parent.width
} }
CheckBox UM.CheckBox
{ {
checked: viewSettings.top_layer_count == 5 checked: viewSettings.top_layer_count == 5
onClicked: UM.Preferences.setValue("view/top_layer_count", checked ? 5 : 1) onClicked: UM.Preferences.setValue("view/top_layer_count", checked ? 5 : 1)
text: catalog.i18nc("@label", "Show 5 Detailed Layers On Top") text: catalog.i18nc("@label", "Show 5 Detailed Layers On Top")
width: parent.width width: parent.width
visible: UM.SimulationView.compatibilityMode visible: UM.SimulationView.compatibilityMode
style: UM.Theme.styles.checkbox
} }
Repeater Repeater

View file

@ -4,7 +4,7 @@
import QtQuick 2.10 import QtQuick 2.10
import QtQuick.Controls 1.4 import QtQuick.Controls 1.4
import QtQuick.Controls.Styles 1.4 import QtQuick.Controls.Styles 1.4
import UM 1.1 as UM import UM 1.5 as UM
Item Item
{ {
@ -28,7 +28,7 @@ Item
spacing: UM.Theme.getSize("default_margin").width spacing: UM.Theme.getSize("default_margin").width
topPadding: UM.Theme.getSize("default_margin").height topPadding: UM.Theme.getSize("default_margin").height
CheckBox UM.CheckBox
{ {
id: disableButton id: disableButton
anchors.verticalCenter: pluginInfo.verticalCenter anchors.verticalCenter: pluginInfo.verticalCenter
@ -36,7 +36,6 @@ Item
visible: model.type == "plugin" visible: model.type == "plugin"
width: visible ? UM.Theme.getSize("checkbox").width : 0 width: visible ? UM.Theme.getSize("checkbox").width : 0
enabled: !toolbox.isDownloading enabled: !toolbox.isDownloading
style: UM.Theme.styles.checkbox
onClicked: toolbox.isEnabled(model.id) ? toolbox.disable(model.id) : toolbox.enable(model.id) onClicked: toolbox.isEnabled(model.id) ? toolbox.disable(model.id) : toolbox.enable(model.id)
} }
Column Column

View file

@ -6,7 +6,7 @@ import QtQuick.Controls 2.0
import QtQuick.Controls 1.1 as OldControls import QtQuick.Controls 1.1 as OldControls
import Cura 1.0 as Cura import Cura 1.0 as Cura
import UM 1.3 as UM import UM 1.5 as UM
Item Item
{ {
@ -219,12 +219,11 @@ Item
renderType: Text.NativeRendering renderType: Text.NativeRendering
} }
OldControls.CheckBox UM.CheckBox
{ {
id: enabledCheckbox id: enabledCheckbox
enabled: !checked || Cura.MachineManager.numberExtrudersEnabled > 1 //Disable if it's the last enabled extruder. enabled: !checked || Cura.MachineManager.numberExtrudersEnabled > 1 //Disable if it's the last enabled extruder.
height: parent.height height: parent.height
style: UM.Theme.styles.checkbox
Binding Binding
{ {

View file

@ -5,7 +5,7 @@ import QtQuick 2.7
import QtQuick.Controls 1.4 import QtQuick.Controls 1.4
import QtQuick.Controls.Styles 1.4 import QtQuick.Controls.Styles 1.4
import UM 1.2 as UM import UM 1.5 as UM
import Cura 1.0 as Cura import Cura 1.0 as Cura
@ -44,7 +44,7 @@ Item
verticalCenter: enableAdhesionRowTitle.verticalCenter verticalCenter: enableAdhesionRowTitle.verticalCenter
} }
CheckBox UM.CheckBox
{ {
id: enableAdhesionCheckBox id: enableAdhesionCheckBox
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
@ -52,7 +52,6 @@ Item
property alias _hovered: adhesionMouseArea.containsMouse property alias _hovered: adhesionMouseArea.containsMouse
//: Setting enable printing build-plate adhesion helper checkbox //: Setting enable printing build-plate adhesion helper checkbox
style: UM.Theme.styles.checkbox
enabled: recommendedPrintSetup.settingsEnabled enabled: recommendedPrintSetup.settingsEnabled
visible: platformAdhesionType.properties.enabled == "True" visible: platformAdhesionType.properties.enabled == "True"

View file

@ -5,7 +5,7 @@ import QtQuick 2.7
import QtQuick.Controls 1.4 import QtQuick.Controls 1.4
import QtQuick.Controls.Styles 1.4 import QtQuick.Controls.Styles 1.4
import UM 1.2 as UM import UM 1.5 as UM
import Cura 1.0 as Cura import Cura 1.0 as Cura
@ -184,7 +184,7 @@ Item
} }
// Gradual Support Infill Checkbox // Gradual Support Infill Checkbox
CheckBox UM.CheckBox
{ {
id: enableGradualInfillCheckBox id: enableGradualInfillCheckBox
property alias _hovered: enableGradualInfillMouseArea.containsMouse property alias _hovered: enableGradualInfillMouseArea.containsMouse
@ -194,7 +194,6 @@ Item
anchors.left: infillSliderContainer.left anchors.left: infillSliderContainer.left
text: catalog.i18nc("@label", "Gradual infill") text: catalog.i18nc("@label", "Gradual infill")
style: UM.Theme.styles.checkbox
enabled: recommendedPrintSetup.settingsEnabled enabled: recommendedPrintSetup.settingsEnabled
visible: infillSteps.properties.enabled == "True" visible: infillSteps.properties.enabled == "True"
checked: parseInt(infillSteps.properties.value) > 0 checked: parseInt(infillSteps.properties.value) > 0

View file

@ -6,7 +6,7 @@ import QtQuick.Controls 1.4
import QtQuick.Controls.Styles 1.4 import QtQuick.Controls.Styles 1.4
import QtQuick.Controls 2.3 as Controls2 import QtQuick.Controls 2.3 as Controls2
import UM 1.2 as UM import UM 1.5 as UM
import Cura 1.0 as Cura import Cura 1.0 as Cura
@ -45,14 +45,13 @@ Item
verticalCenter: enableSupportRowTitle.verticalCenter verticalCenter: enableSupportRowTitle.verticalCenter
} }
CheckBox UM.CheckBox
{ {
id: enableSupportCheckBox id: enableSupportCheckBox
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
property alias _hovered: enableSupportMouseArea.containsMouse property alias _hovered: enableSupportMouseArea.containsMouse
style: UM.Theme.styles.checkbox
enabled: recommendedPrintSetup.settingsEnabled enabled: recommendedPrintSetup.settingsEnabled
visible: supportEnabled.properties.enabled == "True" visible: supportEnabled.properties.enabled == "True"

View file

@ -323,48 +323,6 @@ QtObject
} }
} }
property Component checkbox: Component
{
CheckBoxStyle
{
background: Item { }
indicator: Rectangle
{
implicitWidth: UM.Theme.getSize("checkbox").width
implicitHeight: UM.Theme.getSize("checkbox").height
color: (control.hovered || control._hovered) ? UM.Theme.getColor("checkbox_hover") : (control.enabled ? UM.Theme.getColor("checkbox") : UM.Theme.getColor("checkbox_disabled"))
Behavior on color { ColorAnimation { duration: 50; } }
radius: control.exclusiveGroup ? Math.round(UM.Theme.getSize("checkbox").width / 2) : UM.Theme.getSize("checkbox_radius").width
border.width: UM.Theme.getSize("default_lining").width
border.color: (control.hovered || control._hovered) ? UM.Theme.getColor("checkbox_border_hover") : UM.Theme.getColor("checkbox_border")
UM.RecolorImage
{
anchors.verticalCenter: parent.verticalCenter
anchors.horizontalCenter: parent.horizontalCenter
width: Math.round(parent.width / 2.5)
height: Math.round(parent.height / 2.5)
sourceSize.height: width
color: UM.Theme.getColor("checkbox_mark")
source: control.exclusiveGroup ? UM.Theme.getIcon("Dot") : UM.Theme.getIcon("Check")
opacity: control.checked
Behavior on opacity { NumberAnimation { duration: 100; } }
}
}
label: Label
{
text: control.text
color: UM.Theme.getColor("checkbox_text")
font: UM.Theme.getFont("default")
elide: Text.ElideRight
renderType: Text.NativeRendering
}
}
}
property Component partially_checkbox: Component property Component partially_checkbox: Component
{ {
CheckBoxStyle CheckBoxStyle