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 <Friedemann.Kleint@digia.com>
This commit is contained in:
parent
f07841bc7c
commit
565f39aad1
@ -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) {
|
||||
disableEventFilter();
|
||||
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user