Improve member list highlighted item behavior

- When focusing the "Filter members" field, highlight the first item if
  none already is

- When pressing esc in the field, clear any highlight
This commit is contained in:
miruka 2020-07-09 21:55:28 -04:00
parent 08f15b6a01
commit affd0d0bd3
2 changed files with 11 additions and 0 deletions

View File

@ -1,5 +1,7 @@
# TODO # TODO
- event menu key right click
- composer menu?
- fix members not synced bug - fix members not synced bug
- fix local unread counters order - fix local unread counters order
- fix highlight when logging in to new account - fix highlight when logging in to new account

View File

@ -84,10 +84,19 @@ HColumnLayout {
py.callCoro("set_substring_filter", [modelSyncId, text]) py.callCoro("set_substring_filter", [modelSyncId, text])
} }
onFocusChanged: if (
focus &&
stackView.depth === 1 &&
stackView.currentItem.currentIndex === -1
) stackView.currentItem.currentIndex = 0
Keys.forwardTo: [stackView.currentItem] Keys.forwardTo: [stackView.currentItem]
Keys.priority: Keys.AfterItem Keys.priority: Keys.AfterItem
Keys.onEscapePressed: { Keys.onEscapePressed: {
if (stackView.depth === 1)
stackView.currentItem.currentIndex = -1
roomPane.toggleFocus() roomPane.toggleFocus()
if (window.settings.clearMemberFilterOnEscape) text = "" if (window.settings.clearMemberFilterOnEscape) text = ""
} }