iOS: Fix foreign window auto test

Pick-to: 6.6
Change-Id: Iae3a0f9805b02f935009d800dec00d9e2ceb008d
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
This commit is contained in:
Tor Arne Vestbø 2023-11-13 09:49:51 +01:00
parent 619ec1a640
commit 93077dd1f2
2 changed files with 22 additions and 10 deletions

View File

@ -62,6 +62,8 @@ public:
CAEAGLLayer *eaglLayer() const; CAEAGLLayer *eaglLayer() const;
#endif #endif
bool isForeignWindow() const override;
private: private:
void applicationStateChanged(Qt::ApplicationState state); void applicationStateChanged(Qt::ApplicationState state);
void applyGeometry(const QRect &rect); void applyGeometry(const QRect &rect);

View File

@ -52,17 +52,22 @@ QIOSWindow::QIOSWindow(QWindow *window, WId nativeHandle)
setParent(QPlatformWindow::parent()); setParent(QPlatformWindow::parent());
// Resolve default window geometry in case it was not set before creating the if (!isForeignWindow()) {
// platform window. This picks up eg. minimum-size if set, and defaults to // Resolve default window geometry in case it was not set before creating the
// the "maxmized" geometry (even though we're not in that window state). // platform window. This picks up eg. minimum-size if set, and defaults to
// FIXME: Detect if we apply a maximized geometry and send a window state // the "maxmized" geometry (even though we're not in that window state).
// change event in that case. // FIXME: Detect if we apply a maximized geometry and send a window state
m_normalGeometry = initialGeometry(window, QPlatformWindow::geometry(), // change event in that case.
screen()->availableGeometry().width(), screen()->availableGeometry().height()); m_normalGeometry = initialGeometry(window, QPlatformWindow::geometry(),
screen()->availableGeometry().width(), screen()->availableGeometry().height());
setWindowState(window->windowStates()); setWindowState(window->windowStates());
setOpacity(window->opacity()); setOpacity(window->opacity());
setMask(QHighDpi::toNativeLocalRegion(window->mask(), window)); setMask(QHighDpi::toNativeLocalRegion(window->mask(), window));
} else {
// Pick up essential foreign window state
QPlatformWindow::setGeometry(QRectF::fromCGRect(m_view.frame).toRect());
}
Qt::ScreenOrientation initialOrientation = window->contentOrientation(); Qt::ScreenOrientation initialOrientation = window->contentOrientation();
if (initialOrientation != Qt::PrimaryOrientation) { if (initialOrientation != Qt::PrimaryOrientation) {
@ -426,6 +431,11 @@ QUIView *quiview_cast(UIView *view)
return qt_objc_cast<QUIView *>(view); return qt_objc_cast<QUIView *>(view);
} }
bool QIOSWindow::isForeignWindow() const
{
return ![m_view isKindOfClass:QUIView.class];
}
QT_END_NAMESPACE QT_END_NAMESPACE
#include "moc_qioswindow.cpp" #include "moc_qioswindow.cpp"