Scroll setting with active focus into view

This commit is contained in:
fieldOfView 2017-06-26 13:00:59 +02:00
parent b324e90ba5
commit edee53b0b1
8 changed files with 73 additions and 6 deletions

View file

@ -14,10 +14,11 @@ Button {
style: UM.Theme.styles.sidebar_category;
signal showTooltip(string text);
signal hideTooltip();
signal showTooltip(string text)
signal hideTooltip()
signal contextMenuRequested()
signal showAllHiddenInheritedSettings(string category_id)
signal focusReceived()
text: definition.label
iconSource: UM.Theme.getIcon(definition.icon)
@ -25,7 +26,24 @@ Button {
checkable: true
checked: definition.expanded
onClicked: { forceActiveFocus(); definition.expanded ? settingDefinitionsModel.collapse(definition.key) : settingDefinitionsModel.expandAll(definition.key) }
onClicked:
{
forceActiveFocus();
if(definition.expanded)
{
settingDefinitionsModel.collapse(definition.key);
} else {
settingDefinitionsModel.expandAll(definition.key);
}
}
onActiveFocusChanged:
{
if(activeFocus)
{
base.focusReceived();
}
}
UM.SimpleButton
{
id: settingsButton

View file

@ -62,6 +62,14 @@ SettingItem
propertyProvider.setPropertyValue("value", !checked);
}
onActiveFocusChanged:
{
if(activeFocus)
{
base.focusReceived();
}
}
Rectangle
{
anchors

View file

@ -94,7 +94,19 @@ SettingItem
}
}
onActivated: { forceActiveFocus(); propertyProvider.setPropertyValue("value", definition.options[index].key) }
onActivated:
{
forceActiveFocus();
propertyProvider.setPropertyValue("value", definition.options[index].key);
}
onActiveFocusChanged:
{
if(activeFocus)
{
base.focusReceived();
}
}
Binding
{

View file

@ -27,6 +27,14 @@ SettingItem
propertyProvider.setPropertyValue("value", model.getItem(index).index);
}
onActiveFocusChanged:
{
if(activeFocus)
{
base.focusReceived();
}
}
currentIndex: propertyProvider.properties.value
MouseArea

View file

@ -32,9 +32,10 @@ Item {
property var stackLevels: propertyProvider.stackLevels
property var stackLevel: stackLevels[0]
signal focusReceived()
signal contextMenuRequested()
signal showTooltip(string text);
signal hideTooltip();
signal showTooltip(string text)
signal hideTooltip()
signal showAllHiddenInheritedSettings(string category_id)
property string tooltipText:
{

View file

@ -31,6 +31,14 @@ SettingItem
propertyProvider.setPropertyValue("value", model.getItem(index).index);
}
onActiveFocusChanged:
{
if(activeFocus)
{
base.focusReceived();
}
}
Binding
{
target: control

View file

@ -105,6 +105,14 @@ SettingItem
propertyProvider.setPropertyValue("value", text)
}
onActiveFocusChanged:
{
if(activeFocus)
{
base.focusReceived();
}
}
color: !enabled ? UM.Theme.getColor("setting_control_disabled_text") : UM.Theme.getColor("setting_control_text")
font: UM.Theme.getFont("default");

View file

@ -298,6 +298,10 @@ Item
}
Cura.SettingInheritanceManager.manualRemoveOverride(category_id)
}
onFocusReceived:
{
contents.positionViewAtIndex(index, ListView.Contain);
}
}
}