summaryrefslogtreecommitdiffstats
path: root/tests/auto
diff options
context:
space:
mode:
authorEduardo M. Fleury <eduardo.fleury@openbossa.org>2009-10-19 16:36:53 -0300
committerEduardo M. Fleury <eduardo.fleury@openbossa.org>2009-11-04 20:27:40 -0300
commit33faaf6fa1775dc74bb61acde8a48eae2b9f2635 (patch)
tree469a2069c17b98a016493121de8cd6e43042c17e /tests/auto
parent41369cd2946956b9a455e4f2014dcc38ffcbad52 (diff)
QGAL: Do not restrict maximum size of layout anchors
This commit improves the way QGAL handles setups where most anchors or items do not have explicit maximum sizes. By default the internal layout anchors and others, have maximum size of QWIDGETSIZE_MAX. It happens though that this value is rather arbitrary but yet, can restrict the size of other paths in the layout. For instance, in the setup below, where the maximum sizes of A and B is not set: ________ ________ | | item A | | item B | | o---o--------o---o--------o---o | |________| |________| | | | | (layout structural anchor) | o-----------------------------o | | the bottom path, of maximum size QWIDGETSIZE_MAX, restricts the lenght of the path at the top, of maximum size of 2 x QWIDGETSIZE_MAX. This introduces the need of fair distribution in the path A-B. While that's not an issue when the path is simplified to a single anchor, it may lead to unbalanced distributions if such simplification is not possible. As this case may arise when we have center anchors in the top path, it may appear in real-world cases. To work around that, we do not limit the maximum width of the layout anchor or parallel anchors that may have taken its place. The practical result in the example above is that the sizeAtMaximum will be set at 2 x QWIDGETSIZE_MAX, with a good distribution of A and B. On the other hand, this oversized layout is not a problem because the effectiveSizeHint code enforces the respect of QWIDGETSIZE_MAX. That means the layout will interpolate only between zero and QWIDGETSIZE_MAX even though its internal maximum size is twice that value. Signed-off-by: Eduardo M. Fleury <eduardo.fleury@openbossa.org> Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@openbossa.org>
Diffstat (limited to 'tests/auto')
-rw-r--r--tests/auto/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/tests/auto/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp b/tests/auto/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp
index 09e2ee2c3d..ce1ffadd85 100644
--- a/tests/auto/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp
+++ b/tests/auto/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp
@@ -1896,15 +1896,15 @@ void tst_QGraphicsAnchorLayout::infiniteMaxSizes()
QGraphicsWidget p;
p.setLayout(l);
+ QCOMPARE(int(p.effectiveSizeHint(Qt::MaximumSize).width()),
+ QWIDGETSIZE_MAX);
+
p.resize(200, 10);
QCOMPARE(a->geometry(), QRectF(0, 0, 50, 10));
QCOMPARE(b->geometry(), QRectF(50, 0, 50, 10));
QCOMPARE(c->geometry(), QRectF(100, 0, 50, 10));
QCOMPARE(d->geometry(), QRectF(150, 0, 50, 10));
- if (!hasSimplification)
- QEXPECT_FAIL("", "Without simplification there is no fair distribution.", Abort);
-
p.resize(1000, 10);
QCOMPARE(a->geometry(), QRectF(0, 0, 450, 10));
QCOMPARE(b->geometry(), QRectF(450, 0, 50, 10));