diff options
author | Alexander Volkov <a.volkov@rusbitech.ru> | 2015-04-22 18:43:33 +0300 |
---|---|---|
committer | Alexander Volkov <a.volkov@rusbitech.ru> | 2015-05-12 10:17:40 +0000 |
commit | 77e00909951f9274bccec20be950425ba9dbe744 (patch) | |
tree | d348e429407430b4e00e97d7d05e80c43decaf9d /src/widgets/kernel/qwidgetwindow.cpp | |
parent | ac1b6c01454b8969e59becf066bba14f9ed0d310 (diff) |
QMouseEvent: add constructor which takes the source as a parameter
Simplify the code by passing the source of a mouse event
directly to the constructor instead of setting it by
QGuiApplicationPrivate::setMouseEventSource().
Change-Id: I1774cf39a211d36d3adf0ff30f3bd2fb7c5fb429
Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com>
Diffstat (limited to 'src/widgets/kernel/qwidgetwindow.cpp')
-rw-r--r-- | src/widgets/kernel/qwidgetwindow.cpp | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/src/widgets/kernel/qwidgetwindow.cpp b/src/widgets/kernel/qwidgetwindow.cpp index efe7d9415b..d715438bfe 100644 --- a/src/widgets/kernel/qwidgetwindow.cpp +++ b/src/widgets/kernel/qwidgetwindow.cpp @@ -446,8 +446,8 @@ void QWidgetWindow::handleMouseEvent(QMouseEvent *event) if (receiver != popup) widgetPos = receiver->mapFromGlobal(event->globalPos()); QWidget *alien = m_widget->childAt(m_widget->mapFromGlobal(event->globalPos())); - QMouseEvent e(event->type(), widgetPos, event->windowPos(), event->screenPos(), event->button(), event->buttons(), event->modifiers()); - QGuiApplicationPrivate::setMouseEventSource(&e, QGuiApplicationPrivate::mouseEventSource(event)); + QMouseEvent e(event->type(), widgetPos, event->windowPos(), event->screenPos(), + event->button(), event->buttons(), event->modifiers(), event->source()); e.setTimestamp(event->timestamp()); QApplicationPrivate::sendMouseEvent(receiver, &e, alien, m_widget, &qt_button_down, qt_last_mouse_receiver); qt_last_mouse_receiver = receiver; @@ -489,9 +489,9 @@ void QWidgetWindow::handleMouseEvent(QMouseEvent *event) if (globalGeometry.contains(event->globalPos())) { // Use postEvent() to ensure the local QEventLoop terminates when called from QMenu::exec() const QPoint localPos = win->mapFromGlobal(event->globalPos()); - QMouseEvent *e = new QMouseEvent(QEvent::MouseButtonPress, localPos, localPos, event->globalPos(), event->button(), event->buttons(), event->modifiers()); + QMouseEvent *e = new QMouseEvent(QEvent::MouseButtonPress, localPos, localPos, event->globalPos(), + event->button(), event->buttons(), event->modifiers(), event->source()); QCoreApplicationPrivate::setEventSpontaneous(e, true); - QGuiApplicationPrivate::setMouseEventSource(e, QGuiApplicationPrivate::mouseEventSource(event)); e->setTimestamp(event->timestamp()); QCoreApplication::postEvent(win, e); } @@ -548,8 +548,7 @@ 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->windowPos(), event->screenPos(), - event->button(), event->buttons(), event->modifiers()); - QGuiApplicationPrivate::setMouseEventSource(&translated, QGuiApplicationPrivate::mouseEventSource(event)); + event->button(), event->buttons(), event->modifiers(), event->source()); translated.setTimestamp(event->timestamp()); QApplicationPrivate::sendMouseEvent(receiver, &translated, widget, m_widget, &qt_button_down, qt_last_mouse_receiver); |