summaryrefslogtreecommitdiffstats
path: root/examples/declarative/dynamic/Button.qml
blob: 0b8b6dba3c1b817f40210523e3d1200787188e9d (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
    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 }
}