From cd260501918ea767e8a3ca33a51b1cb4e1bbd45c Mon Sep 17 00:00:00 2001 From: "Bradley T. Hughes" Date: Thu, 30 Apr 2009 11:27:43 +0200 Subject: Made the Touch* event detection very strict TouchBegin is only "seen" once before all other touch events, TouchUpdate must be after TouchBegin but before TouchEnd, and TouchEnd is only seen once after all other touch events. --- tests/manual/qtouchevent/touchwidget.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/manual/qtouchevent/touchwidget.cpp b/tests/manual/qtouchevent/touchwidget.cpp index 0516c5b..f029f8b 100644 --- a/tests/manual/qtouchevent/touchwidget.cpp +++ b/tests/manual/qtouchevent/touchwidget.cpp @@ -31,7 +31,7 @@ bool TouchWidget::event(QEvent *event) { switch (event->type()) { case QEvent::TouchBegin: - seenTouchBegin = true; + seenTouchBegin = !seenTouchBegin && !seenTouchUpdate && !seenTouchEnd; touchPointCount = qMax(touchPointCount, static_cast(event)->touchPoints().count()); if (acceptTouchBegin) { event->accept(); @@ -39,7 +39,7 @@ bool TouchWidget::event(QEvent *event) } break; case QEvent::TouchUpdate: - seenTouchUpdate = true; + seenTouchUpdate = seenTouchBegin && !seenTouchEnd; touchPointCount = qMax(touchPointCount, static_cast(event)->touchPoints().count()); if (acceptTouchUpdate) { event->accept(); @@ -47,7 +47,7 @@ bool TouchWidget::event(QEvent *event) } break; case QEvent::TouchEnd: - seenTouchEnd = true; + seenTouchEnd = seenTouchBegin && !seenTouchEnd; touchPointCount = qMax(touchPointCount, static_cast(event)->touchPoints().count()); if (closeWindowOnTouchEnd) window()->close(); -- cgit v0.12