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>
This commit is contained in:
parent
88ab9e1800
commit
21fa38b6ad
@ -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;
|
||||
}
|
||||
|
@ -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());
|
||||
|
@ -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);
|
||||
|
@ -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, ©);
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user