summaryrefslogtreecommitdiffstats
path: root/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp
diff options
context:
space:
mode:
authorCaio Marcelo de Oliveira Filho <caio.oliveira@openbossa.org>2009-11-18 19:00:32 (GMT)
committerEduardo M. Fleury <eduardo.fleury@openbossa.org>2009-11-27 19:19:09 (GMT)
commitd622aef01e5c2624cd64c92ce77064718c6576af (patch)
tree92d62388947dcd323127849ea6543332bff529df /src/gui/graphicsview/qgraphicsanchorlayout_p.cpp
parent12341a4e33a498037679e27edee829fa245a0148 (diff)
downloadQt-d622aef01e5c2624cd64c92ce77064718c6576af.zip
Qt-d622aef01e5c2624cd64c92ce77064718c6576af.tar.gz
Qt-d622aef01e5c2624cd64c92ce77064718c6576af.tar.bz2
QGAL: move second child direction check to a function
In a parallel anchor, the second child anchor may be forward or backwards in relation to the parallel itself. Moves the directionality check to a function. It'll be useful in the next commit. Signed-off-by: Caio Marcelo de Oliveira Filho <caio.oliveira@openbossa.org> Reviewed-by: Eduardo M. Fleury <eduardo.fleury@openbossa.org>
Diffstat (limited to 'src/gui/graphicsview/qgraphicsanchorlayout_p.cpp')
-rw-r--r--src/gui/graphicsview/qgraphicsanchorlayout_p.cpp26
1 files changed, 15 insertions, 11 deletions
diff --git a/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp b/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp
index a69d8f3..4ee58d1 100644
--- a/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp
+++ b/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp
@@ -265,13 +265,7 @@ void ParallelAnchorData::updateChildrenSizes()
firstEdge->sizeAtPreferred = sizeAtPreferred;
firstEdge->sizeAtMaximum = sizeAtMaximum;
- // We have the convention that the first children will define the direction of the
- // pararell group. So we can check whether the second edge is "forward" in relation
- // to the group if it have the same direction as the first edge. Note that we don't
- // use 'this->from' because it might be changed by vertex simplification.
- const bool secondForward = (firstEdge->from == secondEdge->from);
-
- if (secondForward) {
+ if (secondForward()) {
secondEdge->sizeAtMinimum = sizeAtMinimum;
secondEdge->sizeAtPreferred = sizeAtPreferred;
secondEdge->sizeAtMaximum = sizeAtMaximum;
@@ -296,10 +290,20 @@ bool ParallelAnchorData::calculateSizeHints()
// to a backwards anchor of size (-max, -pref, -min)
// Also see comments in updateChildrenSizes().
- const bool secondForward = (firstEdge->from == secondEdge->from);
- const qreal secondMin = secondForward ? secondEdge->minSize : -secondEdge->maxSize;
- const qreal secondPref = secondForward ? secondEdge->prefSize : -secondEdge->prefSize;
- const qreal secondMax = secondForward ? secondEdge->maxSize : -secondEdge->minSize;
+
+ qreal secondMin;
+ qreal secondPref;
+ qreal secondMax;
+
+ if (secondForward()) {
+ secondMin = secondEdge->minSize;
+ secondPref = secondEdge->prefSize;
+ secondMax = secondEdge->maxSize;
+ } else {
+ secondMin = -secondEdge->maxSize;
+ secondPref = -secondEdge->prefSize;
+ secondMax = -secondEdge->minSize;
+ }
minSize = qMax(firstEdge->minSize, secondMin);
maxSize = qMin(firstEdge->maxSize, secondMax);