//
// Created by Krad on 2021/11/23.
//

#ifndef GUI_LOGFILETABLEMODEL_H
#define GUI_LOGFILETABLEMODEL_H

#include <QAbstractTableModel>
#include <QList>
#include <QStringList>

class NetCfgTableModel : public QAbstractTableModel {
public:
	NetCfgTableModel(QObject* parent = nullptr);
	~NetCfgTableModel() {}

	//bool setData(const QModelIndex& index, const QVariant& value, int role = Qt::EditRole);

	bool loadData(const QList<QStringList>& list);
	QList<QStringList> getData();

	QStringList rowData(QModelIndex index);
	bool addRow(const QStringList& value);
	bool removeRow(int index);
	bool insertRow(int index, const QStringList& value);


	void setHeader(QStringList header) {
		headerStrings = 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> mydata;
	QStringList headerStrings;
};


#endif //GUI_LOGFILETABLEMODEL_H
