summaryrefslogtreecommitdiffstats
path: root/demos/declarative/samegame/samegame.qml
diff options
context:
space:
mode:
Diffstat (limited to 'demos/declarative/samegame/samegame.qml')
-rw-r--r--demos/declarative/samegame/samegame.qml20
1 files changed, 15 insertions, 5 deletions
diff --git a/demos/declarative/samegame/samegame.qml b/demos/declarative/samegame/samegame.qml
index 626c76b..50f6293 100644
--- a/demos/declarative/samegame/samegame.qml
+++ b/demos/declarative/samegame/samegame.qml
@@ -28,7 +28,7 @@ Rectangle {
width: parent.width - (parent.width % getTileSize());
height: parent.height - (parent.height % getTileSize());
- MouseRegion {
+ MouseArea {
id: gameMR
anchors.fill: parent; onClicked: handleClick(mouse.x,mouse.y);
}
@@ -38,20 +38,30 @@ Rectangle {
Dialog { id: dialog; anchors.centerIn: parent; z: 21 }
Dialog {
id: scoreName; anchors.centerIn: parent; z: 22;
+ property int initialWidth: 0
+ width: Behavior{NumberAnimation{} enabled: initialWidth!=0}
Text {
id: spacer
- opacity: 0
- text: " You won! Please enter your name:"
+ anchors.left: scoreName.left
+ anchors.leftMargin: 20
+ anchors.verticalCenter: parent.verticalCenter
+ text: "You won! Please enter your name: "
}
TextInput {
id: editor
+ onTextChanged: {
+ var newWidth = editor.width + spacer.width + 40;
+ if((newWidth > scoreName.width && newWidth < screen.width)
+ || (scoreName.width > scoreName.initialWidth))
+ scoreName.width = newWidth;
+ }
onAccepted: {
if(scoreName.opacity==1&&editor.text!="")
saveHighScore(editor.text);
scoreName.forceClose();
}
anchors.verticalCenter: parent.verticalCenter
- width: 72; focus: true
+ focus: true
anchors.left: spacer.right
}
}
@@ -79,7 +89,7 @@ Rectangle {
text: "Score: " + gameCanvas.score; font.bold: true
anchors.right: parent.right; anchors.rightMargin: 3
anchors.verticalCenter: parent.verticalCenter
- color: activePalette.text
+ color: activePalette.windowText
}
}
}