justcheckers/MenuButton.qml

52 lines
1.1 KiB
QML

import QtQuick 2.0
import QtGraphicalEffects 1.0
Rectangle {
id: button
property color backgroundAtRest: "#9e9e9e"
property color backgroundActive: "#555555"
property string buttonText: "Button"
function actionOnClick() { }
anchors.horizontalCenter: parent.horizontalCenter
width: parent.width - 50
height: 50
radius: 10
color: backgroundAtRest
border.color: "#333333"
border.width: 2
antialiasing: true
layer.enabled: true
layer.effect: DropShadow {
transparentBorder: true
horizontalOffset: 5
verticalOffset: 5
radius: 5.0
samples: 5
}
Text {
text: buttonText
font.pointSize: 18
font.bold: true
height: 30
anchors.horizontalCenter: parent.horizontalCenter
anchors.verticalCenter: parent.verticalCenter
}
MouseArea {
anchors.fill: parent
onPressed: button.color = backgroundActive
onReleased: button.color = backgroundAtRest
onClicked: actionOnClick()
}
}