Cocoa integration - re-parent NSView correctly

If we add some view as a child into another view, make sure it's removed from
the previous superview.

Change-Id: I8c9f373907ded8e3ff75b1f2357401b308628125
Task-number: QTBUG-42059
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@theqtcompany.com>
This commit is contained in:
Timur Pocheptsov 2015-09-23 17:51:49 +02:00 committed by Frederik Gladhorn
parent 593ab63860
commit a6b34517ec

View File

@ -1350,6 +1350,9 @@ void QCocoaWindow::recreateWindow(const QPlatformWindow *parentWindow)
}
} else {
// Child windows have no NSWindow, link the NSViews instead.
if ([m_contentView superview])
[m_contentView removeFromSuperview];
[m_parentCocoaWindow->m_contentView addSubview : m_contentView];
QRect rect = windowGeometry();
// Prevent setting a (0,0) window size; causes opengl context