summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/declarative/graphicsitems/qdeclarativepainteditem.cpp10
-rw-r--r--src/plugins/qmltooling/qmldbg_inspector/editor/subcomponentmasklayeritem.cpp2
2 files changed, 4 insertions, 8 deletions
diff --git a/src/declarative/graphicsitems/qdeclarativepainteditem.cpp b/src/declarative/graphicsitems/qdeclarativepainteditem.cpp
index 02cefc84..4d7f2111 100644
--- a/src/declarative/graphicsitems/qdeclarativepainteditem.cpp
+++ b/src/declarative/graphicsitems/qdeclarativepainteditem.cpp
@@ -341,10 +341,7 @@ void QDeclarativePaintedItem::paint(QPainter *p, const QStyleOptionGraphicsItem
uncached += d->imagecache[oldest]->area;
delete d->imagecache.takeAt(oldest);
}
- const QRegion bigger = QRegion(biggerrect) & uncached;
- const QVector<QRect> rects = bigger.rects();
- for (int i = 0; i < rects.count(); ++i) {
- const QRect &r = rects.at(i);
+ for (const QRect &r : QRegion(biggerrect) & uncached) {
QPixmap img(r.size());
if (d->fillColor.isValid())
img.fill(d->fillColor);
@@ -374,9 +371,8 @@ void QDeclarativePaintedItem::paint(QPainter *p, const QStyleOptionGraphicsItem
p->drawPixmap(r, newitem->image);
}
} else {
- const QVector<QRect> rects = uncached.rects();
- for (int i = 0; i < rects.count(); ++i)
- p->fillRect(rects.at(i), Qt::lightGray);
+ for (const QRect &r : uncached)
+ p->fillRect(r, Qt::lightGray);
}
}
diff --git a/src/plugins/qmltooling/qmldbg_inspector/editor/subcomponentmasklayeritem.cpp b/src/plugins/qmltooling/qmldbg_inspector/editor/subcomponentmasklayeritem.cpp
index 8a94f9f7..a3b7a6b2 100644
--- a/src/plugins/qmltooling/qmldbg_inspector/editor/subcomponentmasklayeritem.cpp
+++ b/src/plugins/qmltooling/qmldbg_inspector/editor/subcomponentmasklayeritem.cpp
@@ -82,7 +82,7 @@ static QRectF resizeRect(const QRectF &newRect, const QRectF &oldRect)
static QPolygonF regionToPolygon(const QRegion &region)
{
QPainterPath path;
- foreach (const QRect &rect, region.rects())
+ for (const QRect &rect : region)
path.addRect(rect);
return path.toFillPolygon();
}