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

@@ -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()
}
}
}