diff options
author | Denis Dzyubenko <denis.dzyubenko@nokia.com> | 2009-04-22 13:00:56 (GMT) |
---|---|---|
committer | Denis Dzyubenko <denis.dzyubenko@nokia.com> | 2009-05-11 14:51:54 (GMT) |
commit | 9337786ca073b185f82898e10be473ea4177f787 (patch) | |
tree | 8c850598363a5eb6c222c7b8a5971dfd174a1788 /src/gui/kernel/qgesturestandardrecognizers.cpp | |
parent | ec94be7f23bfd9c13e42b9b20f01af69bae83660 (diff) | |
download | Qt-9337786ca073b185f82898e10be473ea4177f787.zip Qt-9337786ca073b185f82898e10be473ea4177f787.tar.gz Qt-9337786ca073b185f82898e10be473ea4177f787.tar.bz2 |
Allow to start a Pan gesture only with the left mouse button.
Diffstat (limited to 'src/gui/kernel/qgesturestandardrecognizers.cpp')
-rw-r--r-- | src/gui/kernel/qgesturestandardrecognizers.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/gui/kernel/qgesturestandardrecognizers.cpp b/src/gui/kernel/qgesturestandardrecognizers.cpp index 00b4a39..cf2bb41 100644 --- a/src/gui/kernel/qgesturestandardrecognizers.cpp +++ b/src/gui/kernel/qgesturestandardrecognizers.cpp @@ -96,15 +96,19 @@ QGestureRecognizer::Result QGestureRecognizerPan::filterEvent(const QEvent *even reset(); return QGestureRecognizer::NotGesture; } + if (ev->button() != Qt::LeftButton) { + return QGestureRecognizer::NotGesture; + } DEBUG() << "Pan: MouseButtonPress: maybe gesture started"; mousePressed = true; pressedPos = lastPos = currentPos = ev->pos(); return QGestureRecognizer::MaybeGesture; } else if (event->type() == QEvent::MouseButtonRelease) { - if (mousePressed && currentDirection != Qt::NoDirection) { + const QMouseEvent *ev = static_cast<const QMouseEvent*>(event); + if (mousePressed && currentDirection != Qt::NoDirection + && ev->button() == Qt::LeftButton) { DEBUG() << "Pan: MouseButtonRelease: pan detected"; gestureState = Qt::GestureFinished; - const QMouseEvent *ev = static_cast<const QMouseEvent*>(event); currentPos = ev->pos(); internalReset(); return QGestureRecognizer::GestureFinished; |