diff options
author | Denis Dzyubenko <denis.dzyubenko@nokia.com> | 2009-09-01 09:08:57 (GMT) |
---|---|---|
committer | Denis Dzyubenko <denis.dzyubenko@nokia.com> | 2009-09-03 09:30:54 (GMT) |
commit | 0d5b6dccf5fa854632e61971364629b36e0d3857 (patch) | |
tree | 1112e12cdd513b661261778f793cce30b5fb25f2 /src/gui/kernel | |
parent | 9f455fc7088a059899fa8346f34d6b96e908fea6 (diff) | |
download | Qt-0d5b6dccf5fa854632e61971364629b36e0d3857.zip Qt-0d5b6dccf5fa854632e61971364629b36e0d3857.tar.gz Qt-0d5b6dccf5fa854632e61971364629b36e0d3857.tar.bz2 |
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
Diffstat (limited to 'src/gui/kernel')
-rw-r--r-- | src/gui/kernel/qgesture.cpp | 7 |
1 files 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) |