7import QtQuick.Controls as QQC2
9import org.kde.kirigami as Kirigami
11import "private" as Private
13Private.AbstractTable {
16 contentWidth: __columnsContentWidth()
17 contentHeight: listView.contentHeight
19 __rowCount: listView.count
28 header: QQC2.HorizontalHeaderView {
32 height: root.__rowHeight
34 model: root.__columnModel
37 rowHeightProvider: () => root.__rowHeight
38 columnWidthProvider: function(column) {
39 if (!isColumnLoaded(index)) {
43 return root.__columnWidth(column, explicitColumnWidth(column))
47 for(let column = 0; column < root.columnCount; column++) {
48 const columnItem = root.__columnModel.get(column).headerComponent;
49 columnItem.width = columnWidthProvider(column)
53 delegate: Private.HeaderDelegate {
54 sortEnabled: headerComponent.role === root.sortRole
55 sortOrder: root.sortOrder
56 onClicked: root.columnClicked(column, headerComponent)
57 onDoubleClicked: root.columnDoubleClicked(column, headerComponent)
61 delegate: Private.ListRowDelegate {
64 highlighted: root.selectionModel?.isSelected(root.model.index(index, 0)) ??
false
65 alternatingRows: root.alternatingRows
68 target: root.selectionModel
70 function onSelectionChanged(selected, deselected) {
71 delegate.highlighted =
Qt.binding(() => root.selectionModel.isSelected(root.model.index(delegate.index, 0)))
75 onClicked: root.rowClicked(index)
76 onDoubleClicked: root.rowDoubleClicked(index)