我想知道如何在GridLayout.follow中占用多个列或行是我的代码 .
import QtQuick 2.4
import QtQuick.Controls 1.3
import QtQuick.Layouts 1.1
Rectangle {
width: 320
height: 250
GridLayout {
anchors.left: parent.left
anchors.bottom: parent.bottom
rows: 2
columns: 3
Button{
text: "one"
}
Button{
text: "two"
}
Button{
text: "three"
}
Button{
text: "four"
}
Button{
text: "five"
}
Layout.columnSpan: 2
}
}
我想如何使“五”按钮占据两列 . 谢谢 !
1 回答
您可以使用附加属性
Layout.rowSpan
和Layout.columnSpan
.有关详细信息,请参阅here和here .
此外,使用
Layout.row
和Layout.column
指定应放置项目的单元格 .有关布局实际工作方式的更多详细信息,请参见here .