retro-imager/qmlcomponents/ImButton.qml
Floris Bos c1234d2ea2 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.
2022-02-04 12:32:12 +01:00

18 lines
445 B
QML

/*
* SPDX-License-Identifier: Apache-2.0
* Copyright (C) 2022 Raspberry Pi Ltd
*/
import QtQuick 2.9
import QtQuick.Controls 2.2
import QtQuick.Layouts 1.0
import QtQuick.Controls.Material 2.2
Button {
font.family: roboto.name
Material.background: activeFocus ? "#d1dcfb" : "#ffffff"
Material.foreground: "#c51a4a"
Accessible.onPressAction: clicked()
Keys.onEnterPressed: clicked()
Keys.onReturnPressed: clicked()
}