Fix drag and drop with createWindowContainer

Forward dnd events to the QWindow, exactly like QQuickWidget would do.
This of course requires setting setAcceptDrops(true) on the container widget.

Task-number: QTBUG-39213
Change-Id: I8ea49e630b071dc0aacd53f798d9b46b03502365
Reviewed-by: Gunnar Sletta <gunnar@sletta.org>
This commit is contained in:
Laszlo Agocs 2014-09-15 15:44:28 +02:00 committed by Simon Hausmann
parent 46ebcb6176
commit 75834c2232

View File

@ -295,6 +295,17 @@ bool QWindowContainer::event(QEvent *e)
}
}
break;
case QEvent::Drop:
case QEvent::DragMove:
case QEvent::DragLeave:
QCoreApplication::sendEvent(d->window, e);
return e->isAccepted();
case QEvent::DragEnter:
// Don't reject drag events for the entire widget when one
// item rejects the drag enter
QCoreApplication::sendEvent(d->window, e);
e->accept();
return true;
default:
break;
}