From 62e9682abecaf7e38f6dd9640a3aa964bdd21d0d Mon Sep 17 00:00:00 2001 From: Jian Liang Date: Tue, 16 Oct 2012 18:01:47 +0800 Subject: Fix Drag and Drop with Native Widgets Task-number: QTBUG-27265 Don't check "dragOverWidget != widget" in QOleDropTarget::DragOver() because if the dropsite widget's parent widget is the drop target this check will prevent its parent widget receive drag over event and the dnd cursor indicator is also wrong. We replace the check with "!dragOverWidget->isWindow()" to prevent pass through a window. A similar issue in Qt5 beta has been fixed by https://codereview.qt-project.org/#change,35646 Change-Id: I9e18b71bd7f3ee244db61571811c51dc16b341d2 Reviewed-by: Friedemann Kleint Reviewed-by: Marc Mutz --- src/gui/kernel/qdnd_win.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/gui/kernel/qdnd_win.cpp b/src/gui/kernel/qdnd_win.cpp index 23ed1a6..e0c4619 100644 --- a/src/gui/kernel/qdnd_win.cpp +++ b/src/gui/kernel/qdnd_win.cpp @@ -712,7 +712,9 @@ QOleDropTarget::DragOver(DWORD grfKeyState, POINTL pt, LPDWORD pdwEffect) return NOERROR; } - while (dragOverWidget && dragOverWidget != widget && !acceptsDrop(dragOverWidget)) + // Try to find a drop-enabled target in the hierarchy. Go beyond 'widget' in case + // it is a native child window which has its own drop site registered (QTBUG-27265). + while (dragOverWidget && !dragOverWidget->isWindow() && !acceptsDrop(dragOverWidget)) dragOverWidget = dragOverWidget->parentWidget(); if (!dragOverWidget || !acceptsDrop(dragOverWidget)) { -- cgit v0.12