From 98f326e9b82e6dbf0ef68a16292c38276181416a Mon Sep 17 00:00:00 2001 From: Tim Blechmann Date: Fri, 4 Dec 2015 08:46:03 +0100 Subject: windows: enable drop for embedded windows when embedding a QWindow into a native win32 window hierarchy, dragndrop is not working, as RegisterDragDrop is not called. the parent HWND is wrapped via QWindow::fromWinId(), which is topLevel, but a Qt::ForeignWindow. it's children are not topLevel. we therefore add a conditon to call RegisterDragDrop on non-topLevel windows whose parent is a Qt::ForeignWindow Change-Id: Id2bfa1130857c21566feae9cb10b62b648d86a72 Reviewed-by: Friedemann Kleint --- src/plugins/platforms/windows/qwindowswindow.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'src/plugins/platforms') diff --git a/src/plugins/platforms/windows/qwindowswindow.cpp b/src/plugins/platforms/windows/qwindowswindow.cpp index 48484209b5..611d586b19 100644 --- a/src/plugins/platforms/windows/qwindowswindow.cpp +++ b/src/plugins/platforms/windows/qwindowswindow.cpp @@ -1033,7 +1033,17 @@ void QWindowsWindow::destroyWindow() void QWindowsWindow::updateDropSite(bool topLevel) { bool enabled = false; - if (topLevel) { + bool parentIsEmbedded = false; + + if (!topLevel) { + // if the parent window is a foreign window wrapped via QWindow::fromWinId, we need to enable the drop site + // on the first child window + const QWindow *parent = window()->parent(); + if (parent && (parent->type() == Qt::ForeignWindow)) + parentIsEmbedded = true; + } + + if (topLevel || parentIsEmbedded) { switch (window()->type()) { case Qt::Window: case Qt::Dialog: -- cgit v1.2.3