From b6ef26adce2727837488ab6f2d8fcefb5d32ce4d Mon Sep 17 00:00:00 2001 From: Gunnar Sletta Date: Wed, 24 Aug 2011 09:05:27 +0200 Subject: [PATCH] Preliminary change to get resizeEvents for QWindow::resize() calls MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I43e1d7fb98f1b20939dba8cdccffa4dcb99a7369 Reviewed-on: http://codereview.qt.nokia.com/3453 Reviewed-by: Qt Sanity Bot Reviewed-by: Morten Johan Sørvig --- src/gui/kernel/qwindow.cpp | 3 ++- src/plugins/platforms/cocoa/qcocoawindow.mm | 5 ++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/gui/kernel/qwindow.cpp b/src/gui/kernel/qwindow.cpp index 3a75a8b134..d850cd6020 100644 --- a/src/gui/kernel/qwindow.cpp +++ b/src/gui/kernel/qwindow.cpp @@ -411,9 +411,10 @@ void QWindow::setSizeIncrement(const QSize &size) void QWindow::setGeometry(const QRect &rect) { Q_D(QWindow); - d->geometry = rect; if (d->platformWindow) { d->platformWindow->setGeometry(rect); + } else { + d->geometry = rect; } } diff --git a/src/plugins/platforms/cocoa/qcocoawindow.mm b/src/plugins/platforms/cocoa/qcocoawindow.mm index eef7f8b160..e594514383 100644 --- a/src/plugins/platforms/cocoa/qcocoawindow.mm +++ b/src/plugins/platforms/cocoa/qcocoawindow.mm @@ -100,6 +100,8 @@ QCocoaWindow::QCocoaWindow(QWindow *tlw) m_windowSurfaceView = m_contentView; } + setGeometry(tlw->geometry()); + [m_nsWindow setContentView:m_contentView]; } @@ -112,8 +114,9 @@ void QCocoaWindow::setGeometry(const QRect &rect) { QPlatformWindow::setGeometry(rect); - NSRect bounds = globalGeometry(window()->geometry()); + NSRect bounds = globalGeometry(rect); [[m_nsWindow contentView]setFrameSize:bounds.size]; + [m_nsWindow setContentSize : bounds.size]; [m_nsWindow setFrameOrigin : bounds.origin]; if (m_glContext)