path: root/src/gui/kernel/qsimpledrag.cpp
diff options
authorTor Arne Vestbø <>2014-02-28 16:31:32 +0100
committerThe Qt Project <>2014-03-04 15:59:05 +0100
commit565f39aad1c02fda14f52fdd002eaba52abf8d27 (patch)
tree15f543bcb98606a23e3e80d3d953f2ea6347867f /src/gui/kernel/qsimpledrag.cpp
parentf07841bc7c621d3bca01c4f2dc11cf62c11b30d5 (diff)
Don't assume a QBasicDrag will start and end over a QWindow
A QBasicDrag is started from QBasicDrag::drag() through the drag manager, which may happen from e.g a widget. The event filter needs to look at events to more than just QWindows, otherwise the filter will miss eg. mouse release events that are sent to QWidget and not to the QWindow handle, and the drag goes on forever, causing invalid internal state when a new drag is then started. Change-Id: I5cee250e2c7552817bda0895d4c5794e12d26592 Reviewed-by: Friedemann Kleint <>
Diffstat (limited to 'src/gui/kernel/qsimpledrag.cpp')
1 files changed, 2 insertions, 3 deletions
diff --git a/src/gui/kernel/qsimpledrag.cpp b/src/gui/kernel/qsimpledrag.cpp
index dcf476e4fe..d53239e74f 100644
--- a/src/gui/kernel/qsimpledrag.cpp
+++ b/src/gui/kernel/qsimpledrag.cpp
@@ -116,6 +116,8 @@ void QBasicDrag::disableEventFilter()
bool QBasicDrag::eventFilter(QObject *o, QEvent *e)
+ Q_UNUSED(o);
if (!m_drag) {
if (e->type() == QEvent::KeyRelease && static_cast<QKeyEvent*>(e)->key() == Qt::Key_Escape) {
@@ -125,9 +127,6 @@ bool QBasicDrag::eventFilter(QObject *o, QEvent *e)
return false;
- if (!qobject_cast<QWindow *>(o))
- return false;
switch (e->type()) {
case QEvent::ShortcutOverride:
// prevent accelerators from firing while dragging