1
0
mirror of https://github.com/QtExcel/QXlsx.git synced 2025-02-06 05:08:22 +08:00
QXlsx/Copycat/XlsxTableModel2.h

50 lines
1.1 KiB
C
Raw Normal View History

2018-10-05 13:03:21 +09:00
// XlsxTableModel2.h
2018-10-04 13:24:28 +09:00
// QXlsx
// MIT License
// https://github.com/j2doll/QXlsx
#ifndef XLSX_MODEL_H
#define XLSX_MODEL_H
#include <cstdio>
#include <cstdlib>
#include <string>
#include <vector>
#include <sstream>
2018-10-04 13:24:28 +09:00
#include <QtGlobal>
#include <QObject>
#include <QString>
#include <QStringList>
#include <QList>
#include <QVector>
#include <QMap>
#include <QVariant>
#include <QAbstractTableModel>
typedef QList<QVariant> VLIST;
2018-10-05 13:03:21 +09:00
class XlsxTableModel2 : public QAbstractTableModel
2018-10-04 13:24:28 +09:00
{
Q_OBJECT
public: // constrcutor
2018-10-05 13:03:21 +09:00
XlsxTableModel2(QList<QString> colTitle, QList<VLIST> data, QObject *parent = NULL);
2018-10-04 13:24:28 +09:00
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<VLIST> m_the_data; // table cell data
QList<QString> m_colNames; // column name
quint32 m_roleCount; // role count (same as column count)
std::string convertFromNumberToExcelColumn(int n);
2018-10-04 13:24:28 +09:00
};
#endif