51 lines
1.3 KiB
C++
51 lines
1.3 KiB
C++
#ifndef CTABLEMODEL_H
|
|
#define CTABLEMODEL_H
|
|
|
|
#include <QAbstractTableModel>
|
|
#include <QTableView>
|
|
#include "CIconActPublic.h"
|
|
|
|
class CIconActDialog;
|
|
class CTableModel : public QAbstractTableModel
|
|
{
|
|
Q_OBJECT
|
|
public:
|
|
enum ColumnField
|
|
{
|
|
NAME = 0,
|
|
ACTION,
|
|
PANEL,
|
|
STRATEGY,
|
|
SIMULATE
|
|
};
|
|
|
|
CTableModel(QObject *parent = Q_NULLPTR);
|
|
|
|
const QList<ST_ICONACT>& getDataList();
|
|
|
|
void updateData(QList<ST_ICONACT> &dataList);
|
|
|
|
void addRows(const QList<ST_ICONACT> &dataList);
|
|
|
|
void removeRows(const QModelIndexList &rowIndexList);
|
|
|
|
void getExistIcon(QStringList &nameList);
|
|
|
|
QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override;
|
|
|
|
int rowCount(const QModelIndex &parent = QModelIndex()) const override;
|
|
int columnCount(const QModelIndex &parent = QModelIndex()) const override;
|
|
|
|
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
|
|
bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole) override;
|
|
|
|
Qt::ItemFlags flags(const QModelIndex &index) const override;
|
|
|
|
private:
|
|
QStringList m_headerList;
|
|
QList<ST_ICONACT> m_dataList;
|
|
CIconActDialog * m_parent;
|
|
};
|
|
|
|
#endif // CTABLEMODEL_H
|