From a82fd289dfac02ddf371761efe3d38614539928d Mon Sep 17 00:00:00 2001
From: Richard Moe Gustavsen <richard.gustavsen@digia.com>
Date: Thu, 30 Oct 2014 14:44:19 +0100
Subject: [PATCH] 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>
---
 src/controls/Private/EditMenu_ios.qml | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/controls/Private/EditMenu_ios.qml b/src/controls/Private/EditMenu_ios.qml
index d2a6c8c08..253dbbaa7 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
-- 
GitLab