aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/items/qquickitem.cpp
diff options
context:
space:
mode:
authorRobin Burchell <robin.burchell@viroteck.net>2016-07-07 21:04:52 +0200
committerRobin Burchell <robin.burchell@viroteck.net>2016-07-08 12:12:33 +0000
commit3bf62521fe1bbc7cbbb394546a2ab7fa792599cf (patch)
tree5776a3f5c872c8355f2f0191786a01e496c72794 /src/quick/items/qquickitem.cpp
parent81867dfbf9c16d4300727a08eed9b5c6c979e0ba (diff)
QQuick{Item,Window}: Port simple loops from foreach to range-for
I'm only doing this for the very simple, obviously OK cases: for any loop that involved possible reentrancy (which in turn can lead to list modification), I have not yet ported them. Change-Id: I9fa7a989707b3e86afbda9b4b83e6870a2d7a5b6 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Diffstat (limited to 'src/quick/items/qquickitem.cpp')
-rw-r--r--src/quick/items/qquickitem.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/quick/items/qquickitem.cpp b/src/quick/items/qquickitem.cpp
index 391a785b8f..988e1d880a 100644
--- a/src/quick/items/qquickitem.cpp
+++ b/src/quick/items/qquickitem.cpp
@@ -102,7 +102,7 @@ void debugFocusTree(QQuickItem *item, QQuickItem *scope = 0, int depth = 1)
<< item->hasActiveFocus()
<< item->isFocusScope()
<< item;
- foreach (QQuickItem *child, item->childItems()) {
+ for (QQuickItem *child : item->childItems()) {
debugFocusTree(
child,
item->isFocusScope() || !scope ? item : scope,
@@ -3356,7 +3356,7 @@ void QQuickItemPrivate::resources_clear(QQmlListProperty<QObject> *prop)
QQuickItem *quickItem = static_cast<QQuickItem *>(prop->object);
QQuickItemPrivate *quickItemPrivate = QQuickItemPrivate::get(quickItem);
if (quickItemPrivate->extra.isAllocated()) {//If extra is not allocated resources is empty.
- foreach (QObject *object, quickItemPrivate->extra->resourcesList) {
+ for (QObject *object : qAsConst(quickItemPrivate->extra->resourcesList)) {
qmlobject_disconnect(object, QObject, SIGNAL(destroyed(QObject*)),
quickItem, QQuickItem, SLOT(_q_resourceObjectDeleted(QObject*)));
}
@@ -7053,7 +7053,7 @@ void QQuickItemPrivate::setHasCursorInChild(bool hasCursor)
if (!hasCursor && subtreeCursorEnabled) {
if (hasCursor)
return; // nope! sorry, I have a cursor myself
- foreach (QQuickItem *otherChild, childItems) {
+ for (QQuickItem *otherChild : qAsConst(childItems)) {
QQuickItemPrivate *otherChildPrivate = QQuickItemPrivate::get(otherChild);
if (otherChildPrivate->subtreeCursorEnabled || otherChildPrivate->hasCursor)
return; // nope! sorry, something else wants it kept on.
@@ -7078,7 +7078,7 @@ void QQuickItemPrivate::setHasHoverInChild(bool hasHover)
if (!hasHover && subtreeHoverEnabled) {
if (hoverEnabled)
return; // nope! sorry, I need hover myself
- foreach (QQuickItem *otherChild, childItems) {
+ for (QQuickItem *otherChild : qAsConst(childItems)) {
QQuickItemPrivate *otherChildPrivate = QQuickItemPrivate::get(otherChild);
if (otherChildPrivate->subtreeHoverEnabled || otherChildPrivate->hoverEnabled)
return; // nope! sorry, something else wants it kept on.
@@ -7099,7 +7099,7 @@ void QQuickItemPrivate::markObjects(QV4::ExecutionEngine *e)
Q_Q(QQuickItem);
QV4::QObjectWrapper::markWrapper(q, e);
- foreach (QQuickItem *child, childItems)
+ for (QQuickItem *child : qAsConst(childItems))
QQuickItemPrivate::get(child)->markObjects(e);
}