diff options
Diffstat (limited to 'examples/declarative/dynamic/qml/Button.qml')
-rw-r--r-- | examples/declarative/dynamic/qml/Button.qml | 36 |
1 files changed, 26 insertions, 10 deletions
diff --git a/examples/declarative/dynamic/qml/Button.qml b/examples/declarative/dynamic/qml/Button.qml index 53588bb..963a850 100644 --- a/examples/declarative/dynamic/qml/Button.qml +++ b/examples/declarative/dynamic/qml/Button.qml @@ -6,19 +6,35 @@ Rectangle { property variant text signal clicked - SystemPalette { id: activePalette } - height: text.height + 10 - width: text.width + 20 + height: text.height + 10; width: text.width + 20 border.width: 1 - radius: 4; smooth: true + radius: 4 + smooth: true + gradient: Gradient { - GradientStop { position: 0.0; - color: if(!mr.pressed){activePalette.light;}else{activePalette.button;} + GradientStop { + position: 0.0 + color: !mouseArea.pressed ? activePalette.light : activePalette.button } - GradientStop { position: 1.0; - color: if(!mr.pressed){activePalette.button;}else{activePalette.dark;} + GradientStop { + position: 1.0 + color: !mouseArea.pressed ? activePalette.button : 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 } + + SystemPalette { id: activePalette } + + MouseArea { + id: mouseArea + anchors.fill: parent + onClicked: container.clicked() + } + + Text { + id: text + anchors.centerIn:parent + font.pointSize: 10 + text: parent.text + color: activePalette.buttonText + } } |