如何使用QML在GridLayout中占用多个列或行?
我想知道如何在GridLayout中占据多个列或行。下面是我的代码如何使用QML在GridLayout中占用多个列或行?,qml,Qml,我想知道如何在GridLayout中占据多个列或行。下面是我的代码 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: pa
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
}
}
我想知道如何使“五”按钮占据两列。谢谢大家! 您可以使用附加属性
Layout.rowSpan
和Layout.columnsspan
有关详细信息,请参阅和。
另外,使用
Layout.row
和Layout.column
指定项目应放置的单元格。有关布局实际工作方式的更多详细信息,请参见