2021-09-11 19:03:57 +03:00
|
|
|
#ifndef XMLMODEL_H
|
|
|
|
#define XMLMODEL_H
|
|
|
|
|
|
|
|
#include <QAbstractItemModel>
|
|
|
|
#include <QDomDocument>
|
|
|
|
#include <QVector>
|
|
|
|
|
2024-09-04 17:31:16 +03:00
|
|
|
class XmlModel: public QAbstractItemModel {
|
2021-09-11 19:03:57 +03:00
|
|
|
public:
|
|
|
|
XmlModel(QByteArray* data = 0);
|
|
|
|
void setXMLData(QByteArray* data);
|
|
|
|
void parseHeaders();
|
2024-09-04 17:31:16 +03:00
|
|
|
QModelIndex index(int row, int column, const QModelIndex& parent) const;
|
|
|
|
QModelIndex parent(const QModelIndex& child) const;
|
|
|
|
int rowCount(const QModelIndex& parent) const;
|
|
|
|
int columnCount(const QModelIndex& parent) const;
|
|
|
|
QVariant data(const QModelIndex& index, int role) const;
|
2021-09-11 19:03:57 +03:00
|
|
|
QVariant headerData(int section, Qt::Orientation orientation, int role) const;
|
2024-09-04 17:31:16 +03:00
|
|
|
|
2021-09-11 19:03:57 +03:00
|
|
|
private:
|
|
|
|
void initModel();
|
2024-09-04 17:31:16 +03:00
|
|
|
|
2021-09-11 19:03:57 +03:00
|
|
|
private:
|
|
|
|
QDomDocument m_doc;
|
|
|
|
QDomNode m_items;
|
|
|
|
QVector<QString> m_fields;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // XMLMODEL_H
|