summaryrefslogtreecommitdiffstats
path: root/examples/declarative/tutorials/samegame/samegame4/content/Dialog.qml
diff options
context:
space:
mode:
Diffstat (limited to 'examples/declarative/tutorials/samegame/samegame4/content/Dialog.qml')
-rw-r--r--examples/declarative/tutorials/samegame/samegame4/content/Dialog.qml12
1 files changed, 10 insertions, 2 deletions
diff --git a/examples/declarative/tutorials/samegame/samegame4/content/Dialog.qml b/examples/declarative/tutorials/samegame/samegame4/content/Dialog.qml
index d235d3584a..c216c088e6 100644
--- a/examples/declarative/tutorials/samegame/samegame4/content/Dialog.qml
+++ b/examples/declarative/tutorials/samegame/samegame4/content/Dialog.qml
@@ -58,10 +58,12 @@ Rectangle {
function showWithInput(text) {
show(text);
textInput.opacity = 1;
+ textInput.focus = true;
textInput.text = ""
}
function hide() {
+ textInput.focus = false;
container.opacity = 0;
container.closed();
}
@@ -70,6 +72,7 @@ Rectangle {
width: dialogText.width + textInput.width + 20
height: dialogText.height + 20
opacity: 0
+ visible: opacity > 0
Text {
id: dialogText
@@ -82,7 +85,6 @@ Rectangle {
id: textInput
anchors { verticalCenter: parent.verticalCenter; left: dialogText.right }
width: 80
- focus: true
text: ""
onAccepted: container.hide() // close dialog when Enter is pressed
@@ -91,7 +93,13 @@ Rectangle {
MouseArea {
anchors.fill: parent
- onClicked: hide();
+
+ onClicked: {
+ if (textInput.text == "" && textInput.opacity > 0)
+ textInput.openSoftwareInputPanel();
+ else
+ hide();
+ }
}
//![3]