summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms
diff options
context:
space:
mode:
authorShawn Rutledge <shawn.rutledge@qt.io>2020-04-27 14:55:01 +0200
committerShawn Rutledge <shawn.rutledge@qt.io>2020-04-30 12:21:30 +0200
commitf9d219b92636fc279a3dc0c0e667b6668d0943db (patch)
tree1d3fde3df915c81117640143e592614875599f58 /src/plugins/platforms
parentb8e1321273ecd6390b195b60966e889439ee28ca (diff)
iOS: Teach edit menu popover to have a readonly mode
We should have foreseen the need for customizing this menu in 2014 when Controls 1 needed it, but here we are: Qt 5 is "done", this still wasn't done, and it's too late for new enum values in 5.15. So the workaround is to add a property on the focus object that the iOS plugin can query, and give us a menu that has Copy instead of Paste. Task-number: QTBUG-83811 Change-Id: Id8d18260002952fe7aa77aa5608cf7d0e440dacb Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Diffstat (limited to 'src/plugins/platforms')
-rw-r--r--src/plugins/platforms/ios/qiostextresponder.mm11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/plugins/platforms/ios/qiostextresponder.mm b/src/plugins/platforms/ios/qiostextresponder.mm
index a3350bda87..19e476a064 100644
--- a/src/plugins/platforms/ios/qiostextresponder.mm
+++ b/src/plugins/platforms/ios/qiostextresponder.mm
@@ -416,6 +416,17 @@
if (unknownAction)
return [super canPerformAction:action withSender:sender];
+
+ QObject *focusObject = QGuiApplication::focusObject();
+ if (focusObject && focusObject->property("qt_im_readonly").toBool()) {
+ // exceptional menu items for read-only views: do include Copy, do not include Paste etc.
+ if (action == @selector(cut:)
+ || action == @selector(paste:)
+ || action == @selector(delete:))
+ return NO;
+ if (action == @selector(copy:))
+ return YES;
+ }
return (hasSelection && isEditAction) || (!hasSelection && isSelectAction);
}