summaryrefslogtreecommitdiffstats
path: root/src/gui/graphicsview
diff options
context:
space:
mode:
authorJan-Arve Sæther <jan-arve.saether@nokia.com>2010-12-17 13:41:43 (GMT)
committerJan-Arve Sæther <jan-arve.saether@nokia.com>2011-01-13 08:19:56 (GMT)
commit7fbf1829e11504eca6a55f1e5dbddf2f658b5302 (patch)
tree034d300799c338ee21d74cb157b4b52a9f1552ea /src/gui/graphicsview
parent19b6e2b944a0d1eeef0fb707a00f567e4ee870e6 (diff)
downloadQt-7fbf1829e11504eca6a55f1e5dbddf2f658b5302.zip
Qt-7fbf1829e11504eca6a55f1e5dbddf2f658b5302.tar.gz
Qt-7fbf1829e11504eca6a55f1e5dbddf2f658b5302.tar.bz2
Fix a bug that got revealed by 604c51f1fc5c79b7fad12cda911b06b9e6e5005f
The bug has been around for a while, but change 604c51f1fc5c7 made it emerge. The problem was that stretches were combined by always *maxing* them. The values of 'stretch' can be interpreted as this: -1: (the default) it means that the items should be stretched with the stretch factor dervived from the size hints. (In practice this means that they are distributed fairly). 0: Means that the item should not be stretched >0: Means that the item should be stretch with that number as a factor. This meant that combining one item with a fixed size(0) and another item with a default stretch (-1) the combined row stretch would end up being fixed. This also fixes how stretches are combined for spanning items too. Task-number: QTBUG-13551 Reviewed-by: John Tapsell
Diffstat (limited to 'src/gui/graphicsview')
-rw-r--r--src/gui/graphicsview/qgridlayoutengine.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/gui/graphicsview/qgridlayoutengine.cpp b/src/gui/graphicsview/qgridlayoutengine.cpp
index f1055ba..a3c7ff5 100644
--- a/src/gui/graphicsview/qgridlayoutengine.cpp
+++ b/src/gui/graphicsview/qgridlayoutengine.cpp
@@ -194,7 +194,8 @@ void QGridLayoutRowData::distributeMultiCells(const QGridLayoutRowInfo &rowInfo)
for (int k = 0; k < span; ++k) {
boxes[start + k].combine(extras[k]);
- stretches[start + k] = qMax(stretches[start + k], stretch);
+ if (stretch != 0)
+ stretches[start + k] = qMax(stretches[start + k], stretch);
}
}
multiCellMap.clear();
@@ -1472,7 +1473,7 @@ void QGridLayoutEngine::fillRowData(QGridLayoutRowData *rowData, const QLayoutSt
QGridLayoutBox *box;
if (effectiveRowSpan == 1) {
box = &rowBox;
- if (!userRowStretch)
+ if (!userRowStretch && itemStretch != 0)
rowStretch = qMax(rowStretch, itemStretch);
} else {
QGridLayoutMultiCellData &multiCell =