From 66faa6f11f78b5fa4f3da52e74d6ef501bb19ca5 Mon Sep 17 00:00:00 2001 From: Denis Dzyubenko Date: Mon, 27 Apr 2009 12:05:25 +0200 Subject: Replaced inefficient foreach with a for loop. --- src/gui/kernel/qgesturemanager.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/gui/kernel/qgesturemanager.cpp b/src/gui/kernel/qgesturemanager.cpp index 3bdd323..994b2b6 100644 --- a/src/gui/kernel/qgesturemanager.cpp +++ b/src/gui/kernel/qgesturemanager.cpp @@ -141,11 +141,15 @@ bool QGestureManager::filterEvent(QEvent *event) } activeGestures -= newMaybeGestures; activeGestures += startedGestures; - foreach(QGestureRecognizer *r, startedGestures+finishedGestures+notGestures) { - QMap::iterator it = maybeGestures.find(r); - if (it != maybeGestures.end()) { + for(QMap::iterator it = maybeGestures.begin(); + it != maybeGestures.end();) { + QGestureRecognizer *r = it.key(); + if (startedGestures.contains(r) || finishedGestures.contains(r) || + notGestures.contains(r)) { killTimer(it.value()); - maybeGestures.erase(it); + it = maybeGestures.erase(it); + } else { + ++it; } } foreach(QGestureRecognizer *r, newMaybeGestures) { -- cgit v0.12