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
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
33{
35 void init(QObject *object, int propertyId, QMetaType propertyType);
36 void init(QObject *object, const QQmlListProperty<QObject> &list, QMetaType propertyType);
37 void destroy();
38
39 QObject *object() const { return m_object.data(); }
40 QMetaType propertyType() const { return QMetaType(m_propertyType); }
41
42 const QQmlListProperty<QObject> *property() const
43 {
44 return reinterpret_cast<const QQmlListProperty<QObject>*>(m_propertyData);
45 }
46
47 QQmlListProperty<QObject> *property()
48 {
49 return reinterpret_cast<QQmlListProperty<QObject>*>(m_propertyData);
50 }
51
52private:
53 void *m_propertyData[sizeof(QQmlListProperty<QObject>)/sizeof(void*)];
54
55 QV4QPointer<QObject> m_object;
56
57 // interface instead of QMetaType to keep class a POD
58 const QtPrivate::QMetaTypeInterface *m_propertyType;
59};
60
61}
62
63struct Q_QML_EXPORT QmlListWrapper : Object
64{
67 V4_PROTOTYPE(propertyListPrototype)
68 Q_MANAGED_TYPE(QmlListProperty)
69
70 static ReturnedValue create(ExecutionEngine *engine, QObject *object, int propId, QMetaType propType);
71 static ReturnedValue create(ExecutionEngine *engine, const QQmlListProperty<QObject> &prop, QMetaType propType);
73
74 QVariant toVariant() const;
75 QQmlListReference toListReference() const;
76
77 static ReturnedValue virtualGet(const Managed *m, PropertyKey id, const Value *receiver, bool *hasProperty);
78 static qint64 virtualGetLength(const Managed *m);
79 static bool virtualPut(Managed *m, PropertyKey id, const Value &value, Value *receiver);
80 static OwnPropertyKeyIterator *virtualOwnPropertyKeys(const Object *m, Value *target);
81};
82
84{
85 V4_PROTOTYPE(arrayPrototype)
86
87 void init();
88
89 static ReturnedValue method_pop(const FunctionObject *, const Value *thisObject, const Value *argv, int argc);
90 static ReturnedValue method_push(const FunctionObject *, const Value *thisObject, const Value *argv, int argc);
91 static ReturnedValue method_shift(const FunctionObject *, const Value *thisObject, const Value *argv, int argc);
92 static ReturnedValue method_splice(const FunctionObject *, const Value *thisObject, const Value *argv, int argc);
93 static ReturnedValue method_unshift(const FunctionObject *, const Value *thisObject, const Value *argv, int argc);
94 static ReturnedValue method_indexOf(const FunctionObject *, const Value *thisObject, const Value *argv, int argc);
95 static ReturnedValue method_lastIndexOf(const FunctionObject *, const Value *thisObject, const Value *argv, int argc);
96 static ReturnedValue method_sort(const FunctionObject *, const Value *thisObject, const Value *argv, int argc);
97 static ReturnedValue method_get_length(const FunctionObject *, const Value *thisObject, const Value *argv, int argc);
98 static ReturnedValue method_set_length(const FunctionObject *, const Value *thisObject, const Value *argv, int argc);
99};
100
101}
102
104
105#endif
106
\inmodule QtCore
Definition qmetatype.h:341
\inmodule QtCore
Definition qobject.h:103
The QQmlListReference class allows the manipulation of QQmlListProperty properties.
Definition qqmllist.h:183
\inmodule QtCore
Definition qvariant.h:65
Combined button and popup list for selecting options.
quint64 ReturnedValue
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
const GLfloat * m
GLenum target
long long qint64
Definition qtypes.h:60
static QVariant toVariant(const QV4::Value &value, QMetaType typeHint, JSToQVariantConversionBehavior conversionBehavior, 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