From b19280753d8edfab503669a61800735ad184b042 Mon Sep 17 00:00:00 2001 From: Richard Moe Gustavsen Date: Mon, 19 Sep 2016 15:08:12 +0200 Subject: iOS: hide shortcuts bar on iPad when showing menus MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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ø --- src/plugins/platforms/ios/qiostextresponder.mm | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src/plugins/platforms/ios/qiostextresponder.mm') 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(platformData.value(kImePlatformDataInputAccessoryView).value())) 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]; -- cgit v1.2.3