summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/ios/qiostextresponder.mm
diff options
context:
space:
mode:
authorRichard Moe Gustavsen <richard.gustavsen@qt.io>2016-09-19 15:08:12 +0200
committerRichard Moe Gustavsen <richard.gustavsen@qt.io>2016-09-30 12:18:37 +0000
commitb19280753d8edfab503669a61800735ad184b042 (patch)
tree0fa7f8949bf8b87ce93d04ff35d751bfb2fd3293 /src/plugins/platforms/ios/qiostextresponder.mm
parentbe13081dd4a965f52dd55b3ca2db25ffa3816776 (diff)
iOS: hide shortcuts bar on iPad when showing menus
On iPad, a shortcuts bar with extra controls are shown on top of the keyboard with opertions like cut and copy. This is unwanted when using the keyboard to show menus. This patch will add extra private information to IM platform data when using menus, so that we hide the shorcuts menu when showing the custom input panel. Task-number: QTBUG-49893 Change-Id: Iaa8e1ff18acebec8be69699b3fd9470c69ab34d7 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@theqtcompany.com>
Diffstat (limited to 'src/plugins/platforms/ios/qiostextresponder.mm')
-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 4bef968de1..d961d4149c 100644
--- a/src/plugins/platforms/ios/qiostextresponder.mm
+++ b/src/plugins/platforms/ios/qiostextresponder.mm
@@ -230,6 +230,17 @@
self.inputView = [[[WrapperView alloc] initWithView:inputView] autorelease];
if (UIView *accessoryView = static_cast<UIView *>(platformData.value(kImePlatformDataInputAccessoryView).value<void *>()))
self.inputAccessoryView = [[[WrapperView alloc] initWithView:accessoryView] autorelease];
+ if (QSysInfo::MacintoshVersion >= QSysInfo::MV_IOS_9_0) {
+ if (platformData.value(kImePlatformDataHideShortcutsBar).toBool()) {
+ // According to the docs, leadingBarButtonGroups/trailingBarButtonGroups should be set to nil to hide the shortcuts bar.
+ // However, starting with iOS 10, the API has been surrounded with NS_ASSUME_NONNULL, which contradicts this and causes
+ // compiler warnings. And assigning just an empty array causes layout asserts. Hence, we assign empty button groups instead.
+ UIBarButtonItemGroup *leading = [[[UIBarButtonItemGroup alloc] initWithBarButtonItems:@[] representativeItem:nil] autorelease];
+ UIBarButtonItemGroup *trailing = [[[UIBarButtonItemGroup alloc] initWithBarButtonItems:@[] representativeItem:nil] autorelease];
+ self.inputAssistantItem.leadingBarButtonGroups = @[leading];
+ self.inputAssistantItem.trailingBarButtonGroups = @[trailing];
+ }
+ }
self.undoManager.groupsByEvent = NO;
[self rebuildUndoStack];