diff options
author | Richard Moe Gustavsen <richard.gustavsen@digia.com> | 2013-05-02 10:12:30 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-05-07 14:31:02 +0200 |
commit | 0d308c4111f7cd322ed4a07e04b83c20e923e06a (patch) | |
tree | 41f140350af19cde426e98147a8d077e574d2e51 /src/widgets | |
parent | 3c46b829f9103300f7ffe6f44e7ba287efec7777 (diff) |
QApplication: fix touch to mouse bug when setting buttons()
QApplicationPrivate::translateTouchToMouse always sets
buttons() to Qt::LeftButton for synthesised events. This is wrong
for a mouse release, since 'button' should in that case be
Qt::LeftButton, and 'buttons' should be Qt::NoButton (since no buttons
are actually being pressed).
This caused problems for QGraphicsView, which refuses to
release any mouse grab set on a QGraphicsItem if at least one
button is being pressed (which was always true).
This resulted in broken drag behavior on touch platforms.
Change-Id: Iefe63cd753f9f8bb04278fd04a4d728e3deda25e
Reviewed-by: Samuel Rødal <samuel.rodal@digia.com>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@digia.com>
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@digia.com>
Reviewed-by: Shawn Rutledge <shawn.rutledge@digia.com>
Diffstat (limited to 'src/widgets')
-rw-r--r-- | src/widgets/kernel/qapplication.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/widgets/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp index b8d3117a41..edd7cafd83 100644 --- a/src/widgets/kernel/qapplication.cpp +++ b/src/widgets/kernel/qapplication.cpp @@ -3821,7 +3821,8 @@ bool QApplicationPrivate::translateTouchToMouse(QWidget *widget, QTouchEvent *ev const QPoint pos = widget->mapFromGlobal(p.screenPos().toPoint()); QMouseEvent mouseEvent(eventType, pos, p.screenPos().toPoint(), - Qt::LeftButton, Qt::LeftButton, + Qt::LeftButton, + (eventType == QEvent::MouseButtonRelease) ? Qt::NoButton : Qt::LeftButton, event->modifiers()); mouseEvent.setAccepted(true); mouseEvent.setTimestamp(event->timestamp()); |