diff options
author | Richard Moe Gustavsen <richard.gustavsen@digia.com> | 2014-10-30 14:44:19 +0100 |
---|---|---|
committer | Richard Moe Gustavsen <richard.gustavsen@digia.com> | 2014-10-30 23:00:16 +0100 |
commit | a82fd289dfac02ddf371761efe3d38614539928d (patch) | |
tree | c8c1d235a8ce3dceda326b2f196559aad59c3f73 | |
parent | af73333285751daf822d4f27e2b2560400a7bc29 (diff) | |
download | qtquickcontrols-a82fd289dfac02ddf371761efe3d38614539928d.tar.gz |
EditMenu iOS: show edit menu upon pressnhold on empty input field
If you press and hold on an input field that doesn't have focus, we
select the word under the cursor, which will make the menu show.
But if the field is empty, no word can be selected, so therefore no
menu will show.
This patch will check for this special case, and show the menu if
you pressnhold on an empty input field.
Change-Id: I7d2c137765471cb1ff1dc4f7e34577e5e1317dc0
Reviewed-by: J-P Nurmi <jpnurmi@theqtcompany.com>
-rw-r--r-- | src/controls/Private/EditMenu_ios.qml | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/controls/Private/EditMenu_ios.qml b/src/controls/Private/EditMenu_ios.qml index d2a6c8c0..253dbbaa 100644 --- a/src/controls/Private/EditMenu_ios.qml +++ b/src/controls/Private/EditMenu_ios.qml @@ -114,7 +114,8 @@ Item { onPressAndHold: { var pos = input.positionAt(mouseArea.mouseX, mouseArea.mouseY); input.select(pos, pos); - if (!control.menu || !input.activeFocus || (selectionStart != selectionEnd)) { + var hasSelection = selectionStart != selectionEnd; + if (!control.menu || (input.length > 0 && (!input.activeFocus || hasSelection))) { selectWord(); } else { // We don't select anything at this point, the |