答案 0 :(得分:0)
您可以使用GridLayout
将项目跨多个行/列
import QtQuick 2.0
import QtQuick.Layouts 1.3
GridLayout {
columnSpacing: 10
rowSpacing: 10
columns: 4
Repeater {
model: ListModel {
ListElement { colSpan: 2; rowSpan: 3 }
ListElement { colSpan: 1; rowSpan: 1 }
ListElement { colSpan: 1; rowSpan: 1 }
ListElement { colSpan: 1; rowSpan: 1 }
ListElement { colSpan: 1; rowSpan: 1 }
ListElement { colSpan: 1; rowSpan: 1 }
ListElement { colSpan: 1; rowSpan: 1 }
ListElement { colSpan: 1; rowSpan: 1 }
ListElement { colSpan: 1; rowSpan: 1 }
ListElement { colSpan: 2; rowSpan: 3 }
ListElement { colSpan: 1; rowSpan: 1 }
ListElement { colSpan: 1; rowSpan: 1 }
ListElement { colSpan: 1; rowSpan: 1 }
ListElement { colSpan: 1; rowSpan: 1 }
}
Rectangle {
Layout.columnSpan: model.colSpan
Layout.rowSpan: model.rowSpan
Layout.fillHeight: true
Layout.fillWidth: true
color: "red"
Text {
anchors.fill: parent
text: index
horizontalAlignment: Qt.AlignHCenter
verticalAlignment: Qt.AlignVCenter
}
}
}
}