diff options
author | Joona Petrell <joona.t.petrell@nokia.com> | 2010-06-03 06:27:47 (GMT) |
---|---|---|
committer | Joona Petrell <joona.t.petrell@nokia.com> | 2010-06-03 06:53:11 (GMT) |
commit | 939375996496a55a1bb424d6a328f47d2224ed51 (patch) | |
tree | e196085fb599e38fe6a19491500c33f8b9119a8c /examples/declarative/tutorials/samegame/samegame4 | |
parent | 26d65a844b20a0056820c15188532b3895a3e091 (diff) | |
download | Qt-939375996496a55a1bb424d6a328f47d2224ed51.zip Qt-939375996496a55a1bb424d6a328f47d2224ed51.tar.gz Qt-939375996496a55a1bb424d6a328f47d2224ed51.tar.bz2 |
Improve input panel handling in declarative demos and examples
Task-number: QTBUG-11157
Reviewed-by: Warwick Allison
Diffstat (limited to 'examples/declarative/tutorials/samegame/samegame4')
-rw-r--r-- | examples/declarative/tutorials/samegame/samegame4/content/Dialog.qml | 12 |
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 d235d35..c216c08 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] |