From 1baf4d9ea45d03cc1cbdcccdaebb633e9dc7d961 Mon Sep 17 00:00:00 2001 From: Richard Moe Gustavsen Date: Thu, 14 Jan 2021 11:31:01 +0100 Subject: iOS: ensure we hide the edit menu while dragging on the selection handles MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit iOS used to close the edit menu automatically when the user tapped on the screen (even for menus shown explicitly using the UIMenuController API). Apperently this has now changed (probably as a part of [UIMenuController setMenuVisible:] being deprecated in iOS 13). So we now need to hide it explicitly instead. Because of this, the edit menu would be showing together with the magnifier class while the user was dragging on any of the handles. This patch will fix this, so that we close the edit menu explicitly whenever the user starts dragging on a handle. Fixes: QTBUG-80298 Change-Id: Iff2032d64db1b582fa7f048c6a1f37ec8a1528af Reviewed-by: Morten Johan Sørvig (cherry picked from commit 2e35a03cd624c006b92cb95847231c8b1efde45b) Reviewed-by: Qt Cherry-pick Bot --- src/plugins/platforms/ios/qiostextinputoverlay.mm | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/plugins/platforms/ios/qiostextinputoverlay.mm b/src/plugins/platforms/ios/qiostextinputoverlay.mm index e6e5baab99..89ace50a82 100644 --- a/src/plugins/platforms/ios/qiostextinputoverlay.mm +++ b/src/plugins/platforms/ios/qiostextinputoverlay.mm @@ -654,6 +654,7 @@ static void executeBlockWithoutAnimation(Block block) QIOSHandleLayer *_anchorLayer; QPointF _touchOffset; bool _dragOnCursor; + bool _dragOnAnchor; bool _multiLine; QTimer _updateSelectionTimer; QMetaObject::Connection _cursorConnection; @@ -794,9 +795,11 @@ static void executeBlockWithoutAnimation(Block block) if (cursorDist < anchorDist) { _touchOffset = cursorOffset; _dragOnCursor = YES; + _dragOnAnchor = NO; } else { _touchOffset = anchorOffset; _dragOnCursor = NO; + _dragOnAnchor = YES; } return YES; @@ -845,6 +848,12 @@ static void executeBlockWithoutAnimation(Block block) return; } + if (_dragOnCursor || _dragOnAnchor) { + // Ensure that the edit menu is hidden while + // the user drags on any of the handles. + QIOSTextInputOverlay::s_editMenu.visible = NO; + } + if (!_cursorLayer.visible && QIOSTextInputOverlay::s_editMenu.isHiding) { // Since the edit menu is hiding and this is the first selection thereafter, we // assume that the selection came from the user tapping on a menu item. In that -- cgit v1.2.3