Reputation: 8640
I'm using a rowDelegate
to implement variable row heights as follows. However, it doesn't use the default background colors for selected/alternate rows. How can I preserve all defaults that I'm not trying to override?
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
}
Upvotes: 3
Views: 559
Reputation: 24396
You can't.
The general rule of styling with Qt Quick Controls is: once you override a delegate, you start from scratch. If the styles provided a DefaultTableViewRowDelegate
type, for example, you could construct an instance of that and then it would work, but since the default delegates are written inline, you have no way of accessing them.
Upvotes: 1