Qt 调整行项目大小时出现QML listview问题
我只是尝试简单的QML代码, 问题是:列表视图项没有调整大小,因为调整主窗口大小时,这应该是原始布局的正常行为。也许有人知道怎么了Qt 调整行项目大小时出现QML listview问题,qt,listview,qml,resize,Qt,Listview,Qml,Resize,我只是尝试简单的QML代码, 问题是:列表视图项没有调整大小,因为调整主窗口大小时,这应该是原始布局的正常行为。也许有人知道怎么了 Window { visible: true width: Screen.width / 3 height: Screen.height / 3 title: "Folder Explorer" ListModel { id: myModel ListEle
Window {
visible: true
width: Screen.width / 3
height: Screen.height / 3
title: "Folder Explorer"
ListModel {
id: myModel
ListElement {
filename: "1.txt"
filesize: "34653"
}
ListElement {
filename: "2.txt"
filesize: "54650"
}
}
ListView {
id: lv_view
anchors.fill: parent
clip: true
model: myModel
delegate:
RowLayout {
spacing: 10
Label {
Layout.fillWidth: true
Layout.fillHeight: true
Layout.minimumWidth: 10
Layout.preferredWidth: 200
Layout.minimumHeight: 10
Layout.column: 0
Text {
//
text: model.filename
}
}
Label {
Layout.fillWidth: true
Layout.fillHeight: true
Layout.minimumWidth: 10
Layout.preferredWidth: 200
Layout.minimumHeight: 10
Layout.column: 1
Text {
//anchors.fill: parent
text: model.filesize
}
}
}
}
}
嗯,看来我成功地使用了Row而不是RowLayout,这是我预期的行为。但为什么rowlayout不起作用——这是个问题。