summaryrefslogtreecommitdiffstats
path: root/QtDemo/qml/QtDemo/DialogButton.qml
blob: b201786d599f549e85021a1b542b91cdcf265650 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import QtQuick 2.0

Rectangle {
    id: button
    radius: 10
    height: 0.3 * dialog.height
    width: dialog.width * 0.5 - dialog.dialogMargin
    color: "transparent"

    property string buttonText
    signal clicked()

    Text {
        anchors.centerIn: parent
        text: button.buttonText
        font.pixelSize: 0.4 * button.height
        color: "#ffffff"
    }

    MouseArea {
        anchors.fill: parent
        onPressed: parent.color = Qt.rgba(0.2, 0.2, 0.2, 0.4)
        onReleased: parent.color = "transparent"
        onClicked: button.clicked()
    }
}