Make buttons blue on keyboard navigation

- Make buttons blue when they have activeFocus to make it more
  clear which button has focus when using keyboard navation.
- By default most components only respond to 'space' on keyboard
  for pressing buttons and toggling checkboxes.
  Map Enter/Return (normal and keypad) as well.
This commit is contained in:
Floris Bos 2022-02-04 12:32:12 +01:00
parent d91f8d95b1
commit c1234d2ea2
8 changed files with 99 additions and 79 deletions

View file

@ -7,6 +7,7 @@ import QtQuick 2.9
import QtQuick.Controls 2.2
import QtQuick.Layouts 1.0
import QtQuick.Controls.Material 2.2
import "qmlcomponents"
Popup {
id: msgpopup
@ -90,40 +91,34 @@ Popup {
Layout.bottomMargin: 10
spacing: 20
Button {
ImButton {
text: qsTr("NO, CLEAR SETTINGS")
onClicked: {
msgpopup.close()
msgpopup.no()
}
Material.foreground: "#ffffff"
Material.foreground: activeFocus ? "#d1dcfb" : "#ffffff"
Material.background: "#c51a4a"
font.family: roboto.name
Accessible.onPressAction: clicked()
}
Button {
ImButton {
text: qsTr("YES")
onClicked: {
msgpopup.close()
msgpopup.yes()
}
Material.foreground: "#ffffff"
Material.foreground: activeFocus ? "#d1dcfb" : "#ffffff"
Material.background: "#c51a4a"
font.family: roboto.name
Accessible.onPressAction: clicked()
}
Button {
ImButton {
text: qsTr("EDIT SETTINGS")
onClicked: {
msgpopup.close()
msgpopup.editSettings()
}
Material.foreground: "#ffffff"
Material.foreground: activeFocus ? "#d1dcfb" : "#ffffff"
Material.background: "#c51a4a"
font.family: roboto.name
Accessible.onPressAction: clicked()
}
Text { text: " " }