diff options
author | Timur Pocheptsov <timur.pocheptsov@theqtcompany.com> | 2015-09-23 17:51:49 +0200 |
---|---|---|
committer | Frederik Gladhorn <frederik.gladhorn@theqtcompany.com> | 2015-09-26 21:44:58 +0000 |
commit | a6b34517ecf458d5c09fe4a1e6cf53811be7bd66 (patch) | |
tree | 92f751abef606759cdde508264f4a43e80d01883 | |
parent | 593ab638609eb33542cf47b1693e70d6dbd7093b (diff) |
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>
-rw-r--r-- | src/plugins/platforms/cocoa/qcocoawindow.mm | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/plugins/platforms/cocoa/qcocoawindow.mm b/src/plugins/platforms/cocoa/qcocoawindow.mm index 543fcd50d1..f790259f0e 100644 --- a/src/plugins/platforms/cocoa/qcocoawindow.mm +++ b/src/plugins/platforms/cocoa/qcocoawindow.mm @@ -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 |