【发布时间】:2015-08-29 22:31:09
【问题描述】:
我正在使用rowDelegate 来实现可变行高,如下所示。但是,它不使用选定/备用行的默认背景颜色。如何保留我不想覆盖的所有默认值?
TableView {
id: messagesTable
TableViewColumn {
role: "severity"
title: ""
width: 20
delegate: Image {
anchors.centerIn: parent
fillMode: Image.Pad
source: iconSources[styleData.value.toLowerCase()]
}
}
TableViewColumn {
role: "message"
title: "Message"
width: 300
}
TableViewColumn {
role: "source"
title: "File"
width: 150
}
TableViewColumn {
role: "startLine"
title: "Line"
width: 40
}
TableViewColumn {
role: "startColumn"
title: "Column"
width: 50
}
rowDelegate: Rectangle {
width: childrenRect.width
height: (messagesModel.get(styleData.row).lineCount || 1) * 20
}
model: messagesModel
}
【问题讨论】:
标签: qt qml qtableview