2017-09-19 14:27:39 +02:00
|
|
|
/* === This file is part of Calamares - <https://github.com/calamares> ===
|
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: GPL-3.0+
|
|
|
|
* License-Filename: LICENSES/GPLv3+-QJsonModel
|
|
|
|
*/
|
|
|
|
|
2015-03-04 20:22:58 +01:00
|
|
|
#ifndef JSONITEM_H
|
|
|
|
#define JSONITEM_H
|
|
|
|
#include <QtCore>
|
|
|
|
#include <QJsonValue>
|
|
|
|
#include <QJsonArray>
|
|
|
|
#include <QJsonObject>
|
|
|
|
class QJsonTreeItem
|
|
|
|
{
|
|
|
|
public:
|
2019-04-11 13:15:10 +02:00
|
|
|
QJsonTreeItem(QJsonTreeItem * parent = nullptr);
|
2017-09-19 14:24:05 +02:00
|
|
|
~QJsonTreeItem();
|
2015-03-04 20:22:58 +01:00
|
|
|
void appendChild(QJsonTreeItem * item);
|
|
|
|
QJsonTreeItem *child(int row);
|
|
|
|
QJsonTreeItem *parent();
|
|
|
|
int childCount() const;
|
|
|
|
int row() const;
|
|
|
|
void setKey(const QString& key);
|
|
|
|
void setValue(const QString& value);
|
|
|
|
void setType(const QJsonValue::Type& type);
|
|
|
|
QString key() const;
|
|
|
|
QString value() const;
|
|
|
|
QJsonValue::Type type() const;
|
|
|
|
|
|
|
|
|
2019-04-11 13:15:10 +02:00
|
|
|
static QJsonTreeItem* load(const QJsonValue& value, QJsonTreeItem * parent = nullptr);
|
2015-03-04 20:22:58 +01:00
|
|
|
|
|
|
|
protected:
|
|
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
QString mKey;
|
|
|
|
QString mValue;
|
|
|
|
QJsonValue::Type mType;
|
|
|
|
|
|
|
|
QList<QJsonTreeItem*> mChilds;
|
|
|
|
QJsonTreeItem * mParent;
|
|
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // JSONITEM_H
|