diff options
author | Eduardo M. Fleury <eduardo.fleury@openbossa.org> | 2009-11-18 20:14:57 (GMT) |
---|---|---|
committer | Eduardo M. Fleury <eduardo.fleury@openbossa.org> | 2009-11-25 15:47:06 (GMT) |
commit | d2ae5be7fcda5f7803e61db96d5229477ad00d70 (patch) | |
tree | 82e4b98074b42186eef78b3118f9698f941b3bb2 /src/gui/graphicsview | |
parent | 71658bad211f12dd252a432559bd3897a8cb021a (diff) | |
download | Qt-d2ae5be7fcda5f7803e61db96d5229477ad00d70.zip Qt-d2ae5be7fcda5f7803e61db96d5229477ad00d70.tar.gz Qt-d2ae5be7fcda5f7803e61db96d5229477ad00d70.tar.bz2 |
QGAL: sizeHint constraints needed by anchors parallel with the layout
The method "constraintsFromSizeHints" does not create constraints for
anchors between the layout vertices _only if_ these anchors have
infinite maximum sizes. However, this test was not being done for
half-anchors, ie. those created when the layout center anchorage
point is used.
That was OK when there was no chance that the center anchors had
been simplified by a parallel anchor. Nowadays there's a chance
that happens, so the test was extended.
Commit also adds a test to avoid regressions.
Signed-off-by: Eduardo M. Fleury <eduardo.fleury@openbossa.org>
Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@openbossa.org>
Diffstat (limited to 'src/gui/graphicsview')
-rw-r--r-- | src/gui/graphicsview/qgraphicsanchorlayout_p.cpp | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp b/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp index b324469..a6f5992 100644 --- a/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp +++ b/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp @@ -2269,13 +2269,21 @@ QList<QSimplexConstraint *> QGraphicsAnchorLayoutPrivate::constraintsFromSizeHin layoutEdge = graph[orient].edgeData(layoutFirstVertex[orient], layoutCentralVertex[orient]); } else { layoutEdge = graph[orient].edgeData(layoutFirstVertex[orient], layoutLastVertex[orient]); + } - // If maxSize is less then "infinite", that means there are other anchors - // grouped together with this one. We can't ignore its maximum value so we - // set back the variable to NULL to prevent the continue condition from being - // satisfied in the loop below. - if (layoutEdge->maxSize < QWIDGETSIZE_MAX) - layoutEdge = 0; + // If maxSize is less then "infinite", that means there are other anchors + // grouped together with this one. We can't ignore its maximum value so we + // set back the variable to NULL to prevent the continue condition from being + // satisfied in the loop below. + const qreal expectedMax = layoutCentralVertex[orient] ? QWIDGETSIZE_MAX / 2 : QWIDGETSIZE_MAX; + qreal actualMax; + if (layoutEdge->from == layoutFirstVertex[orient]) { + actualMax = layoutEdge->maxSize; + } else { + actualMax = -layoutEdge->minSize; + } + if (actualMax != expectedMax) { + layoutEdge = 0; } // For each variable, create constraints based on size hints |