Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qqmltreerow_p.h
Go to the documentation of this file.
1// Copyright (C) 2025 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#ifndef QQMLTREEROW_P_H
5#define QQMLTREEROW_P_H
6
7//
8// W A R N I N G
9// -------------
10//
11// This file is not part of the Qt API. It exists purely as an
12// implementation detail. This header file may change from version to
13// version without notice, or even be removed.
14//
15// We mean it.
16//
17
18#include <QtQmlModels/private/qtqmlmodelsglobal_p.h>
19
20#include <QtCore/qmap.h>
21#include <QtCore/qvariant.h>
22
23#include <memory>
24#include <vector>
25
27
28QT_BEGIN_NAMESPACE
29
30class QQmlTreeRow
31{
32public:
33 explicit QQmlTreeRow(QQmlTreeRow *parentItem = nullptr);
34 explicit QQmlTreeRow(const QVariant &data, QQmlTreeRow *parentItem = nullptr);
35 explicit QQmlTreeRow(const QVariantMap &data, QQmlTreeRow *parentItem = nullptr);
36
37 QQmlTreeRow *parent() const { return m_parent; }
38 void setParent(QQmlTreeRow *parent) { m_parent = parent; }
39
40 const QQmlTreeRow *getRow(int i) const { return m_children[i].get(); }
41 void addChild(QQmlTreeRow *child);
42 void insertChild(int index, QQmlTreeRow *child);
43 size_t rowCount() const { return m_children.size(); }
44 int subTreeSize() const;
45
46 QVariantMap data() const { return dataMap; }
47 QVariant data(const QString &key) const { return dataMap[key]; }
48 const std::vector<std::unique_ptr<QQmlTreeRow>>& children() const { return m_children; }
49 void removeChild(std::vector<std::unique_ptr<QQmlTreeRow>>::const_iterator &child);
50 void removeChildAt(int i);
51 void setData(const QVariant &data);
52 void setData(const QVariantMap &data);
53 void setField(const QString &key, const QVariant &value);
54 QVariant toVariant() const;
55private:
56 void unpackVariantMap(const QVariantMap &dataMap);
57
58 QQmlTreeRow *m_parent;
59 std::vector<std::unique_ptr<QQmlTreeRow>> m_children;
60 QVariantMap dataMap;
61};
62
63QT_END_NAMESPACE
64
65#endif // QQMLTREEROW_P_H
Combined button and popup list for selecting options.
QT_REQUIRE_CONFIG(animation)
QT_BEGIN_NAMESPACE Q_STATIC_LOGGING_CATEGORY(lcSynthesizedIterableAccess, "qt.iterable.synthesized", QtWarningMsg)
static const QString ROWS_PROPERTY_NAME
QT_REQUIRE_CONFIG(qml_tree_model)