StandardButton: indicating "focused" state

This commit is contained in:
Ilya Kitaev 2016-11-02 16:25:26 +03:00
parent 7973d0cbcc
commit 513f7ebc3a

View File

@ -41,6 +41,7 @@ Item {
property alias text: label.text property alias text: label.text
signal clicked() signal clicked()
Rectangle { Rectangle {
anchors.left: parent.left anchors.left: parent.left
anchors.right: parent.right anchors.right: parent.right
@ -51,6 +52,9 @@ Item {
parent.enabled ? (buttonArea.pressed ? parent.shadowPressedColor : parent.shadowReleasedColor) parent.enabled ? (buttonArea.pressed ? parent.shadowPressedColor : parent.shadowReleasedColor)
: Qt.lighter(parent.shadowReleasedColor) : Qt.lighter(parent.shadowReleasedColor)
} }
border.color: Qt.darker(parent.releasedColor)
border.width: parent.focus ? 1 : 0
} }
Rectangle { Rectangle {
@ -64,6 +68,8 @@ Item {
} }
//radius: 4 //radius: 4
} }
Text { Text {
@ -92,4 +98,7 @@ Item {
anchors.fill: parent anchors.fill: parent
onClicked: parent.clicked() onClicked: parent.clicked()
} }
Keys.onSpacePressed: clicked()
Keys.onReturnPressed: clicked()
} }