iOS: Fix the shortcuts bar not correctly hidden
To avoid a compiler warning due to a wrong Apple api, a wrong workaround was introduced. This caused the hide of the shortcuts as expects but the visual space reserved for shortcuts was still visible as at top with a height of ~55pixels. While this is not important because the default virtual keyboard is always shown, it become a problem when one want to introduce his own virtual keyboard (UIResponder.inputView) with no shortcuts bar. This fix really hide the shortcuts bar. Task-number: QTBUG-60812 Change-Id: I0da44dfc3fda15af3351543c0a05aac973b899b9 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>bb10
parent
d0a1135f00
commit
b30ce06992
|
|
@ -242,11 +242,12 @@
|
|||
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];
|
||||
// compiler warnings. Still it is the way to go to really hide the space reserved for that.
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wnonnull"
|
||||
self.inputAssistantItem.leadingBarButtonGroups = nil;
|
||||
self.inputAssistantItem.trailingBarButtonGroups = nil;
|
||||
#pragma clang diagnostic pop
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Reference in New Issue