diff options
author | Caio Marcelo de Oliveira Filho <caio.oliveira@openbossa.org> | 2009-10-19 14:10:31 (GMT) |
---|---|---|
committer | Eduardo M. Fleury <eduardo.fleury@openbossa.org> | 2009-10-26 22:17:39 (GMT) |
commit | f9dfd711d104bb438da6ea281012600a897ab30c (patch) | |
tree | ce4a859383e10c211b164f760374cfdd705a737b /src/gui/graphicsview/qgraphicsanchorlayout_p.h | |
parent | 3b025f72636041f7bfe1bf02b34e3b156a78844f (diff) | |
download | Qt-f9dfd711d104bb438da6ea281012600a897ab30c.zip Qt-f9dfd711d104bb438da6ea281012600a897ab30c.tar.gz Qt-f9dfd711d104bb438da6ea281012600a897ab30c.tar.bz2 |
QGAL: identify unfeasible setups even when graph is simplified
The calculate graphs now can return early due to unfeasible anchor
setups found out during simplification. This allows finding out
problems in parallel anchors, when one anchor has maximum size smaller
than the minimum size of the other anchor.
The order for simplification and refreshing size hints also has been swaped:
- First, refresh size hints for all anchors in the graph. If the graph is
simplified, the refreshSizeHints() call will reach the children anchors.
- Then, if the simplificated graph is invalid, rebuild it. During this
rebuild, refreshSizeHints_helper() will be called for all levels.
So in both situations we can identify an unfeasible setup. Note that
this test alone is not enough to classify the graph as feasible, depending
on the graph, it will still need to go through the Simplex.
A test case was added and the function that traverse the graph
refreshing now is called refreshAllSizeHints(). The old name was not
so clear since the function will not fill only the anchors that have
items associated.
Last but not least, the lastCalculationUsedSimplex variable is cleared
when starting calculateGraphs(), since we now can leave the function
earlier, without reaching calculateTrunk(), which is the function that
sets it.
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.h')
-rw-r--r-- | src/gui/graphicsview/qgraphicsanchorlayout_p.h | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/gui/graphicsview/qgraphicsanchorlayout_p.h b/src/gui/graphicsview/qgraphicsanchorlayout_p.h index d4eb2d4..a3de6f6 100644 --- a/src/gui/graphicsview/qgraphicsanchorlayout_p.h +++ b/src/gui/graphicsview/qgraphicsanchorlayout_p.h @@ -428,8 +428,8 @@ public: qreal effectiveSpacing(Orientation orientation) const; // Activation methods - void simplifyGraph(Orientation orientation); - bool simplifyGraphIteration(Orientation orientation); + bool simplifyGraph(Orientation orientation); + bool simplifyGraphIteration(Orientation orientation, bool *feasible); void restoreSimplifiedGraph(Orientation orientation); void calculateGraphs(); @@ -441,7 +441,7 @@ public: bool calculateNonTrunk(const QList<QSimplexConstraint *> &constraints, const QList<AnchorData *> &variables); - void setAnchorSizeHintsFromItems(Orientation orientation); + bool refreshAllSizeHints(Orientation orientation); void findPaths(Orientation orientation); void constraintsFromPaths(Orientation orientation); void updateAnchorSizes(Orientation orientation); |