summaryrefslogtreecommitdiff
path: root/src/widgets
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@intel.com>2012-05-24 16:43:38 +0200
committerQt by Nokia <qt-info@nokia.com>2012-05-25 21:46:55 +0200
commit7c1e0fef8e35ecd8487c41dc39e7ce46537f3040 (patch)
tree18107ad0061b0d19360f07e79bf19551e404c523 /src/widgets
parent57f243594e83708f2daa8147901cbea965e5c295 (diff)
downloadqtbase-7c1e0fef8e35ecd8487c41dc39e7ce46537f3040.tar.gz
Gestures & events: compile with QT_STRICT_ITERATORS.
There are a few mixed up iterators that needed cleaning up. We're missing a constUpperBound and constLowerBound function, though... This commit sneaks in one change to qtextformat related to QT_STRICT_ITERATORS but not to gestures and events. Change-Id: I8c7c840fb5f46c790adbf52952c6009c5b5f2f43 Reviewed-by: Denis Dzyubenko <denis.dzyubenko@nokia.com>
Diffstat (limited to 'src/widgets')
-rw-r--r--src/widgets/graphicsview/qgraphicsscene.cpp8
-rw-r--r--src/widgets/kernel/qgesturemanager.cpp37
2 files changed, 23 insertions, 22 deletions
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<QGraphicsWidget *>::const_iterator iter = d->popupWidgets.end();
- while (--iter >= d->popupWidgets.begin() && !wheelCandidates.isEmpty()) {
+ QList<QGraphicsWidget *>::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<QGesture *> &ges
if (QGraphicsObject *itemobj = item->toGraphicsObject()) {
QGraphicsItemPrivate *d = item->QGraphicsItem::d_func();
QMap<Qt::GestureType, Qt::GestureFlags>::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<ObjectGesture, QList<QGesture *> >::const_iterator iter = m_objectGestures.begin();
- while (iter != m_objectGestures.end()) {
+ QMap<ObjectGesture, QList<QGesture *> >::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<QObject *,
ContextIterator contextEnd = contexts.end();
for (ContextIterator context = contexts.begin(); context != contextEnd; ++context) {
Qt::GestureType gestureType = context.value();
+ const QMap<Qt::GestureType, QGestureRecognizer *> &const_recognizers = m_recognizers;
QMap<Qt::GestureType, QGestureRecognizer *>::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<Qt::GestureType, Qt::GestureFlags>::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<Qt::GestureType, Qt::GestureFlags>::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<Qt::GestureType, Qt::GestureFlags>::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<QGesture*> &gestures,
QWidget *w = widget->parentWidget();
while (w) {
QMap<Qt::GestureType, Qt::GestureFlags>::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<QGesture *> &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<QGesture *> gestures = it.value();
DEBUG() << "QGestureManager::deliverEvents: sending GestureOverride to"
@@ -676,8 +677,8 @@ void QGestureManager::deliverEvents(const QSet<QGesture *> &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();