summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan Arve Saether <jan-arve.saether@theqtcompany.com>2014-12-09 12:26:18 (GMT)
committerJan Arve Sæther <jan-arve.saether@theqtcompany.com>2014-12-10 14:57:04 (GMT)
commit325b6ef5d68a7066df9fb6cf48474257e3d57ea9 (patch)
treeb29d0acf8490b7679abe5566cb538c0986eae9f8
parent933ae21b9925f1d9fc467e1ecb72eb91b5892d61 (diff)
downloadQt-325b6ef5d68a7066df9fb6cf48474257e3d57ea9.zip
Qt-325b6ef5d68a7066df9fb6cf48474257e3d57ea9.tar.gz
Qt-325b6ef5d68a7066df9fb6cf48474257e3d57ea9.tar.bz2
Fixed a bug where spans did not always work in layouts.
The problem was that the span we stored in the multiCellMap was the "effective" span (i.e. the given span subtracted with the number of ignored rows it would span). Later we used that span to distribute its size across all its cells. However, since the span now could be smaller that the given span, we could sometimes fail to distribute to the last span(s). [ChangeLog][QtWidgets][layouts] Fixed a bug where spans sometimes didn't distribute themselves to the last cells they covered. Change-Id: I7bfbbe721f0ec4398be6a5f234c109ddfec18514 Task-number: QTBUG-43099 Reviewed-by: Paul Olav Tvete <paul.tvete@theqtcompany.com> (cherry picked from qtbase/c9db6e52bc9bd9731159fcb4e95fca5cba01bc9c)
-rw-r--r--src/gui/graphicsview/qgridlayoutengine.cpp2
-rw-r--r--tests/auto/qgraphicsgridlayout/tst_qgraphicsgridlayout.cpp17
2 files changed, 18 insertions, 1 deletions
diff --git a/src/gui/graphicsview/qgridlayoutengine.cpp b/src/gui/graphicsview/qgridlayoutengine.cpp
index 74a074f..7f246e5 100644
--- a/src/gui/graphicsview/qgridlayoutengine.cpp
+++ b/src/gui/graphicsview/qgridlayoutengine.cpp
@@ -1497,7 +1497,7 @@ void QGridLayoutEngine::fillRowData(QGridLayoutRowData *rowData, const QLayoutSt
rowStretch = qMax(rowStretch, itemStretch);
} else {
QGridLayoutMultiCellData &multiCell =
- rowData->multiCellMap[qMakePair(row, effectiveRowSpan)];
+ rowData->multiCellMap[qMakePair(row, itemRowSpan)];
box = &multiCell.q_box;
multiCell.q_stretch = itemStretch;
}
diff --git a/tests/auto/qgraphicsgridlayout/tst_qgraphicsgridlayout.cpp b/tests/auto/qgraphicsgridlayout/tst_qgraphicsgridlayout.cpp
index 3bd9918..d2a68b5 100644
--- a/tests/auto/qgraphicsgridlayout/tst_qgraphicsgridlayout.cpp
+++ b/tests/auto/qgraphicsgridlayout/tst_qgraphicsgridlayout.cpp
@@ -1692,6 +1692,23 @@ void tst_QGraphicsGridLayout::sizeHint_data()
<< QSizeF(100, 100)
<< QSizeF(100, 100);
+ QTest::newRow("colSpan_with_ignored_column") << (ItemList()
+ << ItemDesc(0,0)
+ .minSize(QSizeF(40,20))
+ .maxSize(QSizeF(60,20))
+ .colSpan(2)
+ << ItemDesc(0,2)
+ .minSize(QSizeF(20, 20))
+ .maxSize(QSizeF(30, 20))
+ << ItemDesc(1,0)
+ .minSize(QSizeF(60, 20))
+ .maxSize(QSizeF(90, 20))
+ .colSpan(3)
+ )
+ << QSizeF(60, 40)
+ << QSizeF(80, 40)
+ << QSizeF(90, 40);
+
}
// public QSizeF sizeHint(Qt::SizeHint which, QSizeF const& constraint = QSizeF()) const