Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Toggle main menu visibility
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
// Qt-Security score:significant
4
5
6
#
ifndef
QQMLADAPTORMODELENGINEDATA_P_H
7
#
define
QQMLADAPTORMODELENGINEDATA_P_H
8
9
//
10
// W A R N I N G
11
// -------------
12
//
13
// This file is not part of the Qt API. It exists purely as an
14
// implementation detail. This header file may change from version to
15
// version without notice, or even be removed.
16
//
17
// We mean it.
18
//
19
20
#
include
<
private
/
qqmldelegatemodel_p_p
.
h
>
21
#
include
<
private
/
qmetaobjectbuilder_p
.
h
>
22
#
include
<
private
/
qqmlproperty_p
.
h
>
23
24
#
include
<
private
/
qv4value_p
.
h
>
25
#
include
<
private
/
qv4functionobject_p
.
h
>
26
27
QT_BEGIN_NAMESPACE
28
29
class
QQmlAdaptorModelEngineData :
public
QV4::ExecutionEngine::Deletable
30
{
31
public
:
32
QQmlAdaptorModelEngineData(QV4::ExecutionEngine *v4);
33
34
QV4::ExecutionEngine *v4;
35
QV4::PersistentValue listItemProto;
36
37
static
QV4::ReturnedValue get_index(
const
QV4::FunctionObject *f,
const
QV4::Value *thisObject,
const
QV4::Value *,
int
)
38
{
39
QV4::Scope scope(f);
40
QV4::Scoped<QQmlDelegateModelItemObject> o(scope, thisObject->as<QQmlDelegateModelItemObject>());
41
if
(!o)
42
RETURN_RESULT(scope.engine->throwTypeError(QStringLiteral(
"Not a valid DelegateModel object"
)));
43
44
RETURN_RESULT(QV4::Encode(o->d()->item()->modelIndex()));
45
}
46
47
template
<
typename
T,
typename
M>
static
void
setModelDataType(QMetaObjectBuilder *builder, M *metaType)
48
{
49
builder->setFlags(MetaObjectFlag::DynamicMetaObject);
50
builder->setClassName(T::staticMetaObject.className());
51
builder->setSuperClass(&T::staticMetaObject);
52
metaType->propertyOffset = T::staticMetaObject.propertyCount();
53
metaType->signalOffset = T::staticMetaObject.methodCount();
54
}
55
56
static
void
addProperty(
57
QMetaObjectBuilder *builder,
int
propertyId,
const
QByteArray &propertyName,
58
const
QByteArray &propertyType,
bool
isWritable)
59
{
60
builder->addSignal(
"__"
+ QByteArray::number(propertyId) +
"()"
);
61
QMetaPropertyBuilder property = builder->addProperty(
62
propertyName, propertyType, propertyId);
63
property.setWritable(isWritable);
64
property.setFinal(
true
);
65
}
66
67
V4_DEFINE_EXTENSION(QQmlAdaptorModelEngineData, get)
68
};
69
70
QT_END_NAMESPACE
71
72
#
endif
// QQMLADAPTORMODELENGINEDATA_P_H
qtdeclarative
src
qmlmodels
qqmladaptormodelenginedata_p.h
Generated on
for Qt by
1.18.0