GraphicsView: use range-based for instead of foreach

Change-Id: I8e1b50bcbffdb492dc10662150b51b0eed1e228e
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
bb10
Anton Kudryavtsev 2018-04-12 18:42:13 +03:00 committed by Anton Kudryavtsev
parent 302a1bc7b7
commit 53f52edb2a
4 changed files with 4 additions and 4 deletions

View File

@ -2526,7 +2526,7 @@ QGraphicsAnchorLayoutPrivate::getGraphParts(Orientation orientation)
// Check if this constraint have some overlap with current
// trunk variables...
foreach (QSimplexVariable *ad, trunkVariables) {
for (QSimplexVariable *ad : qAsConst(trunkVariables)) {
if (c->variables.contains(ad)) {
match = true;
break;

View File

@ -7308,7 +7308,7 @@ void QGraphicsItem::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
selectedItems = d_ptr->scene->selectedItems();
initialPositions = d_ptr->scene->d_func()->movingItemsInitialPositions;
if (initialPositions.isEmpty()) {
foreach (QGraphicsItem *item, selectedItems)
for (QGraphicsItem *item : qAsConst(selectedItems))
initialPositions[item] = item->pos();
initialPositions[this] = pos();
}

View File

@ -6391,7 +6391,7 @@ void QGraphicsScenePrivate::gestureEventHandler(QGestureEvent *event)
ev.setWidget(event->widget());
sendEvent(receiver.data(), &ev);
QSet<QGesture *> ignoredGestures;
foreach (QGesture *g, gestures) {
for (QGesture *g : qAsConst(gestures)) {
if (!ev.isAccepted() && !ev.isAccepted(g)) {
// if the gesture was ignored by its target, we will update the
// targetItems list with a possible target items (items that

View File

@ -2703,7 +2703,7 @@ void QGraphicsView::updateScene(const QList<QRectF> &rects)
dirtyViewportRects << xrect;
}
foreach (const QRect &rect, dirtyViewportRects) {
for (const QRect &rect : qAsConst(dirtyViewportRects)) {
// Add the exposed rect to the update region. In rect update
// mode, we only count the bounding rect of items.
if (!boundingRectUpdate) {