diff options
author | Jian Liang <jianliang79@gmail.com> | 2012-10-16 10:01:47 (GMT) |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2012-10-18 08:44:56 (GMT) |
commit | 62e9682abecaf7e38f6dd9640a3aa964bdd21d0d (patch) | |
tree | 3fff2476c180a19059ee14863fa16846d8f83596 | |
parent | 5e164f2bdd140860f98ade69fba0b7e4a11c94eb (diff) | |
download | Qt-62e9682abecaf7e38f6dd9640a3aa964bdd21d0d.zip Qt-62e9682abecaf7e38f6dd9640a3aa964bdd21d0d.tar.gz Qt-62e9682abecaf7e38f6dd9640a3aa964bdd21d0d.tar.bz2 |
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 <Friedemann.Kleint@digia.com>
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
-rw-r--r-- | src/gui/kernel/qdnd_win.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
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)) { |