Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import Qt 4.7
- BorderImage {
- id: buttonbase
- signal clicked
- property int hitboxExtension : 20
- property alias text : label.text
- property bool pressed: hitbox.pressed && hitbox.containsMouse
- source: pressed ? "button_down.png" : "button_up.png"
- border.left: 50;
- border.right: 50;
- MouseArea {
- id: hitbox
- anchors.fill: parent
- anchors.topMargin: -hitboxExtension
- anchors.bottomMargin: -hitboxExtension
- anchors.leftMargin: -hitboxExtension
- anchors.rightMargin: -hitboxExtension
- onClicked: { haptics.buttonClick(); parent.clicked() }
- onPressedChanged: { if (hitbox.pressed) haptics.buttonClick(); }
- }
- Text {
- id: label
- anchors.centerIn: parent
- anchors.verticalCenterOffset: pressed ? -2 : -3
- font.family: "Lato Black"
- font.pixelSize: 26
- color: "#ffffff"
- styleColor: "#4f000000"
- style: Text.Sunken
- }
- }
Add Comment
Please, Sign In to add comment