mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-15 02:37:49 -06:00
Fix tab order after expanding categories or using search
This reimplements the behavior of pressing tab/backtab to force the correct order of items in the listview.
This commit is contained in:
parent
8917762ed5
commit
0f9cfa0304
8 changed files with 93 additions and 2 deletions
|
@ -168,6 +168,8 @@ Item
|
|||
onVisibilityChanged: Cura.SettingInheritanceManager.forceUpdate()
|
||||
}
|
||||
|
||||
property var indexWithFocus: -1
|
||||
|
||||
delegate: Loader
|
||||
{
|
||||
id: delegate
|
||||
|
@ -300,11 +302,39 @@ Item
|
|||
}
|
||||
onFocusReceived:
|
||||
{
|
||||
contents.indexWithFocus = index;
|
||||
animateContentY.from = contents.contentY;
|
||||
contents.positionViewAtIndex(index, ListView.Contain);
|
||||
animateContentY.to = contents.contentY;
|
||||
animateContentY.running = true;
|
||||
}
|
||||
onSetActiveFocusToNextSetting:
|
||||
{
|
||||
if(forward == undefined || forward)
|
||||
{
|
||||
contents.currentIndex = contents.indexWithFocus + 1;
|
||||
while(contents.currentItem && contents.currentItem.height <= 0)
|
||||
{
|
||||
contents.currentIndex++;
|
||||
}
|
||||
if(contents.currentItem)
|
||||
{
|
||||
contents.currentItem.item.focusItem.forceActiveFocus();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
contents.currentIndex = contents.indexWithFocus - 1;
|
||||
while(contents.currentItem && contents.currentItem.height <= 0)
|
||||
{
|
||||
contents.currentIndex--;
|
||||
}
|
||||
if(contents.currentItem)
|
||||
{
|
||||
contents.currentItem.item.focusItem.forceActiveFocus();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue