summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/cocoa/qcocoawindow.mm
diff options
context:
space:
mode:
authorTor Arne Vestbø <tor.arne.vestbo@qt.io>2017-08-24 17:44:16 +0200
committerTor Arne Vestbø <tor.arne.vestbo@qt.io>2017-08-25 15:33:31 +0000
commitcda9bd664d51b0e0c7a5748b8c5a7eebf9c38fa5 (patch)
tree8b53c75640559eeddd028138b7db047d18ab6c8a /src/plugins/platforms/cocoa/qcocoawindow.mm
parenta980250a666bc87e5db006b8668c6af9340915f2 (diff)
macOS: Add workaround for Qt not accepting resize-events before show
QtWidgets in particular expects a show event before any resize or expose events. QWindow::setVisible creates the platform window before sending the show event, so we block sending any resize events during platform window creation of QCocoaWindow, which means we miss out on the resize event that indicates that the window is maximized. We should probably teach QWindow::setVisible to send the show event before creating the window, but until then we work around it by sending an explicit resize event in QCocoaWindow::setVisible. Task-number: QTBUG-62774 Change-Id: I6d512c9775986bcbcbf5c02a9e49984015fa9782 Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Diffstat (limited to 'src/plugins/platforms/cocoa/qcocoawindow.mm')
-rw-r--r--src/plugins/platforms/cocoa/qcocoawindow.mm6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/plugins/platforms/cocoa/qcocoawindow.mm b/src/plugins/platforms/cocoa/qcocoawindow.mm
index e906f0fd1c..72beb2757a 100644
--- a/src/plugins/platforms/cocoa/qcocoawindow.mm
+++ b/src/plugins/platforms/cocoa/qcocoawindow.mm
@@ -323,6 +323,12 @@ void QCocoaWindow::setVisible(bool visible)
// We need to recreate if the modality has changed as the style mask will need updating
recreateWindowIfNeeded();
+ // We didn't send geometry changes during creation, as that would have confused
+ // Qt, which expects a show-event to be sent before any resize events. But now
+ // that the window is made visible, we know that the show-event has been sent
+ // so we can send the geometry change. FIXME: Get rid of this workaround.
+ handleGeometryChange();
+
// Register popup windows. The Cocoa platform plugin will forward mouse events
// to them and close them when needed.
if (window()->type() == Qt::Popup || window()->type() == Qt::ToolTip)