2024-01-16 09:49:52 +00:00
|
|
|
#pragma once
|
|
|
|
|
2023-12-21 15:06:52 +00:00
|
|
|
#include <QAbstractListModel>
|
|
|
|
|
|
|
|
class TestModel : public QAbstractListModel {
|
|
|
|
|
|
|
|
public:
|
|
|
|
explicit TestModel(QList<QPair<QString, QVariantList>> data);
|
|
|
|
explicit TestModel(QList<QString> roles);
|
|
|
|
|
|
|
|
int rowCount(const QModelIndex& parent) const override;
|
|
|
|
QHash<int, QByteArray> roleNames() const override;
|
|
|
|
QVariant data(const QModelIndex& index, int role) const override;
|
|
|
|
|
|
|
|
void insert(int index, QVariantList row);
|
|
|
|
void update(int index, int role, QVariant value);
|
|
|
|
void remove(int index);
|
|
|
|
|
|
|
|
private:
|
|
|
|
void initRoles();
|
|
|
|
|
|
|
|
QList<QPair<QString, QVariantList>> m_data;
|
|
|
|
QHash<int, QByteArray> m_roles;
|
|
|
|
};
|