Files
GUI/src/network/NetCfgTableModel.h

42 lines
1.0 KiB
C
Raw Normal View History

2022-06-08 09:53:33 +08:00
#ifndef GUI_LOGFILETABLEMODEL_H
#define GUI_LOGFILETABLEMODEL_H
#include <QAbstractTableModel>
#include <QList>
#include <QStringList>
class NetCfgTableModel : public QAbstractTableModel
{
Q_OBJECT
public:
NetCfgTableModel(QObject* parent = nullptr);
~NetCfgTableModel() {}
bool loadData(const QList<QStringList>& list);
QList<QStringList> getData();
QStringList rowData(const QModelIndex& index);
bool addRow(const QStringList& value);
bool removeRow(int index);
bool insertRow(int index, const QStringList& value);
void setHeader(const QStringList& header);
protected:
//数据展示用
QVariant data(const QModelIndex& index, int role) const;
//行数,重新实现
int rowCount(const QModelIndex& parent) const;
//列数,重新实现
int columnCount(const QModelIndex& parent) const;
//标头
QVariant headerData(int section, Qt::Orientation orientation, int role) const;
private:
QList<QStringList> mTableData;
QStringList mHeaderStrings;
};
#endif //GUI_LOGFILETABLEMODEL_H