// CopycatTableModel.h // QXlsx // MIT License // https://github.com/j2doll/QXlsx #ifndef XLSX_MODEL_H #define XLSX_MODEL_H #include #include #include #include #include #include #include #include #include #include #include #include #include #include typedef QList VLIST; class CopycatTableModel : public QAbstractTableModel { Q_OBJECT public: // constrcutor CopycatTableModel(QList colTitle, QList data, QObject *parent = NULL); public: // virtual function of parent object int rowCount(const QModelIndex & parent = QModelIndex()) const Q_DECL_OVERRIDE; int columnCount(const QModelIndex &parent = QModelIndex()) const Q_DECL_OVERRIDE; QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const Q_DECL_OVERRIDE; protected: QList m_the_data; // table cell data QList m_colNames; // column name quint32 m_roleCount; // role count (same as column count) std::string convertFromNumberToExcelColumn(int n); }; #endif