Window {
id: uninstallWindow
width: 640
height: 480
property variant pluginData;
TableView {
id:_pluginTable
anchors.right: parent.right
anchors.rightMargin: 0
anchors.left: parent.left
anchors.leftMargin: 0
anchors.bottom: parent.bottom
anchors.bottomMargin: 43
anchors.top: parent.top
anchors.topMargin: 0
model: pluginData
itemDelegate: Text {
text: modelData
font.pixelSize: 24
}
TableViewColumn {
}
}
}
为了达到这个目标需要花费我几个小时,我觉得这应该是一个相对简单的操作,那为什么这么难?正如你所看到的,我改变了表中项目的字体大小,因为它们默认太小了。这只是导致它们被不变的行大小剪裁。我试过如何正确更改TableView的行高?
设置一个rowDelegate对象(但是这会导致所有其他样式信息的损失是有默认像背景,选择颜色等,我不知道如何另行指定的话)
设置基于QAbstractListModel/QAbstractTableModel一个自定义的模型对象(由于某种原因,只知道Qt的,“数据”功能是从来没有所谓的...)
设置自定义项目委托(似乎高度不再由此物体控制)
我需要跳过哪些环节才能让行更改大小?
带锚的八条线可以被这两个替换:anchors.fill:parent; anchors.bottomMargin:43(边距默认为0)。 – pepan 2016-04-19 12:38:16