Update QNSView geometry on window resize.

Ideally this should not be required since NSWindow
should resize the content view automatically. However,
in the case of modal QDialogs this does not happen.

Add call to updateGeometry in windowDidResize as a
workaround, and remove code which called QNSView::setFrameSize
with the current size.

This will cause duplicate handleGeometryChange calls
in the non-qdialog case, add a test to see if the geometry
really has changed to prevent that.

Change-Id: I29bea23b2ab72f923aeadf8db8cb9131ae177a28
Reviewed-by: Liang Qi <liang.qi@digia.com>
This commit is contained in:
Morten Johan Sorvig 2012-12-06 17:46:07 +01:00 committed by The Qt Project
parent 0c5e232828
commit e84e86dc8c
2 changed files with 4 additions and 3 deletions

View File

@ -590,9 +590,7 @@ void QCocoaWindow::windowDidResize()
if (!m_nsWindow)
return;
NSRect rect = [[m_nsWindow contentView]frame];
// Call setFrameSize which will trigger a frameDidChangeNotification on QNSView.
[[m_nsWindow contentView] setFrameSize:rect.size];
[m_contentView updateGeometry];
}
void QCocoaWindow::windowWillClose()

View File

@ -185,6 +185,9 @@ static QTouchDevice *touchDevice = 0;
geometry = qt_mac_toQRect([self frame]);
}
if (geometry == m_platformWindow->geometry())
return;
#ifdef QT_COCOA_ENABLE_WINDOW_DEBUG
qDebug() << "QNSView::udpateGeometry" << m_platformWindow << geometry;
#endif