blob: f8504b9f7fa6a8814f9bea85a26739d68c0cf659 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
|
// Copyright (C) 2020 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
import QtQml.Models
import QtQuick
import QtQuick.Controls
import QtQuick.Shapes
import QtQuick.Window
import Qt.labs.qmlmodels
import TestTableModelWithHeader
Window {
visible: true
width: 640
height: 480
title: qsTr("HeaderView Test")
TestTableModelWithHeader {
id: tableModel
rowCount: 50
columnCount: 80
}
TableView {
id: tableView
anchors.top: parent.top
anchors.topMargin: horizontalHeader.height + rowSpacing
anchors.left: parent.left
anchors.leftMargin: verticalHeader.width + columnSpacing
model: tableModel
rightMargin: 100
bottomMargin: 100
columnSpacing: 4
rowSpacing: 4
syncDirection: Qt.Vertical | Qt.Horizontal
implicitWidth: parent.width + columnSpacing
implicitHeight: parent.height + rowSpacing
clip: true
delegate: Rectangle {
implicitWidth: 150
implicitHeight: 50
color: "#e6ecf5"
CheckBox {
anchors.fill: parent
text: model.display
checked: model.edit
leftPadding: 12
onClicked: model.edit = checked
}
}
}
HorizontalHeaderView {
id: horizontalHeader
objectName: "horizontalHeader"
anchors.top: parent.top
anchors.left: tableView.left
syncView: tableView
clip: true
}
VerticalHeaderView {
id: verticalHeader
objectName: "verticalHeader"
anchors.top: tableView.top
syncView: tableView
clip: true
}
ToolButton {
width: verticalHeader.width
height: horizontalHeader.height
onClicked: {
horizontalHeader.contentX = 0
verticalHeader.contentY = 0
}
}
}
|