summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/layouts/qgridlayoutengine.cpp2
-rw-r--r--tests/auto/controls/data/tst_gridlayout.qml52
2 files changed, 53 insertions, 1 deletions
diff --git a/src/layouts/qgridlayoutengine.cpp b/src/layouts/qgridlayoutengine.cpp
index c5a1b5ce..f72bffe2 100644
--- a/src/layouts/qgridlayoutengine.cpp
+++ b/src/layouts/qgridlayoutengine.cpp
@@ -1419,7 +1419,7 @@ void QGridLayoutEngine::fillRowData(QGridLayoutRowData *rowData,
int effectiveRowSpan = 1;
for (int i = 1; i < itemRowSpan; ++i) {
- if (!rowData->ignore.testBit(i))
+ if (!rowData->ignore.testBit(i + itemRow))
++effectiveRowSpan;
}
diff --git a/tests/auto/controls/data/tst_gridlayout.qml b/tests/auto/controls/data/tst_gridlayout.qml
index da1cd814..2315dc14 100644
--- a/tests/auto/controls/data/tst_gridlayout.qml
+++ b/tests/auto/controls/data/tst_gridlayout.qml
@@ -322,5 +322,57 @@ Item {
layout.destroy();
}
+
+ Component {
+ id: layout_spans_Component
+ GridLayout {
+ columnSpacing: 0
+ rowSpacing: 0
+ // black rectangles are explicitly positioned with row,column
+ Rectangle {
+ // (0,0)
+ id: r0
+ color: "black"
+ width: 20
+ height: 20
+ Layout.row: 0
+ Layout.column: 0
+ }
+ Rectangle {
+ // (0,1)
+ id: r1
+ color: "black"
+ width: 20
+ height: 20
+ Layout.row: 0
+ Layout.column: 1
+ Layout.columnSpan: 2
+ Layout.rowSpan: 2
+ }
+ Rectangle {
+ // (99,99)
+ id: r2
+ color: "black"
+ width: 20
+ height: 20
+ Layout.row: 99
+ Layout.column: 99
+ }
+ }
+ }
+
+ function test_spans() {
+ var layout = layout_spans_Component.createObject(container);
+ compare(layout.children[0].x, 0);
+ compare(layout.children[0].y, 0);
+ compare(layout.children[1].x, 20);
+ compare(layout.children[1].y, 0);
+ compare(layout.children[2].x, 40);
+ compare(layout.children[2].y, 20);
+
+ layout.destroy();
+ }
+
+
}
}