summaryrefslogtreecommitdiffstats
path: root/demos/declarative/samegame/content/Button.qml
blob: 235421862d3fd6938214bc21d2f41b758be81cc2 (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
import Qt 4.6

Rectangle {
    id: Container

    signal clicked
    property string text: "Button"

    color: activePalette.button; smooth: true
    width: txtItem.width + 20; height: txtItem.height + 6
    border.width: 1; border.color: activePalette.darker(activePalette.button); radius: 8;

    gradient: Gradient {
        GradientStop {
            id: topGrad; position: 0.0
            color: if (mr.pressed) { activePalette.dark } else { activePalette.light } }
        GradientStop { position: 1.0; color: activePalette.button }
    }

    MouseRegion { id: mr; anchors.fill: parent; onClicked: Container.clicked() }

    Text {
        id: txtItem; text: Container.text; anchors.centerIn: Container; color: activePalette.buttonText
    }
}