diff options
Diffstat (limited to 'examples/declarative/tic-tac-toe')
-rw-r--r-- | examples/declarative/tic-tac-toe/content/Button.qml | 22 | ||||
-rw-r--r-- | examples/declarative/tic-tac-toe/tic-tac-toe.qml | 21 |
2 files changed, 23 insertions, 20 deletions
diff --git a/examples/declarative/tic-tac-toe/content/Button.qml b/examples/declarative/tic-tac-toe/content/Button.qml index 05d3f8d..56e5ecd 100644 --- a/examples/declarative/tic-tac-toe/content/Button.qml +++ b/examples/declarative/tic-tac-toe/content/Button.qml @@ -3,33 +3,37 @@ import Qt 4.7 Rectangle { id: container - signal clicked property string text: "Button" property bool down: false property string mainCol: "lightgray" property string darkCol: "darkgray" property string lightCol: "white" - color: mainCol; smooth: true width: txtItem.width + 20; height: txtItem.height + 6 - border.width: 1; border.color: Qt.darker(mainCol); radius: 8; + border { width: 1; color: Qt.darker(mainCol) } + radius: 8; + color: mainCol + smooth: true gradient: Gradient { GradientStop { id: topGrad; position: 0.0 - color: if (container.down) { darkCol } else { lightCol } } + color: if (container.down) { darkCol } else { lightCol } + } GradientStop { position: 1.0; color: mainCol } } + signal clicked + MouseArea { id: mr; anchors.fill: parent; onClicked: container.clicked() } Text { - id: txtItem; text: container.text; + id: txtItem + anchors.centerIn: container + text: container.text; color: "blue" - styleColor: "white" - style: Text.Outline - font.pixelSize: 14 - font.bold: true + style: Text.Outline; styleColor: "white" + font.pixelSize: 14; font.bold: true } } diff --git a/examples/declarative/tic-tac-toe/tic-tac-toe.qml b/examples/declarative/tic-tac-toe/tic-tac-toe.qml index ca66a46..62bb56f 100644 --- a/examples/declarative/tic-tac-toe/tic-tac-toe.qml +++ b/examples/declarative/tic-tac-toe/tic-tac-toe.qml @@ -4,23 +4,23 @@ import "content/tic-tac-toe.js" as Logic Item { id: game + property bool show: false; + property real difficulty: 1.0; //chance it will actually think + width: 440 height: 480 anchors.fill: parent - property real difficulty: 1.0; //chance it will actually think Image { id: boardimage - anchors.verticalCenter: parent.verticalCenter - anchors.horizontalCenter: parent.horizontalCenter + anchors { verticalCenter: parent.verticalCenter; horizontalCenter: parent.horizontalCenter } source: "content/pics/board.png" } Grid { id: board anchors.fill: boardimage - columns: 3 Repeater { @@ -46,8 +46,8 @@ Item { Row { spacing: 4 - anchors.top: board.bottom - anchors.horizontalCenter: board.horizontalCenter + anchors { top: board.bottom; horizontalCenter: board.horizontalCenter } + Button { text: "Hard" onClicked: game.difficulty=1.0; @@ -67,12 +67,11 @@ Item { Text { id: msg - opacity: 0 + anchors.centerIn: parent + opacity: 0 color: "blue" - styleColor: "white" - style: Text.Outline - font.pixelSize: 50 - font.bold: true + style: Text.Outline; styleColor: "white" + font.pixelSize: 50; font.bold: true } } |