44 lines
974 B
QML
44 lines
974 B
QML
|
import QtQuick 2.0
|
||
|
|
||
|
Rectangle {
|
||
|
id: button
|
||
|
Accessible.name: text // TODO: copied this accessibility stuff from an example but damn it's awesome, let's add this everywhere!!!
|
||
|
Accessible.description: "This button " + text + "s"
|
||
|
Accessible.role: Accessible.Button
|
||
|
Accessible.onPressAction: {
|
||
|
button.clicked()
|
||
|
}
|
||
|
width: buttonText.width + 20
|
||
|
height: 20
|
||
|
color: "#DDDDDD"
|
||
|
border.color: focus ? "#BBBBBB" : "#AAAAAA"
|
||
|
border.width: 1
|
||
|
radius: 2
|
||
|
antialiasing: true
|
||
|
|
||
|
property bool checked: false
|
||
|
property alias text: buttonText.text
|
||
|
signal clicked
|
||
|
|
||
|
|
||
|
|
||
|
Text {
|
||
|
id: buttonText
|
||
|
text: parent.description
|
||
|
anchors.centerIn: parent
|
||
|
font.pixelSize: parent.height * .5
|
||
|
color: "#404040"
|
||
|
}
|
||
|
|
||
|
|
||
|
MouseArea {
|
||
|
id: mouseArea
|
||
|
anchors.fill: parent
|
||
|
onClicked: {
|
||
|
parent.focus = true
|
||
|
parent.clicked()
|
||
|
}
|
||
|
}
|
||
|
|
||
|
Keys.onSpacePressed: clicked()
|
||
|
}
|