Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Toggle main menu visibility
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
26
QT_REQUIRE_CONFIG
(
qml_tree_model
);
27
28
QT_BEGIN_NAMESPACE
29
30
using
namespace
Qt::StringLiterals;
31
static
constexpr
QLatin1StringView
ROWS_PROPERTY_NAME
=
"rows"_L1
;
32
33
class
QQmlTreeRow
34
{
35
public
:
36
explicit
QQmlTreeRow
(
QQmlTreeRow
*parentItem =
nullptr
);
37
explicit
QQmlTreeRow
(
const
QVariant &data,
QQmlTreeRow
*parentItem =
nullptr
);
38
explicit
QQmlTreeRow
(
const
QVariantMap &data,
QQmlTreeRow
*parentItem =
nullptr
);
39
~
QQmlTreeRow
();
40
41
QQmlTreeRow
*
parent
()
const
{
return
m_parent; }
42
void
setParent
(
QQmlTreeRow
*parent) { m_parent = parent; }
43
44
const
QQmlTreeRow
*
getRow
(
int
i)
const
{
return
m_children[i].get(); }
45
void
addChild
(
QQmlTreeRow
*child);
46
void
insertChild
(
int
index, std::unique_ptr<QQmlTreeRow> child);
47
size_t
rowCount
()
const
{
return
m_children.size(); }
48
int
subTreeSize
()
const
;
49
50
QVariantMap
data
()
const
{
return
dataMap; }
51
QVariant
data
(
const
QString &key)
const
{
return
dataMap[key]; }
52
const
std
::
vector
<
std
::
unique_ptr
<
QQmlTreeRow
>>&
children
()
const
{
return
m_children; }
53
void
removeChild
(std::vector<std::unique_ptr<QQmlTreeRow>>::const_iterator &child);
54
void
removeChildAt
(
int
i);
55
std
::
unique_ptr
<
QQmlTreeRow
>
takeChild
(
int
i);
56
void
setData
(
const
QVariant &data);
57
void
setData
(
const
QVariantMap &data);
58
void
setField
(
const
QString &key,
const
QVariant &value);
59
QVariant
toVariant
()
const
;
60
private
:
61
void
unpackVariantMap(
const
QVariantMap &dataMap);
62
63
QQmlTreeRow
*m_parent;
64
std::vector<std::unique_ptr<QQmlTreeRow>> m_children;
65
QVariantMap dataMap;
66
};
67
68
QT_END_NAMESPACE
69
70
#
endif
// QQMLTREEROW_P_H
QQmlTreeModel
Definition
qqmltreemodel_p.h:35
QQmlTreeRow
Definition
qqmltreerow_p.h:34
QQmlTreeRow::addChild
void addChild(QQmlTreeRow *child)
Definition
qqmltreerow.cpp:50
QQmlTreeRow::toVariant
QVariant toVariant() const
Definition
qqmltreerow.cpp:130
QQmlTreeRow::takeChild
std::unique_ptr< QQmlTreeRow > takeChild(int i)
Definition
qqmltreerow.cpp:103
QQmlTreeRow::children
const std::vector< std::unique_ptr< QQmlTreeRow > > & children() const
Definition
qqmltreerow_p.h:52
QQmlTreeRow::data
QVariantMap data() const
Definition
qqmltreerow_p.h:50
QQmlTreeRow::parent
QQmlTreeRow * parent() const
Definition
qqmltreerow_p.h:41
QQmlTreeRow::setData
void setData(const QVariant &data)
Definition
qqmltreerow.cpp:111
QQmlTreeRow::setParent
void setParent(QQmlTreeRow *parent)
Definition
qqmltreerow_p.h:42
QQmlTreeRow::setField
void setField(const QString &key, const QVariant &value)
Definition
qqmltreerow.cpp:124
QQmlTreeRow::removeChild
void removeChild(std::vector< std::unique_ptr< QQmlTreeRow > >::const_iterator &child)
Definition
qqmltreerow.cpp:93
QQmlTreeRow::QQmlTreeRow
QQmlTreeRow(QQmlTreeRow *parentItem=nullptr)
Definition
qqmltreerow.cpp:13
QQmlTreeRow::~QQmlTreeRow
~QQmlTreeRow()
Definition
qqmltreerow.cpp:32
QQmlTreeRow::subTreeSize
int subTreeSize() const
Definition
qqmltreerow.cpp:168
QQmlTreeRow::rowCount
size_t rowCount() const
Definition
qqmltreerow_p.h:47
QQmlTreeRow::QQmlTreeRow
QQmlTreeRow(const QVariant &data, QQmlTreeRow *parentItem=nullptr)
Definition
qqmltreerow.cpp:19
QQmlTreeRow::getRow
const QQmlTreeRow * getRow(int i) const
Definition
qqmltreerow_p.h:44
QQmlTreeRow::insertChild
void insertChild(int index, std::unique_ptr< QQmlTreeRow > child)
Definition
qqmltreerow.cpp:56
QQmlTreeRow::data
QVariant data(const QString &key) const
Definition
qqmltreerow_p.h:51
QQmlTreeRow::removeChildAt
void removeChildAt(int i)
Definition
qqmltreerow.cpp:98
QT_BEGIN_NAMESPACE
Combined button and popup list for selecting options.
Definition
qsequentialanimationgroup.cpp:47
QT_REQUIRE_CONFIG
QT_REQUIRE_CONFIG(animation)
QT_REQUIRE_CONFIG
QT_REQUIRE_CONFIG(qml_tree_model)
ROWS_PROPERTY_NAME
static constexpr QLatin1StringView ROWS_PROPERTY_NAME
Definition
qqmltreerow_p.h:31
qtdeclarative
src
labs
models
qqmltreerow_p.h
Generated on
for Qt by
1.18.0