summaryrefslogtreecommitdiffstats
path: root/src/gui/graphicsview
diff options
context:
space:
mode:
authorJan-Arve Sæther <jan-arve.saether@nokia.com>2009-06-11 13:25:05 (GMT)
committerEduardo M. Fleury <eduardo.fleury@openbossa.org>2009-07-22 18:04:29 (GMT)
commitb7150b21f02435abb8f7a4d94b929ecdad2ef79b (patch)
tree96e2e196680c6b44ea9a34f5f6ad216823ed8089 /src/gui/graphicsview
parenta41ac791921329c33947a0748d76683868a9bbf6 (diff)
downloadQt-b7150b21f02435abb8f7a4d94b929ecdad2ef79b.zip
Qt-b7150b21f02435abb8f7a4d94b929ecdad2ef79b.tar.gz
Qt-b7150b21f02435abb8f7a4d94b929ecdad2ef79b.tar.bz2
Simplify the code that finds the sequential chunks for simplification.
If two vertices are adjacent in the candidate list they should also be adjacent in the graph. This means there should always be an edge between candidates.at(n) and candidates.at(n + 1).
Diffstat (limited to 'src/gui/graphicsview')
-rw-r--r--src/gui/graphicsview/qgraphicsanchorlayout_p.cpp18
1 files changed, 4 insertions, 14 deletions
diff --git a/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp b/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp
index 0339f41..3745b3b 100644
--- a/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp
+++ b/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp
@@ -282,20 +282,10 @@ void QGraphicsAnchorLayoutPrivate::simplifyGraph(QGraphicsAnchorLayoutPrivate::O
for (i = 1; i <= candidates.count() + 1; ++i) {
AnchorVertex *v1 = (i <= candidates.count()) ? candidates.at(i - 1) : afterSequence;
AnchorData *data = g.edgeData(prev, v1);
- bool shouldSimplify = false;
- if (data) {
- if (!forwardSet) {
- forward = (prev == data->origin ? true : false);
- forwardSet = true;
- } else if ((forward != (prev == data->origin))) {
- shouldSimplify = true;
- }
- } else {
- shouldSimplify = true;
- forwardSet = false;
- }
-
- if (shouldSimplify) {
+ Q_ASSERT(data);
+ if (i == 1) {
+ forward = (prev == data->origin ? true : false);
+ } else if ((forward != (prev == data->origin))) {
intervalTo = i - 1;
if (intervalTo - intervalFrom >= 2) {
// simplify in the range [intervalFrom, intervalTo]