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
qqmlcontext_p.h
Go to the documentation of this file.
1
// Copyright (C) 2016 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
// Qt-Security score:significant
4
5
#
ifndef
QQMLCONTEXT_P_H
6
#
define
QQMLCONTEXT_P_H
7
8
//
9
// W A R N I N G
10
// -------------
11
//
12
// This file is not part of the Qt API. It exists purely as an
13
// implementation detail. This header file may change from version to
14
// version without notice, or even be removed.
15
//
16
// We mean it.
17
//
18
19
#
include
<
QtCore
/
qlist
.
h
>
20
#
include
<
QtCore
/
qstring
.
h
>
21
#
include
<
QtCore
/
qvariant
.
h
>
22
#
include
<
QtCore
/
qpointer
.
h
>
23
#
include
<
QtQml
/
qqmlcontext
.
h
>
24
#
include
<
QtQml
/
qqmllist
.
h
>
25
26
#
include
<
QtCore
/
private
/
qobject_p
.
h
>
27
#
include
<
QtCore
/
qtaggedpointer
.
h
>
28
#
include
<
QtQml
/
private
/
qqmlrefcount_p
.
h
>
29
30
QT_BEGIN_NAMESPACE
31
32
class
QQmlContextData;
33
34
class
QQmlContextPrivate
:
public
QObjectPrivate
35
{
36
Q_DECLARE_PUBLIC(QQmlContext)
37
public
:
38
static
QQmlContextPrivate
*
get
(
QQmlContext
*
context
) {
39
return
static_cast
<
QQmlContextPrivate
*>(
QObjectPrivate
::
get
(
context
));
40
}
41
42
static
QQmlContext
*
get
(
QQmlContextPrivate
*
context
) {
43
return
static_cast
<
QQmlContext
*>(
context
->
q_func
());
44
}
45
46
static
qsizetype
context_count
(
QQmlListProperty
<
QObject
> *);
47
static
QObject
*
context_at
(QQmlListProperty<QObject> *,
qsizetype
);
48
49
void
dropDestroyedQObject
(
const
QString &name, QObject *destroyed);
50
51
int
notifyIndex
()
const
{
return
m_notifyIndex; }
52
void
setNotifyIndex
(
int
notifyIndex) { m_notifyIndex = notifyIndex; }
53
54
int
numPropertyValues
()
const
{
55
auto
size = m_propertyValues.size();
56
Q_ASSERT(size <= std::numeric_limits<
int
>::max());
57
return
int
(size);
58
}
59
void
appendPropertyValue
(
const
QVariant &value) { m_propertyValues.append(value); }
60
void
setPropertyValue
(
int
index,
const
QVariant &value) { m_propertyValues[index] = value; }
61
QVariant
propertyValue
(
int
index)
const
{
return
m_propertyValues[index]; }
62
63
QList
<
QPointer
<
QObject
>>
instances
()
const
{
return
m_instances; }
64
void
appendInstance
(QObject *instance) { m_instances.append(instance); }
65
void
cleanInstances
()
66
{
67
for
(
auto
it = m_instances.begin(); it != m_instances.end();
68
it->isNull() ? (it = m_instances.erase(it)) : ++it) {}
69
}
70
71
void
emitDestruction
();
72
73
private
:
74
friend
class
QQmlContextData;
75
76
QQmlContextPrivate(QQmlContextData *data) : m_data(data) {}
77
QQmlContextPrivate(QQmlContext *publicContext,
const
QQmlRefPointer<QQmlContextData> &parent,
78
QQmlEngine *engine =
nullptr
);
79
80
// Intentionally a bare pointer. QQmlContextData knows whether it owns QQmlContext or vice
81
// versa. If QQmlContext is the owner, QQmlContextData keeps an extra ref for its publicContext.
82
// The publicContext ref is released when doing QQmlContextData::setPublicContext(nullptr).
83
QQmlContextData *m_data;
84
85
QList<QVariant> m_propertyValues;
86
int
m_notifyIndex = -1;
87
88
// Only used for debugging
89
QList<QPointer<QObject>> m_instances;
90
};
91
92
QT_END_NAMESPACE
93
94
#
endif
// QQMLCONTEXT_P_H
QQmlContextPrivate
Definition
qqmlcontext_p.h:35
QQmlContextPrivate::dropDestroyedQObject
void dropDestroyedQObject(const QString &name, QObject *destroyed)
Definition
qqmlcontext.cpp:579
QQmlContextPrivate::cleanInstances
void cleanInstances()
Definition
qqmlcontext_p.h:65
QQmlContextPrivate::setNotifyIndex
void setNotifyIndex(int notifyIndex)
Definition
qqmlcontext_p.h:52
QQmlContextPrivate::setPropertyValue
void setPropertyValue(int index, const QVariant &value)
Definition
qqmlcontext_p.h:60
QQmlContextPrivate::appendInstance
void appendInstance(QObject *instance)
Definition
qqmlcontext_p.h:64
QQmlContextPrivate::notifyIndex
int notifyIndex() const
Definition
qqmlcontext_p.h:51
QQmlContextPrivate::appendPropertyValue
void appendPropertyValue(const QVariant &value)
Definition
qqmlcontext_p.h:59
QQmlContextPrivate::instances
QList< QPointer< QObject > > instances() const
Definition
qqmlcontext_p.h:63
QQmlContextPrivate::numPropertyValues
int numPropertyValues() const
Definition
qqmlcontext_p.h:54
QQmlContextPrivate::emitDestruction
void emitDestruction()
Definition
qqmlcontext.cpp:593
QQmlContextPrivate::propertyValue
QVariant propertyValue(int index) const
Definition
qqmlcontext_p.h:61
QQmlContextPrivate::context_at
static QObject * context_at(QQmlListProperty< QObject > *, qsizetype)
Definition
qqmlcontext.cpp:567
QT_BEGIN_NAMESPACE
Combined button and popup list for selecting options.
Definition
qsequentialanimationgroup.cpp:47
readObjectProperty
static bool readObjectProperty(const QQmlRefPointer< QQmlContextData > &data, QObject *object, const QString &name, QVariant *target)
Definition
qqmlcontext.cpp:326
objectForNameInQQmlContextData
static QObject * objectForNameInQQmlContextData(const QQmlRefPointer< QQmlContextData > &data, const QQmlContextPrivate *d, const QString &name)
Definition
qqmlcontext.cpp:396
qtdeclarative
src
qml
qml
qqmlcontext_p.h
Generated on
for Qt by
1.18.0