diff options
Diffstat (limited to 'examples/declarative/tutorials/samegame/samegame1/Button.qml')
-rw-r--r-- | examples/declarative/tutorials/samegame/samegame1/Button.qml | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/examples/declarative/tutorials/samegame/samegame1/Button.qml b/examples/declarative/tutorials/samegame/samegame1/Button.qml index 8ad7c0f..e8034ac 100644 --- a/examples/declarative/tutorials/samegame/samegame1/Button.qml +++ b/examples/declarative/tutorials/samegame/samegame1/Button.qml @@ -4,25 +4,31 @@ import Qt 4.7 Rectangle { id: container - signal clicked property string text: "Button" - color: activePalette.button; smooth: true + signal clicked + width: buttonLabel.width + 20; height: buttonLabel.height + 6 - border.width: 1; border.color: Qt.darker(activePalette.button); radius: 8; + smooth: true + border { width: 1; color: Qt.darker(activePalette.button) } + radius: 8 + // color the button with a gradient gradient: Gradient { GradientStop { position: 0.0 - color: if (mouseArea.pressed) { activePalette.dark } else { activePalette.light } + color: { + if (mouseArea.pressed) + return activePalette.dark + else + return activePalette.light + } } GradientStop { position: 1.0; color: activePalette.button } } MouseArea { id: mouseArea; anchors.fill: parent; onClicked: container.clicked() } - Text { - id: buttonLabel; text: container.text; anchors.centerIn: container; color: activePalette.buttonText - } + Text { id: buttonLabel; text: container.text; anchors.centerIn: container; color: activePalette.buttonText } } //![0] |