aboutsummaryrefslogtreecommitdiffstats
path: root/src/libs/utils/jsontreeitem.h
blob: 34f09fa97266b0722c4f0d92ec7d94da5c89b101 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
// Copyright (C) 2019 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0

#pragma once

#include "treemodel.h"

#include "utils_global.h"

#include <QCoreApplication>
#include <QJsonValue>

namespace Utils {

class QTCREATOR_UTILS_EXPORT JsonTreeItem : public TypedTreeItem<JsonTreeItem>
{
public:
    JsonTreeItem() = default;
    JsonTreeItem(const QString &displayName, const QJsonValue &value);

    QVariant data(int column, int role) const override;
    bool canFetchMore() const override;
    void fetchMore() override;

private:
    bool canFetchObjectChildren() const;
    bool canFetchArrayChildren() const;

    QString m_name;
    QJsonValue m_value;
};

} // namespace Utils