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>bb10
parent
b8e1321273
commit
f9d219b926
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue