justcheckers/MenuButton.qml

52 lines
1.1 KiB
QML
Raw Normal View History

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
2018-02-22 08:03:26 -05:00
height: parent.parent.height * 0.1
radius: 10
color: backgroundAtRest
border.color: "#333333"
border.width: 2
2018-02-16 19:51:45 -05:00
antialiasing: true
layer.enabled: true
layer.effect: DropShadow {
transparentBorder: true
horizontalOffset: 5
verticalOffset: 5
radius: 5.0
samples: 5
}
Text {
text: buttonText
2018-02-22 08:03:26 -05:00
font.pointSize: parent.height * 0.2
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()
}
}