summaryrefslogtreecommitdiffstats
path: root/src/widgets
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2020-11-24 11:00:10 +0100
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2020-11-27 08:28:24 +0100
commit21fa38b6ad0167673148709faa4907b220853c5a (patch)
treef347cce94e6cd7b92548f74058a04c01b7579872 /src/widgets
parent88ab9e1800f943b5c4bf06bb68baaff07185eb24 (diff)
QtWidgets: Propagate event device when translating mouse events
There are a few places left over, for example the QTextEdit creating mouse events in a timer and notably QGraphicsView. Task-number: QTBUG-88678 Task-number: QTBUG-46412 Pick-to: 6.0 Change-Id: I7ed23911be3b86b4b39fb478b947ec3b7a60761f Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
Diffstat (limited to 'src/widgets')
-rw-r--r--src/widgets/itemviews/qabstractitemview.cpp3
-rw-r--r--src/widgets/kernel/qapplication.cpp3
-rw-r--r--src/widgets/kernel/qwidgetwindow.cpp6
-rw-r--r--src/widgets/util/qflickgesture.cpp3
-rw-r--r--src/widgets/widgets/qmenu.cpp3
5 files changed, 12 insertions, 6 deletions
diff --git a/src/widgets/itemviews/qabstractitemview.cpp b/src/widgets/itemviews/qabstractitemview.cpp
index 38fd4f1fcc..2e0ddf678f 100644
--- a/src/widgets/itemviews/qabstractitemview.cpp
+++ b/src/widgets/itemviews/qabstractitemview.cpp
@@ -1969,7 +1969,8 @@ void QAbstractItemView::mouseDoubleClickEvent(QMouseEvent *event)
|| (d->pressedIndex != index)) {
QMouseEvent me(QEvent::MouseButtonPress,
event->position(), event->scenePosition(), event->globalPosition(),
- event->button(), event->buttons(), event->modifiers(), event->source());
+ event->button(), event->buttons(), event->modifiers(),
+ event->source(), event->pointingDevice());
mousePressEvent(&me);
return;
}
diff --git a/src/widgets/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp
index 97753b6af4..70616ed2b5 100644
--- a/src/widgets/kernel/qapplication.cpp
+++ b/src/widgets/kernel/qapplication.cpp
@@ -2842,7 +2842,8 @@ bool QApplication::notify(QObject *receiver, QEvent *e)
QPointer<QWidget> pw = w;
while (w) {
QMouseEvent me(mouse->type(), relpos, mouse->scenePosition(), mouse->globalPosition().toPoint(),
- mouse->button(), mouse->buttons(), mouse->modifiers(), mouse->source());
+ mouse->button(), mouse->buttons(), mouse->modifiers(), mouse->source(),
+ mouse->pointingDevice());
me.m_spont = mouse->spontaneous();
me.setTimestamp(mouse->timestamp());
QMutableSinglePointEvent::from(me).setDoubleClick(QMutableSinglePointEvent::from(mouse)->isDoubleClick());
diff --git a/src/widgets/kernel/qwidgetwindow.cpp b/src/widgets/kernel/qwidgetwindow.cpp
index c88d63686c..e4e8f9f9d1 100644
--- a/src/widgets/kernel/qwidgetwindow.cpp
+++ b/src/widgets/kernel/qwidgetwindow.cpp
@@ -569,7 +569,8 @@ void QWidgetWindow::handleMouseEvent(QMouseEvent *event)
const auto buttons = event->type() == QEvent::MouseMove && qt_popup_down_closed
? Qt::NoButton : event->buttons();
QMouseEvent e(event->type(), widgetPos, event->scenePosition(), event->globalPosition(),
- event->button(), buttons, event->modifiers(), event->source());
+ event->button(), buttons, event->modifiers(),
+ event->source(), event->pointingDevice());
e.setTimestamp(event->timestamp());
QApplicationPrivate::sendMouseEvent(receiver, &e, receiver, receiver->window(), &qt_button_down, qt_last_mouse_receiver);
qt_last_mouse_receiver = receiver;
@@ -671,7 +672,8 @@ void QWidgetWindow::handleMouseEvent(QMouseEvent *event)
// The preceding statement excludes MouseButtonPress events which caused
// creation of a MouseButtonDblClick event. QTBUG-25831
QMouseEvent translated(event->type(), mapped, event->scenePosition(), event->globalPosition(),
- event->button(), event->buttons(), event->modifiers(), event->source());
+ event->button(), event->buttons(), event->modifiers(),
+ event->source(), event->pointingDevice());
translated.setTimestamp(event->timestamp());
QApplicationPrivate::sendMouseEvent(receiver, &translated, widget, m_widget,
&qt_button_down, qt_last_mouse_receiver);
diff --git a/src/widgets/util/qflickgesture.cpp b/src/widgets/util/qflickgesture.cpp
index d23dfda83e..e5457243a0 100644
--- a/src/widgets/util/qflickgesture.cpp
+++ b/src/widgets/util/qflickgesture.cpp
@@ -299,7 +299,8 @@ protected:
if (me) {
QMouseEvent copy(me->type(), mouseTarget->mapFromGlobal(me->globalPosition()),
mouseTarget->topLevelWidget()->mapFromGlobal(me->globalPosition()), me->globalPosition(),
- me->button(), me->buttons(), me->modifiers(), me->source());
+ me->button(), me->buttons(), me->modifiers(),
+ me->source(), me->pointingDevice());
qt_sendSpontaneousEvent(mouseTarget, &copy);
}
diff --git a/src/widgets/widgets/qmenu.cpp b/src/widgets/widgets/qmenu.cpp
index 85dbe9b6e0..ab38abaed6 100644
--- a/src/widgets/widgets/qmenu.cpp
+++ b/src/widgets/widgets/qmenu.cpp
@@ -1366,7 +1366,8 @@ bool QMenuPrivate::mouseEventTaken(QMouseEvent *e)
if (passOnEvent) {
if (e->type() != QEvent::MouseButtonRelease || mouseDown == caused) {
QMouseEvent new_e(e->type(), cpos, caused->mapTo(caused->topLevelWidget(), cpos), e->globalPosition(),
- e->button(), e->buttons(), e->modifiers(), e->source());
+ e->button(), e->buttons(), e->modifiers(),
+ e->source(), e->pointingDevice());
QCoreApplication::sendEvent(caused, &new_e);
return true;
}