-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTableView.qml
63 lines (55 loc) · 1.75 KB
/
TableView.qml
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
import QtQuick 2.7
import QtQuick.Controls 2.0
ListView {
id: listView
anchors.fill: parent
contentWidth: headerItem.width
flickableDirection: Flickable.VerticalFlick
property var headerModel: ["Topic", "Message", "UpdateTime"]
property alias contentModel: listView.model
headerPositioning: ListView.OverlayHeader
delegate: Column {
id: delegate
property int row: index
width: listView.width
Row {
spacing: 1
ItemDelegate {
width: listView.headerItem.itemAt(1).width
text: topic
}
ItemDelegate {
width: listView.headerItem.itemAt(2).width
text: message
}
ItemDelegate {
width: listView.headerItem.itemAt(3).width
text: updateTime
}
}
Rectangle {
color: "silver"
width: parent.width
height: 1
}
}
ScrollIndicator.horizontal: ScrollIndicator { }
ScrollIndicator.vertical: ScrollIndicator { }
header: Row {
z:2
spacing: 1
function itemAt(index) { return repeater.itemAt(index) }
Repeater {
id: repeater
model: listView.headerModel
Label {
width: listView.width/3
text: modelData
font.bold: true
font.pixelSize: 20
padding: 10
background: Rectangle { color: "silver" }
}
}
}
}