diff options
author | Eduardo M. Fleury <eduardo.fleury@openbossa.org> | 2009-09-23 19:02:35 (GMT) |
---|---|---|
committer | Jan-Arve Sæther <jan-arve.saether@nokia.com> | 2009-10-06 09:28:26 (GMT) |
commit | 1728f846d9fb53a699782005d6478c0f23f9b82e (patch) | |
tree | 5916d02718f0a25f50e54167a05e05d3d2655349 /src/gui/graphicsview/qgraphicsanchorlayout_p.h | |
parent | bfc1a75616e1c96a018349084fae844d7efbc177 (diff) | |
download | Qt-1728f846d9fb53a699782005d6478c0f23f9b82e.zip Qt-1728f846d9fb53a699782005d6478c0f23f9b82e.tar.gz Qt-1728f846d9fb53a699782005d6478c0f23f9b82e.tar.bz2 |
QGraphicsAnchorLayout: Enabling Simplex support for Expanding size policy
To support the expanding size policy we had to change the way the setup
process work. Previously we used to calculate three key-frames using
the simplex solver:
- sizeAtMinimum: the value an anchor should be in when the layout is
at its minimum size. Calculated using simplex solver
to minimize the layout size.
- sizeAtPreferred: the value an anchor should be in when the layout is
at its preferred size. Calculated using simplex solver
to minimize the deviation from the items preferred
sizes.
- sizeAtMaximum: the value an anchor should be in when the layout is
at its maximum size. Calculated using simplex solver
to maximize the layout size.
That worked fine but didn't diferentiate standard items from the
"expanding" ones. In other words, all items would grow from their
sizeAtPreferred to their sizeAtMaximum at the same rate.
To support the idea of "expanding" items, ie. items that should grow
faster than the others, we added a fourth state, between preferred
and maximum.
Now we have the following interpolation order:
sizeAtMinimum -> sizeAtPreferred -> sizeAtExpanding -> sizeAtMaximum.
The definition of the "expanding" state is that all "expanding" items
should have grown all the way to their "sizeAtMaximum" values whereas
non expanding items should have kept their preferred sizes. The only
exception is that non-expanding items are allowed to grow if that is
necessary to allow the "expanding" items to reach their sizeAtMaximum.
So, the visual result is that if the layout is resized from its
preferred size to its maximum size, the expanding items will grow
first and then, in a second phase, the other items will grow.
This commit adds QGALPrivate::solveExpanding() and calls it from
calculateGraphs().
Signed-off-by: Eduardo M. Fleury <eduardo.fleury@openbossa.org>
Reviewed-by: Artur Duque de Souza <artur.souza@openbossa.org>
Diffstat (limited to 'src/gui/graphicsview/qgraphicsanchorlayout_p.h')
-rw-r--r-- | src/gui/graphicsview/qgraphicsanchorlayout_p.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/src/gui/graphicsview/qgraphicsanchorlayout_p.h b/src/gui/graphicsview/qgraphicsanchorlayout_p.h index 4c6c2aa..47df786 100644 --- a/src/gui/graphicsview/qgraphicsanchorlayout_p.h +++ b/src/gui/graphicsview/qgraphicsanchorlayout_p.h @@ -495,6 +495,7 @@ public: bool solveMinMax(QList<QSimplexConstraint *> constraints, GraphPath path, qreal *min, qreal *max); bool solvePreferred(QList<QSimplexConstraint *> constraints); + void solveExpanding(QList<QSimplexConstraint *> constraints); bool hasConflicts() const; #ifdef QT_DEBUG |