diff options
author | Rick Stockton <rickstockton@reno-computerhelp.com> | 2014-01-19 10:44:31 -0800 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-01-27 23:55:12 +0100 |
commit | 9063edef796ad10eb9ac2229627f36d60168f0e2 (patch) | |
tree | b52ad219afc1770c890ea5474ce5afdeb7b6016d /src/widgets/kernel/qapplication.cpp | |
parent | b7de9e7353a0caccceb309c03343e80dbe117dbb (diff) |
If DblClick, do not deliver 'duplicated' MouseButtonPress
QWidgetWIndow: In Qt4, when Qt created a MouseButtonDblClick
event, Qt would consume the causing MouseButtonPress.
It would send only the derived dblclick event to widget
windows and their children.
This change makes Qt5.3 and higher emulate Qt4 delivery
of double click-related events to widget windows and
their children. QML objects (e.g. mousearea) continue to
receive the second MouseButtonPress.
[ChangeLog][QtGui][QWidget] MouseButtonDblClick: Do not send
the 2nd MouseButtonPress event to Widgets. Restore Qt4
behavior in sequence of mouse events delivered to
widget windows and their children.
Task-number: QTBUG-25831
Change-Id: Iff0f9c592bceacb2ca844d30f8180081e136a889
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com>
Diffstat (limited to 'src/widgets/kernel/qapplication.cpp')
-rw-r--r-- | src/widgets/kernel/qapplication.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/widgets/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp index be349bfced..1f84a4b5c4 100644 --- a/src/widgets/kernel/qapplication.cpp +++ b/src/widgets/kernel/qapplication.cpp @@ -2767,6 +2767,13 @@ bool QApplication::notify(QObject *receiver, QEvent *e) QApplicationPrivate::mouse_buttons |= me->button(); break; } + case QEvent::MouseButtonDblClick: + { + QMouseEvent *me = static_cast<QMouseEvent*>(e); + QApplicationPrivate::modifier_buttons = me->modifiers(); + QApplicationPrivate::mouse_buttons |= me->button(); + break; + } case QEvent::MouseButtonRelease: { QMouseEvent *me = static_cast<QMouseEvent*>(e); @@ -2995,6 +3002,7 @@ bool QApplication::notify(QObject *receiver, QEvent *e) mouse->modifiers()); me.spont = mouse->spontaneous(); me.setTimestamp(mouse->timestamp()); + QGuiApplicationPrivate::setMouseEventFlags(&me, mouse->flags()); // throw away any mouse-tracking-only mouse events if (!w->hasMouseTracking() && mouse->type() == QEvent::MouseMove && mouse->buttons() == 0) { @@ -3748,6 +3756,7 @@ void QApplicationPrivate::giveFocusAccordingToFocusPolicy(QWidget *widget, QEven switch (event->type()) { case QEvent::MouseButtonPress: + case QEvent::MouseButtonDblClick: case QEvent::TouchBegin: if (setFocusOnRelease) return; |