From 0d5b6dccf5fa854632e61971364629b36e0d3857 Mon Sep 17 00:00:00 2001 From: Denis Dzyubenko Date: Tue, 1 Sep 2009 11:08:57 +0200 Subject: Fixed the QGesture::updateState function. When a state changes from NoGesture to any valid gesture state and we emit the started() signal, we need to make sure that the state of the gesture is set to the appropriate Qt::GestureStarted state. Reviewed-by: trustme --- src/gui/kernel/qgesture.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/gui/kernel/qgesture.cpp b/src/gui/kernel/qgesture.cpp index bd37f68..7831893 100644 --- a/src/gui/kernel/qgesture.cpp +++ b/src/gui/kernel/qgesture.cpp @@ -241,15 +241,18 @@ void QGesture::updateState(Qt::GestureState state) return; } const Qt::GestureState oldState = d->state; - d->state = state; if (state != Qt::NoGesture && oldState > state) { // comparing the state as ints: state should only be changed from // started to (optionally) updated and to finished. + d->state = state; qWarning("QGesture::updateState: incorrect new state"); return; } - if (oldState == Qt::NoGesture) + if (oldState == Qt::NoGesture) { + d->state = Qt::GestureStarted; emit started(); + } + d->state = state; if (state == Qt::GestureUpdated) emit triggered(); else if (state == Qt::GestureFinished) -- cgit v0.12