diff options
author | Morten Johan Sorvig <morten.sorvig@digia.com> | 2012-12-06 17:46:07 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2012-12-07 09:15:00 +0100 |
commit | e84e86dc8cdab602ed19c18829e57230687a427c (patch) | |
tree | 2ec5e53cb8bf9ab371f3d750b08000efb3a18b72 | |
parent | 0c5e2328284e97a293e1153c6ad1bcd2706e044a (diff) |
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>
-rw-r--r-- | src/plugins/platforms/cocoa/qcocoawindow.mm | 4 | ||||
-rw-r--r-- | src/plugins/platforms/cocoa/qnsview.mm | 3 |
2 files changed, 4 insertions, 3 deletions
diff --git a/src/plugins/platforms/cocoa/qcocoawindow.mm b/src/plugins/platforms/cocoa/qcocoawindow.mm index 8ef489e28e..ffee8528f0 100644 --- a/src/plugins/platforms/cocoa/qcocoawindow.mm +++ b/src/plugins/platforms/cocoa/qcocoawindow.mm @@ -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() diff --git a/src/plugins/platforms/cocoa/qnsview.mm b/src/plugins/platforms/cocoa/qnsview.mm index eea65cf8c0..1f19b07904 100644 --- a/src/plugins/platforms/cocoa/qnsview.mm +++ b/src/plugins/platforms/cocoa/qnsview.mm @@ -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 |