diff options
author | Eduardo M. Fleury <eduardo.fleury@openbossa.org> | 2009-08-08 00:46:38 (GMT) |
---|---|---|
committer | Jan-Arve Sæther <jan-arve.saether@nokia.com> | 2009-08-10 07:46:54 (GMT) |
commit | c08f8182d81e053b4030e8883acb95de1d9aba84 (patch) | |
tree | 70bc283660a175130014e9b076be596759cc5511 /src/gui/graphicsview/qgraphicsanchorlayout_p.cpp | |
parent | f48d5dd7554edef5ac3fa11ebd86eaa52a8e23b6 (diff) | |
download | Qt-c08f8182d81e053b4030e8883acb95de1d9aba84.zip Qt-c08f8182d81e053b4030e8883acb95de1d9aba84.tar.gz Qt-c08f8182d81e053b4030e8883acb95de1d9aba84.tar.bz2 |
QGraphicsAnchorLayout: Adding updateChildrenSizes method to anchors
This method is meant to be called by the AnchorLayout after it has
set the sizes of all root anchors of a simplified graph.
The idea here it that these anchors will then propagate its new
sizes down the simplification tree.
Signed-off-by: Eduardo M. Fleury <eduardo.fleury@openbossa.org>
Reviewed-by: Jan-Arve Sæther <jan-arve.saether@nokia.com>
Diffstat (limited to 'src/gui/graphicsview/qgraphicsanchorlayout_p.cpp')
-rw-r--r-- | src/gui/graphicsview/qgraphicsanchorlayout_p.cpp | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp b/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp index afe60a1..4844748 100644 --- a/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp +++ b/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp @@ -45,6 +45,30 @@ #include "qgraphicsanchorlayout_p.h" +void ParallelAnchorData::updateChildrenSizes() +{ + firstEdge->sizeAtMinimum = secondEdge->sizeAtMinimum = sizeAtMinimum; + firstEdge->sizeAtPreferred = secondEdge->sizeAtPreferred = sizeAtPreferred; + firstEdge->sizeAtMaximum = secondEdge->sizeAtMaximum = sizeAtMaximum; + + firstEdge->updateChildrenSizes(); + secondEdge->updateChildrenSizes(); +} + +void SequentialAnchorData::updateChildrenSizes() +{ + qreal minFactor = sizeAtMinimum / minSize; + qreal prefFactor = sizeAtPreferred / prefSize; + qreal maxFactor = sizeAtMaximum / maxSize; + + for (int i = 0; i < m_edges.count(); ++i) { + m_edges[i]->sizeAtMinimum = m_edges[i]->minSize * minFactor; + m_edges[i]->sizeAtPreferred = m_edges[i]->prefSize * prefFactor; + m_edges[i]->sizeAtMaximum = m_edges[i]->maxSize * maxFactor; + m_edges[i]->updateChildrenSizes(); + } +} + QSimplexConstraint *GraphPath::constraint(const GraphPath &path) const { // Calculate |