From e473d7a4e95ed749a23da045d44dc2339694dbbc Mon Sep 17 00:00:00 2001 From: Arjen Hiemstra Date: Tue, 14 Jun 2016 17:28:40 +0200 Subject: [PATCH] Ensure the control has active focus when clicking a SettingItem This way we ensure that things update properly when for example changing infill pattern. Fixes CURA-1494 --- resources/qml/Settings/SettingCategory.qml | 14 +++++++++----- resources/qml/Settings/SettingCheckBox.qml | 2 +- resources/qml/Settings/SettingComboBox.qml | 2 +- resources/qml/Settings/SettingExtruder.qml | 2 +- 4 files changed, 12 insertions(+), 8 deletions(-) diff --git a/resources/qml/Settings/SettingCategory.qml b/resources/qml/Settings/SettingCategory.qml index 6e23158a1c..83bd7f1f82 100644 --- a/resources/qml/Settings/SettingCategory.qml +++ b/resources/qml/Settings/SettingCategory.qml @@ -24,9 +24,10 @@ Button { checkable: true checked: definition.expanded - onClicked: definition.expanded ? settingDefinitionsModel.collapse(definition.key) : settingDefinitionsModel.expandAll(definition.key) + onClicked: { forceActiveFocus(); definition.expanded ? settingDefinitionsModel.collapse(definition.key) : settingDefinitionsModel.expandAll(definition.key) } - UM.SimpleButton { + UM.SimpleButton + { id: settingsButton visible: base.hovered || settingsButton.hovered @@ -60,7 +61,8 @@ Button { height: parent.height / 2 width: height - onClicked: { + onClicked: + { base.showAllHiddenInheritedSettings() } @@ -68,11 +70,13 @@ Button { hoverColor: UM.Theme.getColor("setting_control_button_hover") iconSource: UM.Theme.getIcon("notice") - onEntered: { + onEntered: + { base.showTooltip(catalog.i18nc("@label","Some hidden settings use values different from their normal calculated value.\n\nClick to make these settings visible.")) } - onExited: { + onExited: + { base.hideTooltip(); } diff --git a/resources/qml/Settings/SettingCheckBox.qml b/resources/qml/Settings/SettingCheckBox.qml index 1d66e509d0..9b50c82395 100644 --- a/resources/qml/Settings/SettingCheckBox.qml +++ b/resources/qml/Settings/SettingCheckBox.qml @@ -31,7 +31,7 @@ SettingItem } } - onClicked: propertyProvider.setPropertyValue("value", !checked) + onClicked: { forceActiveFocus(); propertyProvider.setPropertyValue("value", !checked) } Rectangle { diff --git a/resources/qml/Settings/SettingComboBox.qml b/resources/qml/Settings/SettingComboBox.qml index c9f3cb727b..5308e45f5a 100644 --- a/resources/qml/Settings/SettingComboBox.qml +++ b/resources/qml/Settings/SettingComboBox.qml @@ -86,7 +86,7 @@ SettingItem } } - onActivated: provider.setPropertyValue("value", definition.options[index].key) + onActivated: { forceActiveFocus(); provider.setPropertyValue("value", definition.options[index].key) } onModelChanged: updateCurrentIndex(); Connections diff --git a/resources/qml/Settings/SettingExtruder.qml b/resources/qml/Settings/SettingExtruder.qml index 8acd75c88e..5800a0943e 100644 --- a/resources/qml/Settings/SettingExtruder.qml +++ b/resources/qml/Settings/SettingExtruder.qml @@ -102,7 +102,7 @@ SettingItem } } - onActivated: provider.setPropertyValue("value", extruders_model.getItem(index).index); + onActivated: { forceActiveFocus(); provider.setPropertyValue("value", extruders_model.getItem(index).index) }; onModelChanged: updateCurrentIndex(); Connections