summaryrefslogtreecommitdiffstats
path: root/examples/declarative/dynamic/qml/Button.qml
blob: 2769cd83a97c9630ed911401fac3fcabd1eebeee (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
import Qt 4.6

Rectangle {
    id: container

    property var text
    signal clicked

    SystemPalette { id: activePalette; colorGroup: Qt.Active }
    height: text.height + 10
    width: text.width + 20
    border.width: 1
    radius: 4; smooth: true
    gradient: Gradient {
        GradientStop { position: 0.0; 
            color: if(!mr.pressed){activePalette.light;}else{activePalette.button;}
        }
        GradientStop { position: 1.0;
            color: if(!mr.pressed){activePalette.button;}else{activePalette.dark;}
        }
    }
    MouseRegion { id:mr; anchors.fill: parent; onClicked: container.clicked() }
    Text { id: text; anchors.centerIn:parent; font.pointSize: 10; text: parent.text; color: activePalette.buttonText }
}