Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
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
4#ifndef QV4QMLCONTEXT_P_H
5#define QV4QMLCONTEXT_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 <private/qqmlcontextdata_p.h>
19#include <private/qtqmlglobal_p.h>
20#include <private/qv4context_p.h>
21#include <private/qv4object_p.h>
22
23#include <QtCore/qglobal.h>
24
26
27namespace QV4 {
28
29struct QQmlContextWrapper;
30
31namespace Heap {
32
33#define QQmlContextWrapperMembers(class, Member) \
34 Member(class, Pointer, Module *, module)
35
38
39 void init(QQmlRefPointer<QQmlContextData> context, QObject *scopeObject);
40 void destroy();
41
42 // This has to be a plain pointer because object needs to be a POD type.
44 QV4QPointer<QObject> scopeObject;
45};
46
47#define QmlContextMembers(class, Member)
48
51
52 QQmlContextWrapper *qml() { return static_cast<QQmlContextWrapper *>(activation.get()); }
53 void init(QV4::ExecutionContext *outerContext, QV4::QQmlContextWrapper *qml);
54};
55
56}
57
58struct Q_QML_EXPORT QQmlContextWrapper : Object
59{
62 V4_INTERNALCLASS(QmlContextWrapper)
63
64 inline QObject *getScopeObject() const { return d()->scopeObject; }
65 inline QQmlRefPointer<QQmlContextData> getContext() const { return d()->context; }
66
67 static ReturnedValue getPropertyAndBase(const QQmlContextWrapper *resource, PropertyKey id, const Value *receiver,
68 bool *hasProperty, Value *base, Lookup *lookup = nullptr);
69 static ReturnedValue virtualGet(const Managed *m, PropertyKey id, const Value *receiver, bool *hasProperty);
70 static bool virtualPut(Managed *m, PropertyKey id, const Value &value, Value *receiver);
71
72 static ReturnedValue resolveQmlContextPropertyLookupGetter(Lookup *l, ExecutionEngine *engine, Value *base);
73 static ReturnedValue lookupScript(Lookup *l, ExecutionEngine *engine, Value *base);
74 static ReturnedValue lookupSingleton(Lookup *l, ExecutionEngine *engine, Value *base);
75 static ReturnedValue lookupValueSingleton(Lookup *l, ExecutionEngine *engine, Value *base);
76 static ReturnedValue lookupIdObject(Lookup *l, ExecutionEngine *engine, Value *base);
77 static ReturnedValue lookupIdObjectInParentContext(Lookup *l, ExecutionEngine *engine, Value *base);
78 static ReturnedValue lookupScopeObjectProperty(Lookup *l, ExecutionEngine *engine, Value *base);
79 static ReturnedValue lookupScopeObjectMethod(Lookup *l, ExecutionEngine *engine, Value *base);
80 static ReturnedValue lookupScopeFallbackProperty(Lookup *l, ExecutionEngine *engine, Value *base);
81 static ReturnedValue lookupContextObjectProperty(Lookup *l, ExecutionEngine *engine, Value *base);
82 static ReturnedValue lookupContextObjectMethod(Lookup *l, ExecutionEngine *engine, Value *base);
83 static ReturnedValue lookupInGlobalObject(Lookup *l, ExecutionEngine *engine, Value *base);
84 static ReturnedValue lookupInParentContextHierarchy(Lookup *l, ExecutionEngine *engine, Value *base);
85 static ReturnedValue lookupType(Lookup *l, ExecutionEngine *engine, Value *base);
86};
87
88struct Q_QML_EXPORT QmlContext : public ExecutionContext
89{
92
93 static Heap::QmlContext *create(
94 QV4::ExecutionContext *parent, QQmlRefPointer<QQmlContextData> context,
95 QObject *scopeObject);
96
97 QObject *qmlScope() const {
98 return d()->qml()->scopeObject;
99 }
100
101 QQmlRefPointer<QQmlContextData> qmlContext() const {
102 return d()->qml()->context;
103 }
104};
105
106}
107
109
110#endif
111
\inmodule QtCore
Definition qobject.h:103
Combined button and popup list for selecting options.
quint64 ReturnedValue
static void * context
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
const GLfloat * m
static QT_BEGIN_NAMESPACE void init(QTextBoundaryFinder::BoundaryType type, QStringView str, QCharAttributes *attributes)
static const uint base
Definition qurlidna.cpp:20
#define V4_MANAGED(DataClass, superClass)
#define V4_NEEDS_DESTROY
#define V4_INTERNALCLASS(c)
#define DECLARE_HEAP_OBJECT(name, base)
#define DECLARE_MARKOBJECTS(class)
#define V4_OBJECT2(DataClass, superClass)
view create()
QJSEngine engine
[0]
QQmlRefPointer< QQmlContextData > getContext() const
QQmlRefPointer< QQmlContextData > qmlContext() const
QObject * qmlScope() const