Android: Ensure windows always have a geometry on creation

A QWindow created without an explicit geometry needs to pick up
a default geometry in the platform plugin. If the window has a
maximized of fullscreen window state, it will fill the entire
available geometry of the parent window (or the screen if there's
not parent window).

Fixes: QTBUG-69159
Fixes: QTBUG-69156
Fixes: QTBUG-69154
Pick-to: 5.15
Change-Id: If8565d92a97bb4b3fa44757e68969d54d0bc7ebe
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
This commit is contained in:
Piotr Mikolajczyk 2020-11-16 11:46:16 +01:00 committed by Tor Arne Vestbø
parent f6f68409a4
commit f92e195369
2 changed files with 10 additions and 9 deletions

View File

@ -46,6 +46,7 @@
#include <qguiapplication.h>
#include <qpa/qwindowsysteminterface.h>
#include <private/qhighdpiscaling_p.h>
QT_BEGIN_NAMESPACE
@ -58,6 +59,15 @@ QAndroidPlatformWindow::QAndroidPlatformWindow(QWindow *window)
m_windowState = Qt::WindowNoState;
m_windowId = winIdGenerator.fetchAndAddRelaxed(1) + 1;
setWindowState(window->windowStates());
const bool forceMaximize = m_windowState & (Qt::WindowMaximized | Qt::WindowFullScreen);
const QRect requestedGeometry = forceMaximize ? QRect() : window->geometry();
const QRect availableGeometry = (window->parent()) ? window->parent()->geometry() : platformScreen()->availableGeometry();
const QRect finalGeometry = QPlatformWindow::initialGeometry(window, requestedGeometry,
availableGeometry.width(), availableGeometry.height());
if (requestedGeometry != finalGeometry)
setGeometry(QHighDpi::toNativePixels(finalGeometry, window));
}
void QAndroidPlatformWindow::lower()

View File

@ -10,9 +10,6 @@ macos ci
# QTBUG-69160
opensuse-leap
android
[setVisible]
# QTBUG-69154
android
[modalWindowEnterEventOnHide_QTBUG35109]
osx
android
@ -23,15 +20,9 @@ windows-10
android
[testInputEvents]
rhel-7.4
[initialSize]
# QTBUG-69159
android
[modalWindowPosition]
# QTBUG-69161
android
[childWindowPositioning:show]
# QTBUG-69156
android
# QTBUG-87392
[paintEvent]
android