summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/plugins/platforms/cocoa/qcocoawindow.mm7
-rw-r--r--tests/auto/gui/kernel/qwindow/tst_qwindow.cpp20
2 files changed, 25 insertions, 2 deletions
diff --git a/src/plugins/platforms/cocoa/qcocoawindow.mm b/src/plugins/platforms/cocoa/qcocoawindow.mm
index 057eb7e144..bba5b6fdf1 100644
--- a/src/plugins/platforms/cocoa/qcocoawindow.mm
+++ b/src/plugins/platforms/cocoa/qcocoawindow.mm
@@ -267,7 +267,6 @@ void QCocoaWindow::setGeometry(const QRect &rect)
#ifdef QT_COCOA_ENABLE_WINDOW_DEBUG
qDebug() << "QCocoaWindow::setGeometry" << this << rect;
#endif
- QPlatformWindow::setGeometry(rect);
setCocoaGeometry(rect);
}
@@ -275,8 +274,10 @@ void QCocoaWindow::setCocoaGeometry(const QRect &rect)
{
QCocoaAutoReleasePool pool;
- if (m_contentViewIsEmbedded)
+ if (m_contentViewIsEmbedded) {
+ QPlatformWindow::setGeometry(rect);
return;
+ }
if (m_nsWindow) {
NSRect bounds = qt_mac_flipRect(rect, window());
@@ -284,6 +285,8 @@ void QCocoaWindow::setCocoaGeometry(const QRect &rect)
} else {
[m_contentView setFrame : NSMakeRect(rect.x(), rect.y(), rect.width(), rect.height())];
}
+
+ // will call QPlatformWindow::setGeometry(rect) during resize confirmation (see qnsview.mm)
}
void QCocoaWindow::setVisible(bool visible)
diff --git a/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp b/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp
index b4208949b0..7ad7880330 100644
--- a/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp
+++ b/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp
@@ -59,6 +59,7 @@ class tst_QWindow: public QObject
private slots:
void eventOrderOnShow();
+ void resizeEventAfterResize();
void mapGlobal();
void positioning();
void isExposed();
@@ -168,6 +169,25 @@ void tst_QWindow::eventOrderOnShow()
QVERIFY(window.eventIndex(QEvent::Resize) < window.eventIndex(QEvent::Expose));
}
+void tst_QWindow::resizeEventAfterResize()
+{
+ // Some platforms enforce minimum widths for windows, which can cause extra resize
+ // events, so set the width to suitably large value to avoid those.
+ QRect geometry(QGuiApplication::primaryScreen()->availableGeometry().topLeft() + QPoint(20, 20), QSize(300, 40));
+
+ Window window;
+ window.setGeometry(geometry);
+ window.show();
+
+ QTRY_COMPARE(window.received(QEvent::Resize), 1);
+
+ // QTBUG-32706
+ // Make sure we get a resizeEvent after calling resize
+ window.resize(400, 100);
+
+ QTRY_COMPARE(window.received(QEvent::Resize), 2);
+}
+
void tst_QWindow::positioning()
{
if (!QGuiApplicationPrivate::platformIntegration()->hasCapability(