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>
This commit is contained in:
Tor Arne Vestbø 2017-08-24 17:44:16 +02:00
parent a980250a66
commit cda9bd664d

View File

@ -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)