diff options
author | Bea Lam <bea.lam@nokia.com> | 2010-05-24 05:23:10 (GMT) |
---|---|---|
committer | Bea Lam <bea.lam@nokia.com> | 2010-05-24 05:23:10 (GMT) |
commit | 96f47aeec086b2d35b859194e42721dbc2d2db6a (patch) | |
tree | 44ac57db2cae87d4abdf119e5661410ea7a341b4 /examples/declarative/toys/tic-tac-toe/content/Button.qml | |
parent | 941b44c2e36eeafe1acd1be5fd1cb27151db99d2 (diff) | |
download | Qt-96f47aeec086b2d35b859194e42721dbc2d2db6a.zip Qt-96f47aeec086b2d35b859194e42721dbc2d2db6a.tar.gz Qt-96f47aeec086b2d35b859194e42721dbc2d2db6a.tar.bz2 |
Clean up and don't allow clicks on already filled places
Diffstat (limited to 'examples/declarative/toys/tic-tac-toe/content/Button.qml')
-rw-r--r-- | examples/declarative/toys/tic-tac-toe/content/Button.qml | 34 |
1 files changed, 18 insertions, 16 deletions
diff --git a/examples/declarative/toys/tic-tac-toe/content/Button.qml b/examples/declarative/toys/tic-tac-toe/content/Button.qml index 9b2dc8e..d0f387f 100644 --- a/examples/declarative/toys/tic-tac-toe/content/Button.qml +++ b/examples/declarative/toys/tic-tac-toe/content/Button.qml @@ -43,35 +43,37 @@ import Qt 4.7 Rectangle { id: container - property string text: "Button" - property bool down: false - property string mainCol: "lightgray" - property string darkCol: "darkgray" - property string lightCol: "white" + property string text + property bool pressed: false + + signal clicked width: buttonLabel.width + 20; height: buttonLabel.height + 6 - border { width: 1; color: Qt.darker(mainCol) } - radius: 8; - color: mainCol + border { width: 1; color: Qt.darker(container.color) } + radius: 8 + color: "lightgray" smooth: true gradient: Gradient { GradientStop { - id: topGrad; position: 0.0 - color: if (container.down) { darkCol } else { lightCol } + position: 0.0 + color: container.pressed ? "darkgray" : "white" + } + GradientStop { + position: 1.0 + color: container.color } - GradientStop { position: 1.0; color: mainCol } } - signal clicked - - MouseArea { id: mr; anchors.fill: parent; onClicked: container.clicked() } + MouseArea { + anchors.fill: parent + onClicked: container.clicked() + } Text { id: buttonLabel - anchors.centerIn: container - text: container.text; + text: container.text font.pixelSize: 14 } } |