* Refactor network package.
This commit is contained in:
45
src/network/NetCfgTableModel.h
Normal file
45
src/network/NetCfgTableModel.h
Normal file
@@ -0,0 +1,45 @@
|
||||
//
|
||||
// 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
|
||||
{
|
||||
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
|
||||
Reference in New Issue
Block a user