Join/LeftBanner: auto keyboard-focus first button

This commit is contained in:
miruka 2020-08-28 07:40:48 -04:00
parent 78acb51220
commit 6d26ac9006
2 changed files with 8 additions and 0 deletions

View File

@ -17,6 +17,7 @@
- General change/upload avatar component for account and room settings
- Refactor EventList.qml
- Refactor `InviteBanner`/`LeftBanner`
- Implement different delegate for different types of events in QML, instead
of having only one doing everything with untranslatable content texts
from Python

View File

@ -76,12 +76,19 @@ Rectangle {
HButton {
id: button
readonly property bool shouldFocus:
banner.visible && model.index === 0
text: modelData.text
icon.name: modelData.iconName
icon.color: modelData.iconColor || theme.icons.colorize
onClicked: buttonCallbacks[modelData.name](button)
Layout.preferredHeight: theme.baseElementsHeight
onShouldFocusChanged:
if (shouldFocus) forceActiveFocus()
}
}
}