summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@nokia.com>2012-08-29 11:09:22 (GMT)
committerQt by Nokia <qt-info@nokia.com>2012-08-31 12:47:18 (GMT)
commit54334ca2e51ec43a07872c8b5861e5900d6b6cbb (patch)
tree46d014b7f43d81ccb86325374737d758736b56d7 /src/gui
parenta5a1121315d55f5af9d1ff4c926dd0d18e39f9df (diff)
downloadQt-54334ca2e51ec43a07872c8b5861e5900d6b6cbb.zip
Qt-54334ca2e51ec43a07872c8b5861e5900d6b6cbb.tar.gz
Qt-54334ca2e51ec43a07872c8b5861e5900d6b6cbb.tar.bz2
Windows: Fix Drag and drop in Designer.
When hitting on a child widget that does not accept drops, go up the hierarchy until the parent is hit or a widget that accepts drops is found. Introduced by f6bf4b2baa91e55f40596bf3f2823b119fdfa5e0 . Task-number: QTBUG-22987 Task-number: QTBUG-27037 Change-Id: I4d9308942c1109c11f7e31555d4ad84fa2610d15 Reviewed-by: Markku Tapio Heikkilä <markku.heikkila@digia.com> Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/kernel/qdnd_win.cpp17
1 files changed, 14 insertions, 3 deletions
diff --git a/src/gui/kernel/qdnd_win.cpp b/src/gui/kernel/qdnd_win.cpp
index 52f3276..20dfa76 100644
--- a/src/gui/kernel/qdnd_win.cpp
+++ b/src/gui/kernel/qdnd_win.cpp
@@ -690,6 +690,11 @@ void QOleDropTarget::sendDragEnterEvent(QWidget *dragEnterWidget, DWORD grfKeySt
}
+static inline bool acceptsDrop(const QWidget *w)
+{
+ return w->testAttribute(Qt::WA_DropSiteRegistered) && w->acceptDrops();
+}
+
QT_ENSURE_STACK_ALIGNED_FOR_SSE STDMETHODIMP
QOleDropTarget::DragOver(DWORD grfKeyState, POINTL pt, LPDWORD pdwEffect)
{
@@ -702,9 +707,15 @@ QOleDropTarget::DragOver(DWORD grfKeyState, POINTL pt, LPDWORD pdwEffect)
dragOverWidget = widget;
- if (!QApplicationPrivate::tryModalHelper(dragOverWidget)
- || !dragOverWidget->testAttribute(Qt::WA_DropSiteRegistered)
- || !dragOverWidget->acceptDrops()) {
+ if (!QApplicationPrivate::tryModalHelper(dragOverWidget)) {
+ *pdwEffect = DROPEFFECT_NONE;
+ return NOERROR;
+ }
+
+ while (dragOverWidget && dragOverWidget != widget && !acceptsDrop(dragOverWidget))
+ dragOverWidget = dragOverWidget->parentWidget();
+
+ if (!dragOverWidget || !acceptsDrop(dragOverWidget)) {
*pdwEffect = DROPEFFECT_NONE;
return NOERROR;
}