summaryrefslogtreecommitdiffstats
path: root/examples/declarative/dynamic/qml/Button.qml
blob: 757e2957a99b7de09b17123204df5622d92704e6 (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 }
    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;}
        }
    }
    MouseArea { id:mr; anchors.fill: parent; onClicked: container.clicked() }
    Text { id: text; anchors.centerIn:parent; font.pointSize: 10; text: parent.text; color: activePalette.buttonText }
}