2018-03-17 19:26:51 +00:00
|
|
|
#ifndef JSONTREEITEM_H
|
|
|
|
#define JSONTREEITEM_H
|
|
|
|
|
|
|
|
#include <QAbstractItemModel>
|
|
|
|
#include <QJsonDocument>
|
|
|
|
#include <QJsonValue>
|
|
|
|
#include <QJsonArray>
|
|
|
|
#include <QJsonObject>
|
|
|
|
#include <QIcon>
|
|
|
|
|
|
|
|
#include "JsonModel.h"
|
|
|
|
|
|
|
|
class JsonTreeItem
|
|
|
|
{
|
|
|
|
public:
|
2018-05-04 07:58:32 +00:00
|
|
|
JsonTreeItem(JsonTreeItem *parent = nullptr);
|
2018-03-17 19:26:51 +00:00
|
|
|
~JsonTreeItem();
|
2018-03-21 20:32:32 +00:00
|
|
|
void appendChild(JsonTreeItem *item);
|
2018-03-17 19:26:51 +00:00
|
|
|
JsonTreeItem *child(int row);
|
|
|
|
JsonTreeItem *parent();
|
|
|
|
int childCount() const;
|
|
|
|
int row() const;
|
2018-03-21 20:32:32 +00:00
|
|
|
void setKey(const QString &key);
|
|
|
|
void setValue(const QString &value);
|
|
|
|
void setType(const QJsonValue::Type &type);
|
2018-03-17 19:26:51 +00:00
|
|
|
QString key() const;
|
|
|
|
QString value() const;
|
|
|
|
QJsonValue::Type type() const;
|
2018-05-04 07:58:32 +00:00
|
|
|
static JsonTreeItem *load(const QJsonValue &value, JsonTreeItem *parent = nullptr);
|
2018-03-17 19:26:51 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
QString mKey;
|
|
|
|
QString mValue;
|
|
|
|
QJsonValue::Type mType;
|
2018-03-21 20:32:32 +00:00
|
|
|
QList<JsonTreeItem *> mChilds;
|
2018-03-17 19:26:51 +00:00
|
|
|
JsonTreeItem *mParent;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // JSONTREEITEM_H
|