我正在尝试以具有标题和子标题的方式来修改具有TableViewColumns的TableView。
例如:
带子标题的表
据我所知我只能这样做:
我现在的桌子
在代码中,我经常这样做:
TableViewColumn {
id: zoneNumber
title: qsTr("teste")
horizontalAlignment: Text.AlignHCenter
width: col_zone_width
movable: false
resizable: false
delegate:
Rectangle {
border.width: 1
border.color: globals.table.borderColor
color: globals.table.color
height: parent.height
anchors.fill: parent
Text {
anchors.fill: parent
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
color: globals.text.textColor
text: (styleData.row + 1)
font.bold: globals.menu.fontBold
font.pointSize: globals.text.textSize
font.family: robotoRegular.name
}
}
}
在TableViewColumn中读取文档标题仅接受一个字符串。
然后在TableView上我拥有
headerDelegate: Rectangle{
id:recHeader
width:styleData.width+20
height:301
Text {
anchors.fill:parent
text:styleData.value
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
}
}
那样,似乎无法完成我想要达到的目标。
有解决方案吗?也许解析styleData.value
以返回不同的组件?
注意:我正在使用QtQuick.Controls 1.4中的TableViewColumn,QtQuick 2.2中的TableView