iOS: Raise window level instead of hiding statusbar during VKB scroll
Hiding the statusbar using the normal iOS APIs result in QScreen reporting new availableGeometry, which is not what we want. The scroll of the screen is a purely visual effect, and shouldn't have any effect on observable Qt APIs besides the keyboard rect changing. Instead of actually hiding the statusbar, we achieve the same effect by raising the key window (and any other application windows, including the keyboard) to the level of the statusbar, effectively putting them above the statusbar. This still leaves popups and alert windows above the key window, as normal. Change-Id: Ib7694240ca86cfb9000de35bf0c49343ffb37e32 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@theqtcompany.com> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@theqtcompany.com>
This commit is contained in:
parent
83bd9393e5
commit
8f9ced9857
src/plugins/platforms/ios
@ -503,7 +503,22 @@ void QIOSInputContext::scroll(int y)
|
||||
[rootView.layer addAnimation:animation forKey:@"AnimateSubLayerTransform"];
|
||||
rootView.layer.sublayerTransform = translationTransform;
|
||||
|
||||
[rootView.qtViewController updateProperties];
|
||||
bool keyboardScrollIsActive = y != 0;
|
||||
|
||||
// Raise all known windows to above the status-bar if we're scrolling the screen,
|
||||
// while keeping the relative window level between the windows the same.
|
||||
NSArray *applicationWindows = [[UIApplication sharedApplication] windows];
|
||||
static QHash<UIWindow *, UIWindowLevel> originalWindowLevels;
|
||||
for (UIWindow *window in applicationWindows) {
|
||||
if (keyboardScrollIsActive && !originalWindowLevels.contains(window))
|
||||
originalWindowLevels.insert(window, window.windowLevel);
|
||||
|
||||
UIWindowLevel windowLevelAdjustment = keyboardScrollIsActive ? UIWindowLevelStatusBar : 0;
|
||||
window.windowLevel = originalWindowLevels.value(window) + windowLevelAdjustment;
|
||||
|
||||
if (!keyboardScrollIsActive)
|
||||
originalWindowLevels.remove(window);
|
||||
}
|
||||
}
|
||||
completion:^(BOOL){
|
||||
if (self) {
|
||||
|
@ -281,14 +281,8 @@
|
||||
// All decisions are based on the the top level window
|
||||
focusWindow = qt_window_private(focusWindow)->topLevelWindow();
|
||||
|
||||
bool hasScrolledRootViewDueToVirtualKeyboard =
|
||||
!CATransform3DIsIdentity(self.view.layer.sublayerTransform);
|
||||
|
||||
bool currentStatusBarVisibility = self.prefersStatusBarHidden;
|
||||
self.prefersStatusBarHidden = focusWindow->windowState() == Qt::WindowFullScreen
|
||||
|| hasScrolledRootViewDueToVirtualKeyboard;
|
||||
self.preferredStatusBarUpdateAnimation = hasScrolledRootViewDueToVirtualKeyboard ?
|
||||
UIStatusBarAnimationFade : UIStatusBarAnimationNone;
|
||||
self.prefersStatusBarHidden = focusWindow->windowState() == Qt::WindowFullScreen;
|
||||
|
||||
if (self.prefersStatusBarHidden != currentStatusBarVisibility) {
|
||||
#if QT_IOS_PLATFORM_SDK_EQUAL_OR_ABOVE(__IPHONE_7_0)
|
||||
|
Loading…
Reference in New Issue
Block a user