Drag&Drop support for child items in QQuickWidget
authorPaul Olav Tvete <paul.tvete@gmail.com>
Tue, 10 Jun 2014 09:09:21 +0000 (11:09 +0200)
committerThe Qt Project <gerrit-noreply@qt-project.org>
Tue, 10 Jun 2014 20:23:07 +0000 (22:23 +0200)
This is a quick-fix. The real issue is that QWidget and QWindow
reacts differently when a QDragEnterEvent is rejected.

Change-Id: I3e3e50610c14acfaada9c1b243b88cfe9eae54b2
Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com>
src/quickwidgets/qquickwidget.cpp

index 439b039266233f2c53918b2bf746f7ea5b2d4212..3743a8cf1e9e42a2add7a8083cd2a75166e08d05 100644 (file)
@@ -1006,13 +1006,18 @@ bool QQuickWidget::event(QEvent *e)
     switch (e->type()) {
 #ifndef QT_NO_DRAGANDDROP
     case QEvent::Drop:
-    case QEvent::DragEnter:
     case QEvent::DragMove:
     case QEvent::DragLeave:
         // Drag/drop events only have local pos, so no need to map,
         // but QQuickWindow::event() does not return true
         d->offscreenWindow->event(e);
         return e->isAccepted();
+    case QEvent::DragEnter:
+        // Don't reject drag events for the entire widget when one
+        // item rejects the drag enter
+        d->offscreenWindow->event(e);
+        e->accept();
+        return true;
 #endif
     case QEvent::TouchBegin:
     case QEvent::TouchEnd: