This repository has been archived on 2021-06-24. You can view files and clone it, but cannot push or open issues or pull requests.
ui/qml/widgets/SimpleButton.qml

44 lines
974 B
QML
Raw Normal View History

2018-10-23 18:52:13 +00:00
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()
}