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
qqmladaptormodelenginedata_p.h
Go to the documentation of this file.
1// Copyright (C) 2023 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
5#ifndef QQMLADAPTORMODELENGINEDATA_P_H
6#define QQMLADAPTORMODELENGINEDATA_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/qqmldelegatemodel_p_p.h>
20#include <private/qmetaobjectbuilder_p.h>
21#include <private/qqmlproperty_p.h>
22
23#include <private/qv4value_p.h>
24#include <private/qv4functionobject_p.h>
25
27
29{
30public:
32
35
36 static QV4::ReturnedValue get_index(const QV4::FunctionObject *f, const QV4::Value *thisObject, const QV4::Value *, int)
37 {
38 QV4::Scope scope(f);
40 if (!o)
41 RETURN_RESULT(scope.engine->throwTypeError(QStringLiteral("Not a valid DelegateModel object")));
42
43 RETURN_RESULT(QV4::Encode(o->d()->item->index));
44 }
45
46 template <typename T, typename M> static void setModelDataType(QMetaObjectBuilder *builder, M *metaType)
47 {
49 builder->setClassName(T::staticMetaObject.className());
50 builder->setSuperClass(&T::staticMetaObject);
51 metaType->propertyOffset = T::staticMetaObject.propertyCount();
52 metaType->signalOffset = T::staticMetaObject.methodCount();
53 }
54
55 static void addProperty(QMetaObjectBuilder *builder, int propertyId, const QByteArray &propertyName, const QByteArray &propertyType)
56 {
57 builder->addSignal("__" + QByteArray::number(propertyId) + "()");
58 QMetaPropertyBuilder property = builder->addProperty(
59 propertyName, propertyType, propertyId);
60 property.setWritable(true);
61 }
62
64};
65
67
68#endif // QQMLADAPTORMODELENGINEDATA_P_H
\inmodule QtCore
Definition qbytearray.h:57
static QByteArray number(int, int base=10)
Returns a byte-array representing the whole number n as text.
void setSuperClass(const QMetaObject *meta)
Sets the superclass meta object of the class being constructed by this meta object builder to meta.
QMetaMethodBuilder addSignal(const QByteArray &signature)
Adds a new signal to this class with the specified signature.
void setFlags(MetaObjectFlags)
Sets the flags of the class being constructed by this meta object builder.
QMetaPropertyBuilder addProperty(const QByteArray &name, const QByteArray &type, int notifierId=-1)
Adds a new readable/writable property to this class with the specified name and type.
void setClassName(const QByteArray &name)
Sets the name of the class being constructed by this meta object builder.
void setWritable(bool value)
Sets this property to writable if value is true.
QQmlAdaptorModelEngineData(QV4::ExecutionEngine *v4)
static void setModelDataType(QMetaObjectBuilder *builder, M *metaType)
static void addProperty(QMetaObjectBuilder *builder, int propertyId, const QByteArray &propertyName, const QByteArray &propertyType)
static QV4::ReturnedValue get_index(const QV4::FunctionObject *f, const QV4::Value *thisObject, const QV4::Value *, int)
Combined button and popup list for selecting options.
quint64 ReturnedValue
static QDBusError::ErrorType get(const char *name)
@ DynamicMetaObject
GLfloat GLfloat f
#define M(_x, _y)
#define QStringLiteral(str)
#define V4_DEFINE_EXTENSION(dataclass, datafunction)
Definition qv4engine_p.h:38
#define RETURN_RESULT(r)
const char className[16]
[1]
Definition qwizard.cpp:100
ReturnedValue throwTypeError()
ExecutionEngine * engine
const T * as() const
Definition qv4value_p.h:132