【发布时间】:2014-08-27 08:47:30
【问题描述】:
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 {
}
}
}
我花了好几个小时才走到这一步,我觉得这应该是一个相对简单的操作,为什么这么难?如您所见,我更改了表格中项目的字体大小,因为默认情况下它们太小了。这只是导致它们被不变的行大小剪裁。我试过了
-
设置 rowDelegate 对象(但这会导致丢失所有其他默认样式信息,如背景、选择颜色等,我不知道如何指定它)
李> 基于 QAbstractListModel / QAbstractTableModel 设置自定义模型对象(出于某种原因,只有 Qt 知道,从未调用过“数据”函数...)
设置自定义项委托(但似乎不再通过此对象控制高度)
我需要跳过哪些箍来让行改变它们的大小?
【问题讨论】:
-
带anchors的八行可以用这两个代替:anchors.fill: parent; anchors.bottomMargin:43(默认为0)。
标签: qt qml qtableview qt-quick