Windows: Handle Qt::ForeignWindow.

Task-number: QTBUG-33079

Change-Id: Iec2ddfe07b07b3a921098c7147f26aff316bf6e6
Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
This commit is contained in:
Friedemann Kleint 2013-08-20 16:01:43 +02:00 committed by The Qt Project
parent 7978cef796
commit 95e880bd9d
2 changed files with 15 additions and 1 deletions

View File

@ -395,6 +395,8 @@ bool QWindowsIntegration::hasCapability(QPlatformIntegration::Capability cap) co
return true;
case MultipleWindows:
return true;
case ForeignWindows:
return true;
default:
return QPlatformIntegration::hasCapability(cap);
}

View File

@ -485,6 +485,18 @@ QWindowsWindow::WindowData
qDebug().nospace() << "Created desktop window " << w << result.hwnd;
return result;
}
if ((flags & Qt::WindowType_Mask) == Qt::ForeignWindow) {
result.hwnd = reinterpret_cast<HWND>(w->winId());
Q_ASSERT(result.hwnd);
const LONG_PTR style = GetWindowLongPtr(result.hwnd, GWL_STYLE);
const LONG_PTR exStyle = GetWindowLongPtr(result.hwnd, GWL_EXSTYLE);
result.geometry = frameGeometry(result.hwnd, !GetParent(result.hwnd));
result.frame = QWindowsGeometryHint::frame(style, exStyle);
result.embedded = false;
if (QWindowsContext::verboseWindows)
qDebug() << "Foreign window: " << w << result.hwnd << result.geometry << result.frame;
return result;
}
const HINSTANCE appinst = (HINSTANCE)GetModuleHandle(0);
@ -894,7 +906,7 @@ void QWindowsWindow::destroyWindow()
}
}
#endif // !Q_OS_WINCE
if (m_data.hwnd != GetDesktopWindow())
if (m_data.hwnd != GetDesktopWindow() && window()->type() != Qt::ForeignWindow)
DestroyWindow(m_data.hwnd);
context->removeWindow(m_data.hwnd);
m_data.hwnd = 0;