2018-09-23 22:16:27 +00:00
|
|
|
import QtQuick 2.0
|
|
|
|
import QtQuick.Controls 2.2
|
2021-12-03 09:24:31 +00:00
|
|
|
import QtQuick.Layouts 1.3
|
2018-09-23 22:16:27 +00:00
|
|
|
|
2021-12-03 09:16:51 +00:00
|
|
|
ToolButton {
|
2019-04-25 03:22:39 +00:00
|
|
|
property string iconSource
|
|
|
|
|
2018-09-23 22:16:27 +00:00
|
|
|
activeFocusOnTab: true
|
|
|
|
|
2019-04-25 03:22:39 +00:00
|
|
|
// FIXME: We're using an Image here rather than icon.source because
|
|
|
|
// icons don't work on Qt 5.9 LTS.
|
|
|
|
Image {
|
|
|
|
id: image
|
|
|
|
source: iconSource
|
|
|
|
anchors.centerIn: parent.background
|
|
|
|
sourceSize {
|
2021-12-03 09:16:51 +00:00
|
|
|
width: parent.background.width * 1.10
|
|
|
|
height: parent.background.height * 1.10
|
2019-04-25 03:22:39 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// This determines the size of the Material highlight. We increase it
|
|
|
|
// from the default because we use larger than normal icons for TV readability.
|
2021-12-03 09:24:31 +00:00
|
|
|
Layout.preferredHeight: parent.height
|
2019-04-25 03:22:39 +00:00
|
|
|
|
2018-09-23 22:16:27 +00:00
|
|
|
Keys.onReturnPressed: {
|
|
|
|
clicked()
|
|
|
|
}
|
|
|
|
|
2021-02-27 23:01:22 +00:00
|
|
|
Keys.onEnterPressed: {
|
|
|
|
clicked()
|
|
|
|
}
|
|
|
|
|
2018-09-23 22:16:27 +00:00
|
|
|
Keys.onRightPressed: {
|
|
|
|
nextItemInFocusChain(true).forceActiveFocus(Qt.TabFocus)
|
|
|
|
}
|
|
|
|
|
|
|
|
Keys.onLeftPressed: {
|
|
|
|
nextItemInFocusChain(false).forceActiveFocus(Qt.TabFocus)
|
|
|
|
}
|
|
|
|
}
|