diff options
authorRichard Moe Gustavsen <>2021-01-14 11:31:01 +0100
committerRichard Moe Gustavsen <>2021-01-20 16:52:17 +0100
commit2e35a03cd624c006b92cb95847231c8b1efde45b (patch)
parent61c3f3539c3d2d7dc867c3fef0270a2f5c9ed376 (diff)
iOS: ensure we hide the edit menu while dragging on the selection handles
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. Pick-to: 6.0 5.15 Fixes: QTBUG-80298 Change-Id: Iff2032d64db1b582fa7f048c6a1f37ec8a1528af Reviewed-by: Morten Johan Sørvig <>
1 files changed, 9 insertions, 0 deletions
diff --git a/src/plugins/platforms/ios/ b/src/plugins/platforms/ios/
index 9acb707e6f..5b9de72d8e 100644
--- a/src/plugins/platforms/ios/
+++ b/src/plugins/platforms/ios/
@@ -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)
+ 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