QGraphicsAnchorLayout: compile with QT_NO_FOREACH
The m_edges container isn't changed after it's initialized in the constructor (in a later commit I'll make this container const, so as to keep this commit backport-able), and it isn't changed by the loop. Port all loops over m_edges to ranged-for. Remove "#undef QT_NO_FOREACH" from the source file, as that was the only usage of foreach in it. And remove that source file from NO_PCH_SOURCES. Pick-to: 6.5 Task-number: QTBUG-115803 Change-Id: I9cfc0c95865cbc7415dbecc82388c64c65ded4be Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de> (cherry picked from commit 641bccce2a80b2a7268c3b8409bdc957b9a510b5) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
fcb2ba3d98
commit
26c3a2fd79
@ -459,9 +459,7 @@ void SequentialAnchorData::updateChildrenSizes()
|
||||
// "from" or "to", that _contains_ one of them.
|
||||
AnchorVertex *prev = from;
|
||||
|
||||
for (int i = 0; i < m_edges.size(); ++i) {
|
||||
AnchorData *e = m_edges.at(i);
|
||||
|
||||
for (AnchorData *e : std::as_const(m_edges)) {
|
||||
const bool edgeIsForward = (e->from == prev);
|
||||
if (edgeIsForward) {
|
||||
e->sizeAtMinimum = interpolate(minFactor, e->minSize, e->minPrefSize,
|
||||
@ -496,9 +494,7 @@ void SequentialAnchorData::calculateSizeHints()
|
||||
|
||||
AnchorVertex *prev = from;
|
||||
|
||||
for (int i = 0; i < m_edges.size(); ++i) {
|
||||
AnchorData *edge = m_edges.at(i);
|
||||
|
||||
for (AnchorData *edge : std::as_const(m_edges)) {
|
||||
const bool edgeIsForward = (edge->from == prev);
|
||||
if (edgeIsForward) {
|
||||
minSize += edge->minSize;
|
||||
@ -532,12 +528,10 @@ void AnchorData::dump(int indent) {
|
||||
p->firstEdge->dump(indent+2);
|
||||
p->secondEdge->dump(indent+2);
|
||||
} else if (type == Sequential) {
|
||||
SequentialAnchorData *s = static_cast<SequentialAnchorData *>(this);
|
||||
int kids = s->m_edges.count();
|
||||
qDebug("%*s type: sequential(%d):", indent, "", kids);
|
||||
for (int i = 0; i < kids; ++i) {
|
||||
s->m_edges.at(i)->dump(indent+2);
|
||||
}
|
||||
const auto *s = static_cast<SequentialAnchorData *>(this);
|
||||
qDebug("%*s type: sequential(%lld):", indent, "", s->m_edges.size());
|
||||
for (AnchorData *e : s->m_edges)
|
||||
e->dump(indent + 2);
|
||||
} else {
|
||||
qDebug("%*s type: Normal:", indent, "");
|
||||
}
|
||||
@ -1153,12 +1147,10 @@ void QGraphicsAnchorLayoutPrivate::restoreSimplifiedAnchor(AnchorData *edge)
|
||||
g.createEdge(edge->from, edge->to, edge);
|
||||
|
||||
} else if (edge->type == AnchorData::Sequential) {
|
||||
SequentialAnchorData *sequence = static_cast<SequentialAnchorData *>(edge);
|
||||
const auto *sequence = static_cast<SequentialAnchorData *>(edge);
|
||||
|
||||
for (int i = 0; i < sequence->m_edges.size(); ++i) {
|
||||
AnchorData *data = sequence->m_edges.at(i);
|
||||
for (AnchorData *data : sequence->m_edges)
|
||||
restoreSimplifiedAnchor(data);
|
||||
}
|
||||
|
||||
delete sequence;
|
||||
|
||||
@ -2554,7 +2546,7 @@ void QGraphicsAnchorLayoutPrivate::identifyNonFloatItems_helper(const AnchorData
|
||||
nonFloatingItemsIdentifiedSoFar->insert(ad->item);
|
||||
break;
|
||||
case AnchorData::Sequential:
|
||||
foreach (const AnchorData *d, static_cast<const SequentialAnchorData *>(ad)->m_edges)
|
||||
for (const AnchorData *d : static_cast<const SequentialAnchorData *>(ad)->m_edges)
|
||||
identifyNonFloatItems_helper(d, nonFloatingItemsIdentifiedSoFar);
|
||||
break;
|
||||
case AnchorData::Parallel:
|
||||
|
Loading…
x
Reference in New Issue
Block a user