0
votes

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)

  1. add header that stays visible when the table is scrolled vertically.

  2. make table rows selectable

  3. use different delegates for different columns

?

1

1 Answers

1
votes

In terms of official Qt API, most of it is in the process of being written:

  1. HeaderView is currently being developed: https://codereview.qt-project.org/#/c/255424/
  2. Item selections are currently being developed.
  3. https://stackoverflow.com/a/55517337/904422

Someone else might have answers about how to do this from scratch/manually.