Cocoa: add QT_MAC_USE_NSWINDOW env. variable

When enabled, all QWindows will be backed by a NSWindow.
This is unlike the default where only top-level
QWindows get a NSWindow.

The QWindow still has (Q)NSView as the NSWindow content
view. The return value of the winId functions are
still the NSView and is not affected by this switch.

Change-Id: I131b89af04c09451a6e7515d1da3f7498f53979a
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@theqtcompany.com>
Reviewed-by: Timur Pocheptsov <Timur.Pocheptsov@digia.com>
This commit is contained in:
Morten Johan Sørvig 2015-05-13 21:04:27 +02:00 committed by Timur Pocheptsov
parent 6b4c1ad58c
commit f7047d52da

View File

@ -1254,7 +1254,9 @@ QCocoaGLContext *QCocoaWindow::currentContext() const
void QCocoaWindow::recreateWindow(const QPlatformWindow *parentWindow)
{
bool wasNSWindowChild = m_isNSWindowChild;
m_isNSWindowChild = parentWindow && (window()->property("_q_platform_MacUseNSWindow").toBool());
BOOL requestNSWindowChild = qt_mac_resolveOption(NO, window(), "_q_platform_MacUseNSWindow",
"QT_MAC_USE_NSWINDOW");
m_isNSWindowChild = parentWindow && requestNSWindowChild;
bool needsNSWindow = m_isNSWindowChild || !parentWindow;
QCocoaWindow *oldParentCocoaWindow = m_parentCocoaWindow;