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, 16 insertions, 4 deletions
diff --git a/demos/declarative/samegame/samegame.qml b/demos/declarative/samegame/samegame.qml
index 54c18d6..9a721da 100644
--- a/demos/declarative/samegame/samegame.qml
+++ b/demos/declarative/samegame/samegame.qml
@@ -90,17 +90,31 @@ Rectangle {
enabled: initialWidth != 0
}
+ onOpened: nameInputText.focus = true;
+ onClosed: {
+ nameInputText.focus = false;
+ if (nameInputText.text != "")
+ Logic.saveHighScore(nameInputText.text);
+ }
Text {
id: dialogText
anchors { left: nameInputDialog.left; leftMargin: 20; verticalCenter: parent.verticalCenter }
text: "You won! Please enter your name: "
}
+ MouseArea {
+ anchors.fill: parent
+ onClicked: {
+ if (nameInputText.text == "")
+ nameInputText.openSoftwareInputPanel();
+ else
+ nameInputDialog.forceClose();
+ }
+ }
TextInput {
id: nameInputText
anchors { verticalCenter: parent.verticalCenter; left: dialogText.right }
- focus: true
-
+ focus: false
onTextChanged: {
var newWidth = nameInputText.width + dialogText.width + 40;
if ( (newWidth > nameInputDialog.width && newWidth < screen.width)
@@ -108,8 +122,6 @@ Rectangle {
nameInputDialog.width = newWidth;
}
onAccepted: {
- if (nameInputDialog.opacity == 1 && nameInputText.text != "")
- Logic.saveHighScore(nameInputText.text);
nameInputDialog.forceClose();
}
}