Reputation: 4285
I implemented QAbstractTableModel + TableView with QtQuick 2.12 as described in the official QT docs.
my QML code:
import QtQuick 2.12
import TableModel 0.1
TableView {
anchors.fill: parent
columnSpacing: 1
rowSpacing: 1
clip: true
model: TableModel {}
delegate: Rectangle {
implicitWidth: 100
implicitHeight: 50
Text {
text: display
}
}
}
QAbstractTableModel implemented in C++ as described in docs.
Now my app displays a table that can be scrolled.
How to (or is it possible to)
add header that stays visible when the table is scrolled vertically.
make table rows selectable
use different delegates for different columns
?
Upvotes: 0
Views: 510
Reputation: 24386
In terms of official Qt API, most of it is in the process of being written:
HeaderView
is currently being developed: https://codereview.qt-project.org/#/c/255424/Someone else might have answers about how to do this from scratch/manually.
Upvotes: 1