diff options
author | Anton Kudryavtsev <a.kudryavtsev@netris.ru> | 2016-07-05 12:12:45 +0300 |
---|---|---|
committer | Anton Kudryavtsev <a.kudryavtsev@netris.ru> | 2016-07-05 18:58:51 +0000 |
commit | b073ba57f821b2e79c553f974d9fba2cbb034ee9 (patch) | |
tree | aaf3ca06f251ce52591438ccec83924739693813 /src/widgets/graphicsview/qgraphicsanchorlayout_p.cpp | |
parent | f217894152a29d4be14aaf604ee4230cb40b9c97 (diff) |
Widgets: use const (and const APIs) more
For CoW types, prefer const methods to avoid needless detach()ing.
Change-Id: Ia6cad50a10facf6fd4f73d1390edb8642a0aed32
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Diffstat (limited to 'src/widgets/graphicsview/qgraphicsanchorlayout_p.cpp')
-rw-r--r-- | src/widgets/graphicsview/qgraphicsanchorlayout_p.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/widgets/graphicsview/qgraphicsanchorlayout_p.cpp b/src/widgets/graphicsview/qgraphicsanchorlayout_p.cpp index 53db11d2d7..4c01219d87 100644 --- a/src/widgets/graphicsview/qgraphicsanchorlayout_p.cpp +++ b/src/widgets/graphicsview/qgraphicsanchorlayout_p.cpp @@ -1082,7 +1082,7 @@ bool QGraphicsAnchorLayoutPrivate::simplifyGraphIteration(QGraphicsAnchorLayoutP if (candidates.isEmpty()) after = (beforeSequence == adjacents.last() ? adjacents.first() : adjacents.last()); else - after = (candidates.last() == adjacents.last() ? adjacents.first() : adjacents.last()); + after = (candidates.constLast() == adjacents.last() ? adjacents.first() : adjacents.last()); // ### At this point we assumed that candidates will not contain 'after', this may not hold // when simplifying FLOATing anchors. @@ -1134,9 +1134,9 @@ bool QGraphicsAnchorLayoutPrivate::simplifyGraphIteration(QGraphicsAnchorLayoutP // One restriction we have is to not simplify half of an anchor and let the other half // unsimplified. So we remove center edges before and after the sequence. - const AnchorData *firstAnchor = g.edgeData(beforeSequence, candidates.first()); + const AnchorData *firstAnchor = g.edgeData(beforeSequence, candidates.constFirst()); if (firstAnchor->isCenterAnchor) { - beforeSequence = candidates.first(); + beforeSequence = candidates.constFirst(); candidates.remove(0); // If there's not candidates to be simplified, leave. @@ -1144,9 +1144,9 @@ bool QGraphicsAnchorLayoutPrivate::simplifyGraphIteration(QGraphicsAnchorLayoutP continue; } - const AnchorData *lastAnchor = g.edgeData(candidates.last(), afterSequence); + const AnchorData *lastAnchor = g.edgeData(candidates.constLast(), afterSequence); if (lastAnchor->isCenterAnchor) { - afterSequence = candidates.last(); + afterSequence = candidates.constLast(); candidates.remove(candidates.count() - 1); if (candidates.isEmpty()) |