diff options
author | Bradley T. Hughes <bradley.hughes@nokia.com> | 2010-04-14 01:06:22 (GMT) |
---|---|---|
committer | Bradley T. Hughes <bradley.hughes@nokia.com> | 2010-04-17 20:34:51 (GMT) |
commit | c8e08e5c74fbdae8a60bdd9b08966ea7fc728845 (patch) | |
tree | 1cfeb48e2013d30fd2b272afddb9942b21e31961 /src/gui/kernel | |
parent | 9b77de3effdb2eb7d6df212ab9a8a19551ecb550 (diff) | |
download | Qt-c8e08e5c74fbdae8a60bdd9b08966ea7fc728845.zip Qt-c8e08e5c74fbdae8a60bdd9b08966ea7fc728845.tar.gz Qt-c8e08e5c74fbdae8a60bdd9b08966ea7fc728845.tar.bz2 |
Prevent accelerators from firing on X11 and QWS during a drag
Drag-and-drop has always been modal, and already blocks key events. It
should block all application accelerators as well, to avoid unexpected
things like being unable to cancel the drag-and-drop (as mentioned in
the task), or by being able to unexpectedly recurse the drag-and-drop
event loop (by, for example, opening a file dialog).
Task-number: QTBUG-9786
Reviewed-by: TrustMe
Diffstat (limited to 'src/gui/kernel')
-rw-r--r-- | src/gui/kernel/qdnd_qws.cpp | 4 | ||||
-rw-r--r-- | src/gui/kernel/qdnd_x11.cpp | 6 |
2 files changed, 10 insertions, 0 deletions
diff --git a/src/gui/kernel/qdnd_qws.cpp b/src/gui/kernel/qdnd_qws.cpp index e47de00..7e5afc7 100644 --- a/src/gui/kernel/qdnd_qws.cpp +++ b/src/gui/kernel/qdnd_qws.cpp @@ -192,6 +192,10 @@ bool QDragManager::eventFilter(QObject *o, QEvent *e) return false; switch(e->type()) { + case QEvent::ShortcutOverride: + // prevent accelerators from firing while dragging + e->accept(); + return true; case QEvent::KeyPress: case QEvent::KeyRelease: diff --git a/src/gui/kernel/qdnd_x11.cpp b/src/gui/kernel/qdnd_x11.cpp index 0a05d8e..2b12317 100644 --- a/src/gui/kernel/qdnd_x11.cpp +++ b/src/gui/kernel/qdnd_x11.cpp @@ -1299,6 +1299,12 @@ bool QDragManager::eventFilter(QObject * o, QEvent * e) return true; } + if (e->type() == QEvent::ShortcutOverride) { + // prevent accelerators from firing while dragging + e->accept(); + return true; + } + if (e->type() == QEvent::KeyPress || e->type() == QEvent::KeyRelease) { QKeyEvent *ke = ((QKeyEvent*)e); if (ke->key() == Qt::Key_Escape && e->type() == QEvent::KeyPress) { |