Cocoa: don't animate window transitions for 0 width/height windows

Task-number: QTBUG-26617

Change-Id: I6dfc3f208368ddf6be65259218aee88db9692cfe
Reviewed-by: Morten Johan Sørvig <morten.sorvig@digia.com>
This commit is contained in:
Teemu Katajisto 2012-10-05 14:20:03 +03:00 committed by The Qt Project
parent d0573aa914
commit 1bd710cbc7

View File

@ -726,6 +726,15 @@ void QCocoaWindow::syncWindowState(Qt::WindowState newState)
if (!m_nsWindow)
return;
// if content view width or height is 0 then the window animations will crash so
// do nothing except set the new state
NSRect contentRect = [contentView() frame];
if (contentRect.size.width <= 0 || contentRect.size.height <= 0) {
qWarning() << Q_FUNC_INFO << "invalid window content view size, check your window geometry";
m_synchedWindowState = newState;
return;
}
if ((m_synchedWindowState & Qt::WindowMaximized) != (newState & Qt::WindowMaximized)) {
[m_nsWindow performZoom : m_nsWindow]; // toggles
}