From cf366e8b862a616efd7c3d4683d59971f795d476 Mon Sep 17 00:00:00 2001 From: Jan Arve Saether Date: Fri, 24 May 2013 17:55:21 +0200 Subject: Made sure items with preferred width of 0 could also stretch If no stretch factors were specified, we used the preferred size as a stretch factor. Obviously, that didn't work if the preferred size was actually 0. This patch works around this by actually setting the stretch factor to 1.0 if this is the case. This should work fine in most cases, except for the case where there are also other items with a preferred size close to 0. In this case, the item with preferred size 0 will just grow faster than an item with e.g. preferred size 0.1. Task-number: QTBUG-31217 Change-Id: I966455da0bdd00308591c7f7cfbc4e134d423e57 Reviewed-by: Paul Olav Tvete --- src/widgets/graphicsview/qgridlayoutengine.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/widgets/graphicsview/qgridlayoutengine.cpp b/src/widgets/graphicsview/qgridlayoutengine.cpp index b80612bc47..4f43a0a4ac 100644 --- a/src/widgets/graphicsview/qgridlayoutengine.cpp +++ b/src/widgets/graphicsview/qgridlayoutengine.cpp @@ -291,7 +291,7 @@ void QGridLayoutRowData::calculateGeometries(int start, int end, qreal targetSiz int stretch = stretches[start + i]; if (sumStretches == 0) { - if (hasIgnoreFlag) { + if (hasIgnoreFlag || sizes[i] == 0.0) { factors[i] = (stretch < 0) ? 1.0 : 0.0; } else { factors[i] = (stretch < 0) ? sizes[i] : 0.0; -- cgit v1.2.3