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
This commit is contained in:
Arjen Hiemstra 2016-06-14 17:28:40 +02:00
parent eb836bfc3f
commit e473d7a4e9
4 changed files with 12 additions and 8 deletions

View file

@ -24,9 +24,10 @@ Button {
checkable: true checkable: true
checked: definition.expanded 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 id: settingsButton
visible: base.hovered || settingsButton.hovered visible: base.hovered || settingsButton.hovered
@ -60,7 +61,8 @@ Button {
height: parent.height / 2 height: parent.height / 2
width: height width: height
onClicked: { onClicked:
{
base.showAllHiddenInheritedSettings() base.showAllHiddenInheritedSettings()
} }
@ -68,11 +70,13 @@ Button {
hoverColor: UM.Theme.getColor("setting_control_button_hover") hoverColor: UM.Theme.getColor("setting_control_button_hover")
iconSource: UM.Theme.getIcon("notice") 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.")) 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(); base.hideTooltip();
} }

View file

@ -31,7 +31,7 @@ SettingItem
} }
} }
onClicked: propertyProvider.setPropertyValue("value", !checked) onClicked: { forceActiveFocus(); propertyProvider.setPropertyValue("value", !checked) }
Rectangle Rectangle
{ {

View file

@ -86,7 +86,7 @@ SettingItem
} }
} }
onActivated: provider.setPropertyValue("value", definition.options[index].key) onActivated: { forceActiveFocus(); provider.setPropertyValue("value", definition.options[index].key) }
onModelChanged: updateCurrentIndex(); onModelChanged: updateCurrentIndex();
Connections Connections

View file

@ -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(); onModelChanged: updateCurrentIndex();
Connections Connections