diff options
author | Laszlo Agocs <laszlo.agocs@digia.com> | 2013-09-20 14:01:30 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-10-14 17:53:51 +0200 |
commit | 9443e72a92a4d1d717e931ee9149c1e3652e9f53 (patch) | |
tree | 86e152f7c4564eb6a8a24dfca69178a1ff7ddbfc /src/quick/items/qquickwindow.cpp | |
parent | 22d994ba7b6f3d2f5833a092d15a71d03c309c55 (diff) |
Ignore mouse events synthesized by the OS in Quick2
Make QQuickWindow ignore mouse events generated by the system from
touch events (e.g. on Windows). This will allow us to remove the
mousefromtouch parameter for the windows plugin and restore accepting
all mouse events in the platform plugin as the default behavior.
Change-Id: I82ff5fa97b02ebc69b61735e2366176e0a6a406c
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
Reviewed-by: Shawn Rutledge <shawn.rutledge@digia.com>
Diffstat (limited to 'src/quick/items/qquickwindow.cpp')
-rw-r--r-- | src/quick/items/qquickwindow.cpp | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/quick/items/qquickwindow.cpp b/src/quick/items/qquickwindow.cpp index fd0313aed5..894059e193 100644 --- a/src/quick/items/qquickwindow.cpp +++ b/src/quick/items/qquickwindow.cpp @@ -470,6 +470,7 @@ static QMouseEvent *touchToMouseEvent(QEvent::Type type, const QTouchEvent::Touc transformedVelocity = transformMatrix.mapVector(p.velocity()).toVector2D(); } QGuiApplicationPrivate::setMouseEventCapsAndVelocity(me, event->device()->capabilities(), transformedVelocity); + QGuiApplicationPrivate::setMouseEventSource(me, Qt::MouseEventSynthesizedByQt); return me; } @@ -1286,6 +1287,7 @@ QMouseEvent *QQuickWindowPrivate::cloneMouseEvent(QMouseEvent *event, QPointF *t event->windowPos(), event->screenPos(), event->button(), event->buttons(), event->modifiers()); QGuiApplicationPrivate::setMouseEventCapsAndVelocity(me, caps, velocity); + QGuiApplicationPrivate::setMouseEventSource(me, QGuiApplicationPrivate::mouseEventSource(event)); me->setTimestamp(event->timestamp()); return me; } @@ -1362,6 +1364,12 @@ bool QQuickWindowPrivate::deliverMouseEvent(QMouseEvent *event) void QQuickWindow::mousePressEvent(QMouseEvent *event) { Q_D(QQuickWindow); + + if (event->source() == Qt::MouseEventSynthesizedBySystem) { + event->accept(); + return; + } + #ifdef MOUSE_DEBUG qWarning() << "QQuickWindow::mousePressEvent()" << event->localPos() << event->button() << event->buttons(); #endif @@ -1373,6 +1381,12 @@ void QQuickWindow::mousePressEvent(QMouseEvent *event) void QQuickWindow::mouseReleaseEvent(QMouseEvent *event) { Q_D(QQuickWindow); + + if (event->source() == Qt::MouseEventSynthesizedBySystem) { + event->accept(); + return; + } + #ifdef MOUSE_DEBUG qWarning() << "QQuickWindow::mouseReleaseEvent()" << event->localPos() << event->button() << event->buttons(); #endif @@ -1391,6 +1405,12 @@ void QQuickWindow::mouseReleaseEvent(QMouseEvent *event) void QQuickWindow::mouseDoubleClickEvent(QMouseEvent *event) { Q_D(QQuickWindow); + + if (event->source() == Qt::MouseEventSynthesizedBySystem) { + event->accept(); + return; + } + #ifdef MOUSE_DEBUG qWarning() << "QQuickWindow::mouseDoubleClickEvent()" << event->localPos() << event->button() << event->buttons(); #endif @@ -1426,6 +1446,12 @@ bool QQuickWindowPrivate::sendHoverEvent(QEvent::Type type, QQuickItem *item, void QQuickWindow::mouseMoveEvent(QMouseEvent *event) { Q_D(QQuickWindow); + + if (event->source() == Qt::MouseEventSynthesizedBySystem) { + event->accept(); + return; + } + #ifdef MOUSE_DEBUG qWarning() << "QQuickWindow::mouseMoveEvent()" << event->localPos() << event->button() << event->buttons(); #endif |