Basically like in this tutorial: https://doc.qt.io/qt-6/modelview.html#2-1-a-read-only-table
19 lines
532 B
C++
19 lines
532 B
C++
#ifndef TABLEMODEL_H
|
|
#define TABLEMODEL_H
|
|
|
|
#include <QAbstractTableModel>
|
|
|
|
class TableModel : public QAbstractTableModel {
|
|
public:
|
|
explicit TableModel(QObject* parent = nullptr);
|
|
|
|
/// QAbstractItemModel interface
|
|
public:
|
|
int rowCount(const QModelIndex& parent) const override;
|
|
int columnCount(const QModelIndex& parent) const override;
|
|
QVariant data(const QModelIndex& index, int role) const override;
|
|
QVariant headerData(int section, Qt::Orientation orientation, int role) const override;
|
|
};
|
|
|
|
#endif // TABLEMODEL_H
|