diff options
author | Tim Blechmann <tim@klingt.org> | 2015-12-04 08:46:03 +0100 |
---|---|---|
committer | Tim Blechmann <tim@klingt.org> | 2015-12-04 10:18:00 +0000 |
commit | 98f326e9b82e6dbf0ef68a16292c38276181416a (patch) | |
tree | 12e4e8b12b90dd0ae501f726a96393c1b243fac7 /src/plugins/platforms/windows | |
parent | c04e7dead8bee51e11698fe1c625c76915a60753 (diff) |
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 <Friedemann.Kleint@theqtcompany.com>
Diffstat (limited to 'src/plugins/platforms/windows')
-rw-r--r-- | src/plugins/platforms/windows/qwindowswindow.cpp | 12 |
1 files changed, 11 insertions, 1 deletions
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: |