//直接复制代码就行
ColumnLayout {
width: parent.width;
height: parent.height - 10;
spacing: 10;
Flickable{
Layout.fillWidth: true;
Layout.fillHeight: true;
contentHeight: project_list.height;
flickableDirection:Flickable.VerticalFlick;
clip: true;
Column{
id:project_list;
width: parent.width;
spacing: 5;
GridLayout {
id:grid_layout;
width: parent.width;
rows: 5
columns: 3;//设置行个数
columnSpacing:10;
rowSpacing:10;
Repeater{
model:listModels;
Rectangle{
Layout.fillWidth: true;
Layout.preferredHeight: width;
radius: 7;
Rectangle {
anchors.fill: parent;
color: "#40000000"
}
Text {
anchors.centerIn: parent;
font.pixelSize: parent.height * 0.3;
text: name;
}
}
}
}
}
}
}
ListModel{
id:listModels;
ListElement{
name:"1";
}
ListElement{
name:"2";
}
ListElement{
name:"3";
}
ListElement{
name:"4";
}
ListElement{
name:"5";
}
ListElement{
name:"6";
}
}
qml 按钮表格根据界面宽度显示按钮大小
于 2022-12-30 17:35:28 首次发布