7import QtQuick.Controls as QQC2
9import org.kde.kirigami as Kirigami
11import "private" as Private
13Private.AbstractTable {
16 contentWidth: header.contentWidth
17 contentHeight: header.contentHeight + tableView.contentHeight
18 selectionBehavior: TableView.SelectCells
20 signal cellClicked(
int row,
int column)
21 signal cellDoubleClicked(
int row,
int column)
23 __rowCount: tableView.rows
25 QQC2.HorizontalHeaderView {
28 width: tableView.width
29 height: root.__rowHeight
31 model: root.__columnModel
35 rowHeightProvider: () => root.__rowHeight
37 delegate: Private.HeaderDelegate {
38 sortEnabled: headerComponent.role === root.sortRole
39 sortOrder: root.sortOrder
40 onClicked: root.columnClicked(column, headerComponent)
41 onDoubleClicked: root.columnDoubleClicked(column, headerComponent)
49 anchors.topMargin: header.height
53 alternatingRows: root.alternatingRows
54 selectionModel: root.selectionModel
55 selectionMode: root.selectionMode
56 selectionBehavior: root.selectionBehavior
58 resizableColumns: false
61 rowHeightProvider: () => root.__rowHeight
62 columnWidthProvider: function(column) {
63 if (!isColumnLoaded(index)) {
67 return root.__columnWidth(column, explicitColumnWidth(column))
70 delegate: Private.TableCellDelegate {
71 onClicked: root.cellClicked(row, column)
72 onDoubleClicked: root.cellDoubleClicked(row, column)
76 QQC2.SelectionRectangle {
79 bottomRightHandle: null
83 onCellClicked: function(row, column) {
84 if (root.selectionBehavior === TableView.SelectCells) {
85 __selectCell(row, column);
88 if (root.selectionBehavior === TableView.SelectRows) {
89 if (__isControlModifier || __isShiftModifier) {
94 root.selectionModel.clearSelection();
95 root.selectionModel.clearCurrentIndex();
96 for (let _column = 0; _column < root.columnCount; _column++) {
97 root.selectionModel.setCurrentIndex(root.model.index(row, _column), ItemSelectionModel.Select);
101 if (root.selectionBehavior === TableView.SelectColumns) {
102 if (__isControlModifier || __isShiftModifier) {
103 __selectColumn(column);
107 root.selectionModel.clearSelection();
108 root.selectionModel.clearCurrentIndex();
109 for (let _row = 0; _row < root.rowCount; _row++) {
110 root.selectionModel.setCurrentIndex(root.model.index(_row, column), ItemSelectionModel.Select);