mirror of https://github.com/qt/qtbase.git
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:
parent
f6f68409a4
commit
f92e195369
|
@ -46,6 +46,7 @@
|
||||||
|
|
||||||
#include <qguiapplication.h>
|
#include <qguiapplication.h>
|
||||||
#include <qpa/qwindowsysteminterface.h>
|
#include <qpa/qwindowsysteminterface.h>
|
||||||
|
#include <private/qhighdpiscaling_p.h>
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
|
|
||||||
|
@ -58,6 +59,15 @@ QAndroidPlatformWindow::QAndroidPlatformWindow(QWindow *window)
|
||||||
m_windowState = Qt::WindowNoState;
|
m_windowState = Qt::WindowNoState;
|
||||||
m_windowId = winIdGenerator.fetchAndAddRelaxed(1) + 1;
|
m_windowId = winIdGenerator.fetchAndAddRelaxed(1) + 1;
|
||||||
setWindowState(window->windowStates());
|
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()
|
void QAndroidPlatformWindow::lower()
|
||||||
|
|
|
@ -10,9 +10,6 @@ macos ci
|
||||||
# QTBUG-69160
|
# QTBUG-69160
|
||||||
opensuse-leap
|
opensuse-leap
|
||||||
android
|
android
|
||||||
[setVisible]
|
|
||||||
# QTBUG-69154
|
|
||||||
android
|
|
||||||
[modalWindowEnterEventOnHide_QTBUG35109]
|
[modalWindowEnterEventOnHide_QTBUG35109]
|
||||||
osx
|
osx
|
||||||
android
|
android
|
||||||
|
@ -23,15 +20,9 @@ windows-10
|
||||||
android
|
android
|
||||||
[testInputEvents]
|
[testInputEvents]
|
||||||
rhel-7.4
|
rhel-7.4
|
||||||
[initialSize]
|
|
||||||
# QTBUG-69159
|
|
||||||
android
|
|
||||||
[modalWindowPosition]
|
[modalWindowPosition]
|
||||||
# QTBUG-69161
|
# QTBUG-69161
|
||||||
android
|
android
|
||||||
[childWindowPositioning:show]
|
|
||||||
# QTBUG-69156
|
|
||||||
android
|
|
||||||
# QTBUG-87392
|
# QTBUG-87392
|
||||||
[paintEvent]
|
[paintEvent]
|
||||||
android
|
android
|
||||||
|
|
Loading…
Reference in New Issue