Qt 6.x
The Qt SDK
Loading...
Searching...
No Matches
qqmllistwrapper_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 QQMLLISTWRAPPER_P_H
5#define QQMLLISTWRAPPER_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 <QtCore/qglobal.h>
19#include <QtCore/qpointer.h>
20
21#include <QtQml/qqmllist.h>
22
23#include <private/qv4value_p.h>
24#include <private/qv4object_p.h>
25
27
28namespace QV4 {
29
30namespace Heap {
31
34 void init(QObject *object, int propertyId, QMetaType propertyType);
36 void destroy();
37
38 QObject *object() const { return m_object.data(); }
39 QMetaType propertyType() const { return QMetaType(m_propertyType); }
40
42 {
43 return reinterpret_cast<const QQmlListProperty<QObject>*>(m_propertyData);
44 }
45
47 {
48 return reinterpret_cast<QQmlListProperty<QObject>*>(m_propertyData);
49 }
50
51private:
52 void *m_propertyData[sizeof(QQmlListProperty<QObject>)/sizeof(void*)];
53
54 QV4QPointer<QObject> m_object;
55
56 // interface instead of QMetaType to keep class a POD
57 const QtPrivate::QMetaTypeInterface *m_propertyType;
58
59 QObjectList *m_ownData;
60};
61
62}
63
64struct Q_QML_EXPORT QmlListWrapper : Object
65{
68 V4_PROTOTYPE(propertyListPrototype)
69 Q_MANAGED_TYPE(QmlListProperty)
70
71 static ReturnedValue create(ExecutionEngine *engine, QObject *object, int propId, QMetaType propType);
74
75 QVariant toVariant() const;
76 QQmlListReference toListReference() const;
77
78 static ReturnedValue virtualGet(const Managed *m, PropertyKey id, const Value *receiver, bool *hasProperty);
79 static qint64 virtualGetLength(const Managed *m);
80 static bool virtualPut(Managed *m, PropertyKey id, const Value &value, Value *receiver);
81 static OwnPropertyKeyIterator *virtualOwnPropertyKeys(const Object *m, Value *target);
82};
83
85{
86 V4_PROTOTYPE(arrayPrototype)
87
88 void init();
89
90 static ReturnedValue method_pop(const FunctionObject *, const Value *thisObject, const Value *argv, int argc);
91 static ReturnedValue method_push(const FunctionObject *, const Value *thisObject, const Value *argv, int argc);
92 static ReturnedValue method_shift(const FunctionObject *, const Value *thisObject, const Value *argv, int argc);
93 static ReturnedValue method_splice(const FunctionObject *, const Value *thisObject, const Value *argv, int argc);
94 static ReturnedValue method_unshift(const FunctionObject *, const Value *thisObject, const Value *argv, int argc);
95 static ReturnedValue method_indexOf(const FunctionObject *, const Value *thisObject, const Value *argv, int argc);
96 static ReturnedValue method_lastIndexOf(const FunctionObject *, const Value *thisObject, const Value *argv, int argc);
97 static ReturnedValue method_sort(const FunctionObject *, const Value *thisObject, const Value *argv, int argc);
98 static ReturnedValue method_get_length(const FunctionObject *, const Value *thisObject, const Value *argv, int argc);
99 static ReturnedValue method_set_length(const FunctionObject *, const Value *thisObject, const Value *argv, int argc);
100};
101
102}
103
105
106#endif
107
\inmodule QtCore
Definition qmetatype.h:320
\inmodule QtCore
Definition qobject.h:90
The QQmlListProperty class allows applications to expose list-like properties of QObject-derived clas...
Definition qqmllist.h:24
The QQmlListReference class allows the manipulation of QQmlListProperty properties.
Definition qqmllist.h:183
\inmodule QtCore
Definition qvariant.h:64
Combined button and popup list for selecting options.
\qmltype Particle \inqmlmodule QtQuick.Particles
quint64 ReturnedValue
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
const GLfloat * m
GLenum target
long long qint64
Definition qtypes.h:55
static QVariant toVariant(const QV4::Value &value, QMetaType typeHint, bool createJSValueForObjectsAndSymbols, V4ObjectSet *visitedObjects)
#define V4_NEEDS_DESTROY
#define Q_MANAGED_TYPE(type)
#define V4_PROTOTYPE(p)
#define V4_OBJECT2(DataClass, superClass)
QList< int > list
[14]
view create()
QJSEngine engine
[0]
QQmlListProperty< QObject > * property()
const QQmlListProperty< QObject > * property() const
void init(QMetaType propertyType)
QMetaType propertyType() const
static ReturnedValue method_push(const FunctionObject *, const Value *thisObject, const Value *argv, int argc)
static ReturnedValue method_splice(const FunctionObject *, const Value *thisObject, const Value *argv, int argc)
static ReturnedValue method_sort(const FunctionObject *, const Value *thisObject, const Value *argv, int argc)
static ReturnedValue method_set_length(const FunctionObject *, const Value *thisObject, const Value *argv, int argc)
static ReturnedValue method_get_length(const FunctionObject *, const Value *thisObject, const Value *argv, int argc)
static ReturnedValue method_pop(const FunctionObject *, const Value *thisObject, const Value *argv, int argc)
static ReturnedValue method_unshift(const FunctionObject *, const Value *thisObject, const Value *argv, int argc)
static ReturnedValue method_indexOf(const FunctionObject *, const Value *thisObject, const Value *argv, int argc)
static ReturnedValue method_lastIndexOf(const FunctionObject *, const Value *thisObject, const Value *argv, int argc)
static ReturnedValue method_shift(const FunctionObject *, const Value *thisObject, const Value *argv, int argc)
T * data() const
Definition qv4heap_p.h:193