File indexing completed on 2021-12-21 13:14:18

0001 #pragma once
0002 
0003 #include <QString>
0004 #include <QModelIndex>
0005 #include <QAbstractTableModel>
0006 
0007 struct ArduinoWindowModelStruct
0008 {
0009     QString m_id;
0010     QString m_name;
0011 };
0012 
0013 class ArduinoWindowModel : public QAbstractTableModel
0014 {
0015     Q_OBJECT
0016 private:
0017     QVector<ArduinoWindowModelStruct> m_db;
0018 
0019 public:
0020     ArduinoWindowModel(QObject *parent);
0021     enum {NAME, ID, COLUMNS};
0022     void populate(const QVector<ArduinoWindowModelStruct> &tdb);
0023 
0024     QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override;
0025 
0026     ArduinoWindowModelStruct getData(int index);
0027 
0028     int columnCount(const QModelIndex &parent) const override;
0029     int rowCount(const QModelIndex &parent) const override;
0030 };