aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/items/qquickpathview.cpp
diff options
context:
space:
mode:
authorAnton Kudryavtsev <a.kudryavtsev@netris.ru>2016-08-09 18:32:48 +0300
committerShawn Rutledge <shawn.rutledge@qt.io>2016-08-12 16:01:10 +0000
commite5592e75b5d17f409a0623f663474f963d66486b (patch)
tree60cc03127ed7e258f01291f059f99a844bc61201 /src/quick/items/qquickpathview.cpp
parent87c23b33b7293a43a851a6e43a0ddc6ef44c17e4 (diff)
Quick: use const (and const APIs) more
For CoW types, prefer const methods to avoid needless detach()ing. Change-Id: I270cdc6eb8c5946f5c20b379bbb7c60f0ba518eb Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/quick/items/qquickpathview.cpp')
-rw-r--r--src/quick/items/qquickpathview.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/quick/items/qquickpathview.cpp b/src/quick/items/qquickpathview.cpp
index c7e476c4b5..1de20ed5b9 100644
--- a/src/quick/items/qquickpathview.cpp
+++ b/src/quick/items/qquickpathview.cpp
@@ -245,7 +245,7 @@ void QQuickPathViewPrivate::clear()
currentItem = 0;
}
for (int i=0; i<items.count(); i++){
- QQuickItem *p = items[i];
+ QQuickItem *p = items.at(i);
releaseItem(p);
}
if (requestedIndex >= 0) {
@@ -1993,8 +1993,8 @@ void QQuickPathView::refill()
endPos = -1.0;
startPos = 2.0;
- for (int i = 0; i < d->items.count(); i++) {
- int idx = d->model->indexOf(d->items[i], 0);
+ for (QQuickItem * item : qAsConst(d->items)) {
+ int idx = d->model->indexOf(item, 0);
qreal curPos = d->positionOfIndex(idx);
if (curPos > endPos) {
endPos = curPos;
@@ -2084,7 +2084,7 @@ void QQuickPathView::refill()
if (!waiting && d->items.count() < count+d->cacheSize) {
qCDebug(lcItemViewDelegateLifecycle) << "Checking for pathview middle inserts, items count was" << d->items.count();
idx = startIdx;
- QQuickItem *lastItem = d->items[0];
+ QQuickItem *lastItem = d->items.at(0);
while (idx != endIdx) {
//This gets the reference from the delegate model, and will not re-create
QQuickItem *item = d->getItem(idx, idx+1, nextPos >= 1.0);
@@ -2300,8 +2300,8 @@ void QQuickPathViewPrivate::createCurrentItem()
return;
bool inItems = false;
- for (int i = 0; i < items.count(); i++) {
- if (model->indexOf(items[i], 0) == currentIndex) {
+ for (QQuickItem *item : qAsConst(items)) {
+ if (model->indexOf(item, 0) == currentIndex) {
inItems = true;
break;
}