2019-12-10 12:41:02 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <QAbstractTableModel>
|
|
|
|
|
|
|
|
class CQtGenericTableModel : public QAbstractTableModel
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
CQtGenericTableModel(QObject* parent, std::vector<std::string>);
|
2020-02-06 14:12:26 +00:00
|
|
|
~CQtGenericTableModel() = default;
|
2019-12-10 12:41:02 +00:00
|
|
|
|
|
|
|
int rowCount(const QModelIndex& parent = QModelIndex()) const Q_DECL_OVERRIDE;
|
|
|
|
int columnCount(const QModelIndex& parent = QModelIndex()) const Q_DECL_OVERRIDE;
|
|
|
|
QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const Q_DECL_OVERRIDE;
|
|
|
|
|
|
|
|
bool addItem(std::vector<std::string>);
|
2019-12-09 13:22:17 +00:00
|
|
|
std::string getItem(const QModelIndex& index);
|
2019-12-10 12:41:02 +00:00
|
|
|
void clear();
|
|
|
|
|
|
|
|
protected:
|
|
|
|
QVariant headerData(int section, Qt::Orientation orientation, int role) const Q_DECL_OVERRIDE;
|
|
|
|
|
|
|
|
private:
|
|
|
|
std::vector<std::vector<std::string>> m_data;
|
|
|
|
QVariantList m_headers;
|
|
|
|
};
|