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
qv4qmlcontext_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 QV4QMLCONTEXT_P_H
6#define QV4QMLCONTEXT_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 <private/qqmlcontextdata_p.h>
20#include <private/qtqmlglobal_p.h>
21#include <private/qv4context_p.h>
22#include <private/qv4object_p.h>
23
24#include <QtCore/qglobal.h>
25
27
28class QQmlPropertyCache;
29
30namespace QV4 {
31
32struct QQmlContextWrapper;
33
34namespace Heap {
35
36#define QQmlContextWrapperMembers(class, Member)
37 Member(class, Pointer, Module *, module)
38
39DECLARE_HEAP_OBJECT(QQmlContextWrapper, Object) {
40 DECLARE_MARKOBJECTS(QQmlContextWrapper)
41
42 void init(QQmlRefPointer<QQmlContextData> context, QObject *scopeObject);
43 void destroy();
44
45 // This has to be a plain pointer because object needs to be a POD type.
46 QQmlContextData *context;
47 QV4QPointer<QObject> scopeObject;
48
49 // The type of the scope object. It outlives the scope object, so that we can tell whether the
50 // scope object would have resolved a name even if it is gone. Held as a plain pointer with
51 // manual reference counting because the heap object needs to be a POD type.
52 const QQmlPropertyCache *scopePropertyCache;
53};
54
55#define QmlContextMembers(class, Member)
56
57DECLARE_HEAP_OBJECT(QmlContext, ExecutionContext) {
58 DECLARE_MARKOBJECTS(QmlContext)
59
60 QQmlContextWrapper *qml() { return static_cast<QQmlContextWrapper *>(activation.get()); }
61 void init(QV4::ExecutionContext *outerContext, QV4::QQmlContextWrapper *qml);
62};
63
64}
65
67{
71
72 inline QObject *getScopeObject() const { return d()->scopeObject; }
73 inline QQmlRefPointer<QQmlContextData> getContext() const { return d()->context; }
74
76 bool *hasProperty, Value *base, Lookup *lookup = nullptr);
78 static bool virtualPut(Managed *m, PropertyKey id, const Value &value, Value *receiver);
79
94};
95
96struct Q_QML_EXPORT QmlContext : public ExecutionContext
97{
100
101 static Heap::QmlContext *create(
104
105 QObject *qmlScope() const {
106 return d()->qml()->scopeObject;
107 }
108
110 return d()->qml()->context;
111 }
112};
113
114}
115
116QT_END_NAMESPACE
117
118#endif
Combined button and popup list for selecting options.
Definition qjsvalue.h:24
void setupQObjectLookup(Lookup *lookup, const QQmlData *ddata, const QQmlPropertyData *propertyData, const Object *self, const Object *qmlType)
void setupQObjectLookup(Lookup *lookup, const QQmlData *ddata, const QQmlPropertyData *propertyData)
bool qualifiesForMethodLookup(const QQmlPropertyData *propertyData)
void setupQObjectMethodLookup(Lookup *lookup, const QQmlPropertyCache::ConstPtr &propertyCache, const QQmlPropertyData *propertyData, const Object *self, QObjectMethod *method)
void setupQObjectLookup(Lookup *lookup, const QQmlData *ddata, const QQmlPropertyData *propertyData, const Object *self)
static void setupProtoLookupTwoClasses(Lookup *lookup, const Lookup &first, const Lookup &second)
static void setupObjectLookupTwoClasses(Lookup *lookup, const Lookup &first, const Lookup &second)
#define V4_MANAGED(DataClass, superClass)
#define V4_NEEDS_DESTROY
#define V4_INTERNALCLASS(c)