diff --git a/src/gui/text/qtextformat.cpp b/src/gui/text/qtextformat.cpp index 6d9eeab660..9995110c1d 100644 --- a/src/gui/text/qtextformat.cpp +++ b/src/gui/text/qtextformat.cpp @@ -3296,8 +3296,8 @@ QTextFormatCollection::~QTextFormatCollection() int QTextFormatCollection::indexForFormat(const QTextFormat &format) { uint hash = getHash(format.d, format.format_type); - QMultiHash::const_iterator i = hashes.find(hash); - while (i != hashes.end() && i.key() == hash) { + QMultiHash::const_iterator i = hashes.constFind(hash); + while (i != hashes.constEnd() && i.key() == hash) { if (formats.value(i.value()) == format) { return i.value(); } diff --git a/src/widgets/graphicsview/qgraphicsscene.cpp b/src/widgets/graphicsview/qgraphicsscene.cpp index 282c6a2a2a..21db5bd53a 100644 --- a/src/widgets/graphicsview/qgraphicsscene.cpp +++ b/src/widgets/graphicsview/qgraphicsscene.cpp @@ -4193,8 +4193,8 @@ void QGraphicsScene::wheelEvent(QGraphicsSceneWheelEvent *wheelEvent) // Find the first popup under the mouse (including the popup's descendants) starting from the last. // Remove all popups after the one found, or all or them if no popup is under the mouse. // Then continue with the event. - QList::const_iterator iter = d->popupWidgets.end(); - while (--iter >= d->popupWidgets.begin() && !wheelCandidates.isEmpty()) { + QList::const_iterator iter = d->popupWidgets.constEnd(); + while (--iter >= d->popupWidgets.constBegin() && !wheelCandidates.isEmpty()) { if (wheelCandidates.first() == *iter || (*iter)->isAncestorOf(wheelCandidates.first())) break; d->removePopup(*iter); @@ -6126,8 +6126,8 @@ void QGraphicsScenePrivate::gestureTargetsAtHotSpots(const QSet &ges if (QGraphicsObject *itemobj = item->toGraphicsObject()) { QGraphicsItemPrivate *d = item->QGraphicsItem::d_func(); QMap::const_iterator it = - d->gestureContext.find(gestureType); - if (it != d->gestureContext.end() && (!flag || (it.value() & flag))) { + d->gestureContext.constFind(gestureType); + if (it != d->gestureContext.constEnd() && (!flag || (it.value() & flag))) { if (normalGestures.contains(gesture)) { normalGestures.remove(gesture); if (conflicts) diff --git a/src/widgets/kernel/qgesturemanager.cpp b/src/widgets/kernel/qgesturemanager.cpp index 8ba8904684..4d05e0da2c 100644 --- a/src/widgets/kernel/qgesturemanager.cpp +++ b/src/widgets/kernel/qgesturemanager.cpp @@ -140,8 +140,8 @@ void QGestureManager::unregisterGestureRecognizer(Qt::GestureType type) } } - QMap >::const_iterator iter = m_objectGestures.begin(); - while (iter != m_objectGestures.end()) { + QMap >::const_iterator iter = m_objectGestures.constBegin(); + while (iter != m_objectGestures.constEnd()) { ObjectGesture objectGesture = iter.key(); if (objectGesture.gesture == type) { foreach (QGesture *g, iter.value()) { @@ -248,9 +248,10 @@ bool QGestureManager::filterEventThroughContexts(const QMultiMap &const_recognizers = m_recognizers; QMap::const_iterator - typeToRecognizerIterator = m_recognizers.lowerBound(gestureType), - typeToRecognizerEnd = m_recognizers.upperBound(gestureType); + typeToRecognizerIterator = const_recognizers.lowerBound(gestureType), + typeToRecognizerEnd = const_recognizers.upperBound(gestureType); for (; typeToRecognizerIterator != typeToRecognizerEnd; ++typeToRecognizerIterator) { QGestureRecognizer *recognizer = typeToRecognizerIterator.value(); QObject *target = context.key(); @@ -468,8 +469,8 @@ bool QGestureManager::filterEvent(QWidget *receiver, QEvent *event) QWidget *w = receiver; typedef QMap::const_iterator ContextIterator; if (!w->d_func()->gestureContext.isEmpty()) { - for(ContextIterator it = w->d_func()->gestureContext.begin(), - e = w->d_func()->gestureContext.end(); it != e; ++it) { + for(ContextIterator it = w->d_func()->gestureContext.constBegin(), + e = w->d_func()->gestureContext.constEnd(); it != e; ++it) { types.insert(it.key(), 0); contexts.insertMulti(w, it.key()); } @@ -478,8 +479,8 @@ bool QGestureManager::filterEvent(QWidget *receiver, QEvent *event) w = w->isWindow() ? 0 : w->parentWidget(); while (w) { - for (ContextIterator it = w->d_func()->gestureContext.begin(), - e = w->d_func()->gestureContext.end(); it != e; ++it) { + for (ContextIterator it = w->d_func()->gestureContext.constBegin(), + e = w->d_func()->gestureContext.constEnd(); it != e; ++it) { if (!(it.value() & Qt::DontStartGestureOnChildren)) { if (!types.contains(it.key())) { types.insert(it.key(), 0); @@ -502,8 +503,8 @@ bool QGestureManager::filterEvent(QGraphicsObject *receiver, QEvent *event) QGraphicsObject *item = receiver; if (!item->QGraphicsItem::d_func()->gestureContext.isEmpty()) { typedef QMap::const_iterator ContextIterator; - for(ContextIterator it = item->QGraphicsItem::d_func()->gestureContext.begin(), - e = item->QGraphicsItem::d_func()->gestureContext.end(); it != e; ++it) { + for(ContextIterator it = item->QGraphicsItem::d_func()->gestureContext.constBegin(), + e = item->QGraphicsItem::d_func()->gestureContext.constEnd(); it != e; ++it) { types.insert(it.key(), 0); contexts.insertMulti(item, it.key()); } @@ -513,8 +514,8 @@ bool QGestureManager::filterEvent(QGraphicsObject *receiver, QEvent *event) while (item) { typedef QMap::const_iterator ContextIterator; - for (ContextIterator it = item->QGraphicsItem::d_func()->gestureContext.begin(), - e = item->QGraphicsItem::d_func()->gestureContext.end(); it != e; ++it) { + for (ContextIterator it = item->QGraphicsItem::d_func()->gestureContext.constBegin(), + e = item->QGraphicsItem::d_func()->gestureContext.constEnd(); it != e; ++it) { if (!(it.value() & Qt::DontStartGestureOnChildren)) { if (!types.contains(it.key())) { types.insert(it.key(), 0); @@ -559,8 +560,8 @@ void QGestureManager::getGestureTargets(const QSet &gestures, QWidget *w = widget->parentWidget(); while (w) { QMap::const_iterator it - = w->d_func()->gestureContext.find(type); - if (it != w->d_func()->gestureContext.end()) { + = w->d_func()->gestureContext.constFind(type); + if (it != w->d_func()->gestureContext.constEnd()) { // i.e. 'w' listens to gesture 'type' if (!(it.value() & Qt::DontStartGestureOnChildren) && w != widget) { // conflicting gesture! @@ -642,8 +643,8 @@ void QGestureManager::deliverEvents(const QSet &gestures, << "\n"; // if there are conflicting gestures, send the GestureOverride event - for (GesturesPerWidget::const_iterator it = conflictedGestures.begin(), - e = conflictedGestures.end(); it != e; ++it) { + for (GesturesPerWidget::const_iterator it = conflictedGestures.constBegin(), + e = conflictedGestures.constEnd(); it != e; ++it) { QWidget *receiver = it.key(); QList gestures = it.value(); DEBUG() << "QGestureManager::deliverEvents: sending GestureOverride to" @@ -676,8 +677,8 @@ void QGestureManager::deliverEvents(const QSet &gestures, } // delivering gestures that are not in conflicted state - for (GesturesPerWidget::const_iterator it = normalStartedGestures.begin(), - e = normalStartedGestures.end(); it != e; ++it) { + for (GesturesPerWidget::const_iterator it = normalStartedGestures.constBegin(), + e = normalStartedGestures.constEnd(); it != e; ++it) { if (!it.value().isEmpty()) { DEBUG() << "QGestureManager::deliverEvents: sending to" << it.key() << "gestures:" << it.value();