Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/qtdeclarative/src/qtdeclarative/src/qml/util/qqmladaptormodel.cpp |
Switch to Source code | Preprocessed file |
Line | Source | Count | ||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | - | |||||||||||||||||||
2 | - | |||||||||||||||||||
3 | - | |||||||||||||||||||
4 | - | |||||||||||||||||||
5 | - | |||||||||||||||||||
6 | class QQmlAdaptorModelEngineData : public QV8Engine::Deletable | - | ||||||||||||||||||
7 | { | - | ||||||||||||||||||
8 | public: | - | ||||||||||||||||||
9 | QQmlAdaptorModelEngineData(QV4::ExecutionEngine *v4); | - | ||||||||||||||||||
10 | ~QQmlAdaptorModelEngineData(); | - | ||||||||||||||||||
11 | - | |||||||||||||||||||
12 | QV4::ExecutionEngine *v4; | - | ||||||||||||||||||
13 | QV4::PersistentValue listItemProto; | - | ||||||||||||||||||
14 | }; | - | ||||||||||||||||||
15 | - | |||||||||||||||||||
16 | static inline QQmlAdaptorModelEngineData *engineData(QV4::ExecutionEngine *engine) { static int extensionId = -1; if (extensionId == -1
executed 4 times by 2 tests: QV8Engine::registrationMutex()->unlock(); }extensionId = QV8Engine::registerExtension(); Executed by:
executed 4 times by 2 tests: QQmlAdaptorModelEngineData *rv = (QQmlAdaptorModelEngineData *)engine->v8Engine->extensionData(extensionId); if (!rvend of block Executed by:
executed 8 times by 2 tests: returnend of block Executed by:
executed 786 times by 2 tests: rv;return rv; Executed by:
executed 786 times by 2 tests: }return rv; Executed by:
| 0-786 | ||||||||||||||||||
17 | - | |||||||||||||||||||
18 | static QV4::ReturnedValue get_index(const QV4::FunctionObject *f, const QV4::Value *thisObject, const QV4::Value *, int) | - | ||||||||||||||||||
19 | { | - | ||||||||||||||||||
20 | QV4::Scope scope(f); | - | ||||||||||||||||||
21 | QV4::Scoped<QQmlDelegateModelItemObject> o(scope, thisObject->as<QQmlDelegateModelItemObject>()); | - | ||||||||||||||||||
22 | if (!o
| 0-2332 | ||||||||||||||||||
23 | return never executed: QV4::Encode(scope.engine->throwTypeError(([]() noexcept -> QString { enum { Size = sizeof(u"" "Not a valid VisualData object")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "Not a valid VisualData object" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); returnreturn QV4::Encode(scope.engine->throwTypeError(([]() noexcept -> QString { enum { Size = sizeof(u"" "Not a valid VisualData object")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "Not a valid VisualData object" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return qstring_literal_temp; }()))); never executed: qstring_literal_temp;return qstring_literal_temp; never executed: }())));return qstring_literal_temp; never executed: return QV4::Encode(scope.engine->throwTypeError(([]() noexcept -> QString { enum { Size = sizeof(u"" "Not a valid VisualData object")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "Not a valid VisualData object" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return qstring_literal_temp; }()))); | 0 | ||||||||||||||||||
24 | - | |||||||||||||||||||
25 | return executed 2332 times by 1 test: QV4::Encode(QV4::Encode(o->d()->item->index));return QV4::Encode(QV4::Encode(o->d()->item->index)); Executed by:
executed 2332 times by 1 test: return QV4::Encode(QV4::Encode(o->d()->item->index)); Executed by:
| 2332 | ||||||||||||||||||
26 | } | - | ||||||||||||||||||
27 | - | |||||||||||||||||||
28 | template <typename T, typename M> static void setModelDataType(QMetaObjectBuilder *builder, M *metaType) | - | ||||||||||||||||||
29 | { | - | ||||||||||||||||||
30 | builder->setFlags(QMetaObjectBuilder::DynamicMetaObject); | - | ||||||||||||||||||
31 | builder->setClassName(T::staticMetaObject.className()); | - | ||||||||||||||||||
32 | builder->setSuperClass(&T::staticMetaObject); | - | ||||||||||||||||||
33 | metaType->propertyOffset = T::staticMetaObject.propertyCount(); | - | ||||||||||||||||||
34 | metaType->signalOffset = T::staticMetaObject.methodCount(); | - | ||||||||||||||||||
35 | } executed 3970 times by 12 tests: end of block Executed by:
| 3970 | ||||||||||||||||||
36 | - | |||||||||||||||||||
37 | static void addProperty(QMetaObjectBuilder *builder, int propertyId, const QByteArray &propertyName, const QByteArray &propertyType) | - | ||||||||||||||||||
38 | { | - | ||||||||||||||||||
39 | builder->addSignal("__" + QByteArray::number(propertyId) + "()"); | - | ||||||||||||||||||
40 | QMetaPropertyBuilder property = builder->addProperty( | - | ||||||||||||||||||
41 | propertyName, propertyType, propertyId); | - | ||||||||||||||||||
42 | property.setWritable(true); | - | ||||||||||||||||||
43 | } executed 26940 times by 12 tests: end of block Executed by:
| 26940 | ||||||||||||||||||
44 | - | |||||||||||||||||||
45 | class VDMModelDelegateDataType; | - | ||||||||||||||||||
46 | - | |||||||||||||||||||
47 | class QQmlDMCachedModelData : public QQmlDelegateModelItem | - | ||||||||||||||||||
48 | { | - | ||||||||||||||||||
49 | public: | - | ||||||||||||||||||
50 | QQmlDMCachedModelData( | - | ||||||||||||||||||
51 | QQmlDelegateModelItemMetaType *metaType, | - | ||||||||||||||||||
52 | VDMModelDelegateDataType *dataType, | - | ||||||||||||||||||
53 | int index); | - | ||||||||||||||||||
54 | - | |||||||||||||||||||
55 | int metaCall(QMetaObject::Call call, int id, void **arguments); | - | ||||||||||||||||||
56 | - | |||||||||||||||||||
57 | virtual QVariant value(int role) const = 0; | - | ||||||||||||||||||
58 | virtual void setValue(int role, const QVariant &value) = 0; | - | ||||||||||||||||||
59 | - | |||||||||||||||||||
60 | void setValue(const QString &role, const QVariant &value) override; | - | ||||||||||||||||||
61 | bool resolveIndex(const QQmlAdaptorModel &model, int idx) override; | - | ||||||||||||||||||
62 | - | |||||||||||||||||||
63 | static QV4::ReturnedValue get_property(const QV4::FunctionObject *, const QV4::Value *thisObject, const QV4::Value *argv, int argc); | - | ||||||||||||||||||
64 | static QV4::ReturnedValue set_property(const QV4::FunctionObject *, const QV4::Value *thisObject, const QV4::Value *argv, int argc); | - | ||||||||||||||||||
65 | - | |||||||||||||||||||
66 | VDMModelDelegateDataType *type; | - | ||||||||||||||||||
67 | QVector<QVariant> cachedData; | - | ||||||||||||||||||
68 | }; | - | ||||||||||||||||||
69 | - | |||||||||||||||||||
70 | class VDMModelDelegateDataType | - | ||||||||||||||||||
71 | : public QQmlRefCount | - | ||||||||||||||||||
72 | , public QQmlAdaptorModel::Accessors | - | ||||||||||||||||||
73 | , public QAbstractDynamicMetaObject | - | ||||||||||||||||||
74 | { | - | ||||||||||||||||||
75 | public: | - | ||||||||||||||||||
76 | VDMModelDelegateDataType(QQmlAdaptorModel *model) | - | ||||||||||||||||||
77 | : model(model) | - | ||||||||||||||||||
78 | , metaObject(nullptr) | - | ||||||||||||||||||
79 | , propertyCache(nullptr) | - | ||||||||||||||||||
80 | , propertyOffset(0) | - | ||||||||||||||||||
81 | , signalOffset(0) | - | ||||||||||||||||||
82 | , hasModelData(false) | - | ||||||||||||||||||
83 | { | - | ||||||||||||||||||
84 | } executed 4156 times by 12 tests: end of block Executed by:
| 4156 | ||||||||||||||||||
85 | - | |||||||||||||||||||
86 | ~VDMModelDelegateDataType() | - | ||||||||||||||||||
87 | { | - | ||||||||||||||||||
88 | if (propertyCache
| 210-3930 | ||||||||||||||||||
89 | propertyCache->release(); executed 3930 times by 11 tests: propertyCache->release(); Executed by:
| 3930 | ||||||||||||||||||
90 | free(metaObject); | - | ||||||||||||||||||
91 | } executed 4140 times by 11 tests: end of block Executed by:
| 4140 | ||||||||||||||||||
92 | - | |||||||||||||||||||
93 | bool notify( | - | ||||||||||||||||||
94 | const QQmlAdaptorModel &, | - | ||||||||||||||||||
95 | const QList<QQmlDelegateModelItem *> &items, | - | ||||||||||||||||||
96 | int index, | - | ||||||||||||||||||
97 | int count, | - | ||||||||||||||||||
98 | const QVector<int> &roles) const override | - | ||||||||||||||||||
99 | { | - | ||||||||||||||||||
100 | bool changed = roles.isEmpty()
| 32-450 | ||||||||||||||||||
101 | if (!changed
| 6-418 | ||||||||||||||||||
102 | QList<int> roleIds; | - | ||||||||||||||||||
103 | for (const QByteArray &r : watchedRoles) { | - | ||||||||||||||||||
104 | QHash<QByteArray, int>::const_iterator it = roleNames.find(r); | - | ||||||||||||||||||
105 | if (it != roleNames.end()
| 4-8 | ||||||||||||||||||
106 | roleIds << it.value(); executed 8 times by 1 test: roleIds << it.value(); Executed by:
| 8 | ||||||||||||||||||
107 | } executed 12 times by 1 test: end of block Executed by:
| 12 | ||||||||||||||||||
108 | const_cast<VDMModelDelegateDataType *>(this)->watchedRoleIds = roleIds; | - | ||||||||||||||||||
109 | } executed 6 times by 1 test: end of block Executed by:
| 6 | ||||||||||||||||||
110 | - | |||||||||||||||||||
111 | QVector<int> signalIndexes; | - | ||||||||||||||||||
112 | for (int i = 0; i < roles.count()
| 52-494 | ||||||||||||||||||
113 | const int role = roles.at(i); | - | ||||||||||||||||||
114 | if (!changed
| 0-52 | ||||||||||||||||||
115 | changed = true; executed 8 times by 1 test: changed = true; Executed by:
| 8 | ||||||||||||||||||
116 | - | |||||||||||||||||||
117 | int propertyId = propertyRoles.indexOf(role); | - | ||||||||||||||||||
118 | if (propertyId != -1
| 0-52 | ||||||||||||||||||
119 | signalIndexes.append(propertyId + signalOffset); executed 52 times by 4 tests: signalIndexes.append(propertyId + signalOffset); Executed by:
| 52 | ||||||||||||||||||
120 | } executed 52 times by 4 tests: end of block Executed by:
| 52 | ||||||||||||||||||
121 | if (roles.isEmpty()
| 44-450 | ||||||||||||||||||
122 | const int propertyRolesCount = propertyRoles.count(); | - | ||||||||||||||||||
123 | signalIndexes.reserve(propertyRolesCount); | - | ||||||||||||||||||
124 | for (int propertyId = 0; propertyId < propertyRolesCount
| 450-3134 | ||||||||||||||||||
125 | signalIndexes.append(propertyId + signalOffset); executed 3134 times by 4 tests: signalIndexes.append(propertyId + signalOffset); Executed by:
| 3134 | ||||||||||||||||||
126 | } executed 450 times by 4 tests: end of block Executed by:
| 450 | ||||||||||||||||||
127 | - | |||||||||||||||||||
128 | for (int i = 0, c = items.count(); i < c
| 494-4646 | ||||||||||||||||||
129 | QQmlDelegateModelItem *item = items.at(i); | - | ||||||||||||||||||
130 | const int idx = item->modelIndex(); | - | ||||||||||||||||||
131 | if (idx >= index
| 1253-3393 | ||||||||||||||||||
132 | for (int i = 0; i < signalIndexes.count()
| 1952-13502 | ||||||||||||||||||
133 | QMetaObject::activate(item, signalIndexes.at(i), nullptr); executed 13502 times by 5 tests: QMetaObject::activate(item, signalIndexes.at(i), nullptr); Executed by:
| 13502 | ||||||||||||||||||
134 | } executed 1952 times by 5 tests: end of block Executed by:
| 1952 | ||||||||||||||||||
135 | } executed 4646 times by 5 tests: end of block Executed by:
| 4646 | ||||||||||||||||||
136 | return executed 494 times by 5 tests: changed;return changed; Executed by:
executed 494 times by 5 tests: return changed; Executed by:
| 494 | ||||||||||||||||||
137 | } | - | ||||||||||||||||||
138 | - | |||||||||||||||||||
139 | void replaceWatchedRoles( | - | ||||||||||||||||||
140 | QQmlAdaptorModel &, | - | ||||||||||||||||||
141 | const QList<QByteArray> &oldRoles, | - | ||||||||||||||||||
142 | const QList<QByteArray> &newRoles) const override | - | ||||||||||||||||||
143 | { | - | ||||||||||||||||||
144 | VDMModelDelegateDataType *dataType = const_cast<VDMModelDelegateDataType *>(this); | - | ||||||||||||||||||
145 | - | |||||||||||||||||||
146 | dataType->watchedRoleIds.clear(); | - | ||||||||||||||||||
147 | for (const QByteArray &oldRole : oldRoles) | - | ||||||||||||||||||
148 | dataType->watchedRoles.removeOne(oldRole); executed 24 times by 2 tests: dataType->watchedRoles.removeOne(oldRole); Executed by:
| 24 | ||||||||||||||||||
149 | dataType->watchedRoles += newRoles; | - | ||||||||||||||||||
150 | } executed 6002 times by 12 tests: end of block Executed by:
| 6002 | ||||||||||||||||||
151 | - | |||||||||||||||||||
152 | static QV4::ReturnedValue get_hasModelChildren(const QV4::FunctionObject *b, const QV4::Value *thisObject, const QV4::Value *, int) | - | ||||||||||||||||||
153 | { | - | ||||||||||||||||||
154 | QV4::Scope scope(b); | - | ||||||||||||||||||
155 | QV4::Scoped<QQmlDelegateModelItemObject> o(scope, thisObject->as<QQmlDelegateModelItemObject>()); | - | ||||||||||||||||||
156 | if (!o
| 0-8 | ||||||||||||||||||
157 | return never executed: QV4::Encode(scope.engine->throwTypeError(([]() noexcept -> QString { enum { Size = sizeof(u"" "Not a valid VisualData object")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "Not a valid VisualData object" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); returnreturn QV4::Encode(scope.engine->throwTypeError(([]() noexcept -> QString { enum { Size = sizeof(u"" "Not a valid VisualData object")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "Not a valid VisualData object" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return qstring_literal_temp; }()))); never executed: qstring_literal_temp;return qstring_literal_temp; never executed: }())));return qstring_literal_temp; never executed: return QV4::Encode(scope.engine->throwTypeError(([]() noexcept -> QString { enum { Size = sizeof(u"" "Not a valid VisualData object")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "Not a valid VisualData object" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return qstring_literal_temp; }()))); | 0 | ||||||||||||||||||
158 | - | |||||||||||||||||||
159 | const QQmlAdaptorModel *const model = static_cast<QQmlDMCachedModelData *>(o->d()->item)->type->model; | - | ||||||||||||||||||
160 | if (o->d()->item->index >= 0
| 0-8 | ||||||||||||||||||
161 | const QAbstractItemModel * const aim = model->aim(); | - | ||||||||||||||||||
162 | return executed 8 times by 1 test: QV4::Encode(QV4::Encode(aim->hasChildren(aim->index(o->d()->item->index, 0, model->rootIndex))));return QV4::Encode(QV4::Encode(aim->hasChildren(aim->index(o->d()->item->index, 0, model->rootIndex)))); Executed by:
executed 8 times by 1 test: return QV4::Encode(QV4::Encode(aim->hasChildren(aim->index(o->d()->item->index, 0, model->rootIndex)))); Executed by:
| 8 | ||||||||||||||||||
163 | } else { | - | ||||||||||||||||||
164 | return never executed: QV4::Encode(QV4::Encode(false));return QV4::Encode(QV4::Encode(false)); never executed: return QV4::Encode(QV4::Encode(false)); | 0 | ||||||||||||||||||
165 | } | - | ||||||||||||||||||
166 | } | - | ||||||||||||||||||
167 | - | |||||||||||||||||||
168 | - | |||||||||||||||||||
169 | void initializeConstructor(QQmlAdaptorModelEngineData *const data) | - | ||||||||||||||||||
170 | { | - | ||||||||||||||||||
171 | QV4::ExecutionEngine *v4 = data->v4; | - | ||||||||||||||||||
172 | QV4::Scope scope(v4); | - | ||||||||||||||||||
173 | QV4::ScopedObject proto(scope, v4->newObject()); | - | ||||||||||||||||||
174 | proto->defineAccessorProperty(([]() noexcept -> QString { enum { Size = sizeof(u"" "index")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "index" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return executed 362 times by 2 tests: qstring_literal_temp;return qstring_literal_temp; Executed by:
executed 362 times by 2 tests: }()), get_index, nullptr);return qstring_literal_temp; Executed by:
| 362 | ||||||||||||||||||
175 | proto->defineAccessorProperty(([]() noexcept -> QString { enum { Size = sizeof(u"" "hasModelChildren")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "hasModelChildren" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return executed 362 times by 2 tests: qstring_literal_temp;return qstring_literal_temp; Executed by:
executed 362 times by 2 tests: }()), get_hasModelChildren, nullptr);return qstring_literal_temp; Executed by:
| 362 | ||||||||||||||||||
176 | QV4::ScopedProperty p(scope); | - | ||||||||||||||||||
177 | - | |||||||||||||||||||
178 | typedef QHash<QByteArray, int>::const_iterator iterator; | - | ||||||||||||||||||
179 | for (iterator it = roleNames.constBegin(), end = roleNames.constEnd(); it != end
| 362-936 | ||||||||||||||||||
180 | const int propertyId = propertyRoles.indexOf(it.value()); | - | ||||||||||||||||||
181 | const QByteArray &propertyName = it.key(); | - | ||||||||||||||||||
182 | - | |||||||||||||||||||
183 | QV4::ScopedString name(scope, v4->newString(QString::fromUtf8(propertyName))); | - | ||||||||||||||||||
184 | QV4::ExecutionContext *global = v4->rootContext(); | - | ||||||||||||||||||
185 | QV4::ScopedFunctionObject g(scope, v4->memoryManager->allocate<QV4::IndexedBuiltinFunction>(global, propertyId, QQmlDMCachedModelData::get_property)); | - | ||||||||||||||||||
186 | QV4::ScopedFunctionObject s(scope, v4->memoryManager->allocate<QV4::IndexedBuiltinFunction>(global, propertyId, QQmlDMCachedModelData::set_property)); | - | ||||||||||||||||||
187 | p->setGetter(g); | - | ||||||||||||||||||
188 | p->setSetter(s); | - | ||||||||||||||||||
189 | proto->insertMember(name, p, QV4::Attr_Accessor|QV4::Attr_NotEnumerable|QV4::Attr_NotConfigurable); | - | ||||||||||||||||||
190 | } executed 936 times by 2 tests: end of block Executed by:
| 936 | ||||||||||||||||||
191 | prototype.set(v4, proto); | - | ||||||||||||||||||
192 | } executed 362 times by 2 tests: end of block Executed by:
| 362 | ||||||||||||||||||
193 | - | |||||||||||||||||||
194 | - | |||||||||||||||||||
195 | - | |||||||||||||||||||
196 | void objectDestroyed(QObject *) override | - | ||||||||||||||||||
197 | { | - | ||||||||||||||||||
198 | release(); | - | ||||||||||||||||||
199 | } executed 77952 times by 12 tests: end of block Executed by:
| 77952 | ||||||||||||||||||
200 | - | |||||||||||||||||||
201 | int metaCall(QObject *object, QMetaObject::Call call, int id, void **arguments) override | - | ||||||||||||||||||
202 | { | - | ||||||||||||||||||
203 | return executed 234595 times by 11 tests: static_cast<QQmlDMCachedModelData *>(object)->metaCall(call, id, arguments);return static_cast<QQmlDMCachedModelData *>(object)->metaCall(call, id, arguments); Executed by:
executed 234595 times by 11 tests: return static_cast<QQmlDMCachedModelData *>(object)->metaCall(call, id, arguments); Executed by:
| 234595 | ||||||||||||||||||
204 | } | - | ||||||||||||||||||
205 | - | |||||||||||||||||||
206 | QV4::PersistentValue prototype; | - | ||||||||||||||||||
207 | QList<int> propertyRoles; | - | ||||||||||||||||||
208 | QList<int> watchedRoleIds; | - | ||||||||||||||||||
209 | QList<QByteArray> watchedRoles; | - | ||||||||||||||||||
210 | QHash<QByteArray, int> roleNames; | - | ||||||||||||||||||
211 | QQmlAdaptorModel *model; | - | ||||||||||||||||||
212 | QMetaObject *metaObject; | - | ||||||||||||||||||
213 | QQmlPropertyCache *propertyCache; | - | ||||||||||||||||||
214 | int propertyOffset; | - | ||||||||||||||||||
215 | int signalOffset; | - | ||||||||||||||||||
216 | bool hasModelData; | - | ||||||||||||||||||
217 | }; | - | ||||||||||||||||||
218 | - | |||||||||||||||||||
219 | QQmlDMCachedModelData::QQmlDMCachedModelData( | - | ||||||||||||||||||
220 | QQmlDelegateModelItemMetaType *metaType, VDMModelDelegateDataType *dataType, int index) | - | ||||||||||||||||||
221 | : QQmlDelegateModelItem(metaType, index) | - | ||||||||||||||||||
222 | , type(dataType) | - | ||||||||||||||||||
223 | { | - | ||||||||||||||||||
224 | if (index == -1
| 360-77626 | ||||||||||||||||||
225 | cachedData.resize(type->hasModelData ? 1 : type->propertyRoles.count()); executed 360 times by 1 test: cachedData.resize(type->hasModelData ? 1 : type->propertyRoles.count()); Executed by:
| 360 | ||||||||||||||||||
226 | - | |||||||||||||||||||
227 | QObjectPrivate::get(this)->metaObject = type; | - | ||||||||||||||||||
228 | - | |||||||||||||||||||
229 | type->addref(); | - | ||||||||||||||||||
230 | - | |||||||||||||||||||
231 | QQmlData *qmldata = QQmlData::get(this, true); | - | ||||||||||||||||||
232 | qmldata->propertyCache = dataType->propertyCache; | - | ||||||||||||||||||
233 | qmldata->propertyCache->addref(); | - | ||||||||||||||||||
234 | } executed 77986 times by 12 tests: end of block Executed by:
| 77986 | ||||||||||||||||||
235 | - | |||||||||||||||||||
236 | int QQmlDMCachedModelData::metaCall(QMetaObject::Call call, int id, void **arguments) | - | ||||||||||||||||||
237 | { | - | ||||||||||||||||||
238 | if (call == QMetaObject::ReadProperty
| 0-234549 | ||||||||||||||||||
239 | const int propertyIndex = id - type->propertyOffset; | - | ||||||||||||||||||
240 | if (index == -1
| 1400-233149 | ||||||||||||||||||
241 | if (!cachedData.isEmpty()
| 0-1400 | ||||||||||||||||||
242 | *static_cast<QVariant *>(arguments[0]) = cachedData.at( | - | ||||||||||||||||||
243 | type->hasModelData ? 0 : propertyIndex); | - | ||||||||||||||||||
244 | } executed 1400 times by 1 test: end of block Executed by:
| 1400 | ||||||||||||||||||
245 | } executed 1400 times by 1 test: else if (*end of block Executed by:
| 0-233149 | ||||||||||||||||||
246 | *static_cast<QVariant *>(arguments[0]) = value(type->propertyRoles.at(propertyIndex)); | - | ||||||||||||||||||
247 | } executed 233149 times by 11 tests: end of block Executed by:
| 233149 | ||||||||||||||||||
248 | return executed 234549 times by 11 tests: -1;return -1; Executed by:
executed 234549 times by 11 tests: return -1; Executed by:
| 234549 | ||||||||||||||||||
249 | } else if (call == QMetaObject::WriteProperty
| 0-46 | ||||||||||||||||||
250 | const int propertyIndex = id - type->propertyOffset; | - | ||||||||||||||||||
251 | if (index == -1
| 6-40 | ||||||||||||||||||
252 | const QMetaObject *meta = metaObject(); | - | ||||||||||||||||||
253 | if (cachedData.count() > 1
| 8-32 | ||||||||||||||||||
254 | cachedData[propertyIndex] = *static_cast<QVariant *>(arguments[0]); | - | ||||||||||||||||||
255 | QMetaObject::activate(this, meta, propertyIndex, nullptr); | - | ||||||||||||||||||
256 | } executed 8 times by 1 test: else if (cachedData.count() == 1end of block Executed by:
| 0-32 | ||||||||||||||||||
257 | cachedData[0] = *static_cast<QVariant *>(arguments[0]); | - | ||||||||||||||||||
258 | QMetaObject::activate(this, meta, 0, nullptr); | - | ||||||||||||||||||
259 | QMetaObject::activate(this, meta, 1, nullptr); | - | ||||||||||||||||||
260 | } executed 32 times by 1 test: end of block Executed by:
| 32 | ||||||||||||||||||
261 | } executed 40 times by 1 test: else if (*end of block Executed by:
| 0-40 | ||||||||||||||||||
262 | setValue(type->propertyRoles.at(propertyIndex), *static_cast<QVariant *>(arguments[0])); | - | ||||||||||||||||||
263 | } executed 6 times by 2 tests: end of block Executed by:
| 6 | ||||||||||||||||||
264 | return executed 46 times by 2 tests: -1;return -1; Executed by:
executed 46 times by 2 tests: return -1; Executed by:
| 46 | ||||||||||||||||||
265 | } else { | - | ||||||||||||||||||
266 | return never executed: qt_metacall(call, id, arguments);return qt_metacall(call, id, arguments); never executed: return qt_metacall(call, id, arguments); | 0 | ||||||||||||||||||
267 | } | - | ||||||||||||||||||
268 | } | - | ||||||||||||||||||
269 | - | |||||||||||||||||||
270 | void QQmlDMCachedModelData::setValue(const QString &role, const QVariant &value) | - | ||||||||||||||||||
271 | { | - | ||||||||||||||||||
272 | QHash<QByteArray, int>::iterator it = type->roleNames.find(role.toUtf8()); | - | ||||||||||||||||||
273 | if (it != type->roleNames.end()
| 8-352 | ||||||||||||||||||
274 | for (int i = 0; i < type->propertyRoles.count()
| 0-440 | ||||||||||||||||||
275 | if (type->propertyRoles.at(i) == *it
| 88-352 | ||||||||||||||||||
276 | cachedData[i] = value; | - | ||||||||||||||||||
277 | return; executed 352 times by 1 test: return; Executed by:
| 352 | ||||||||||||||||||
278 | } | - | ||||||||||||||||||
279 | } executed 88 times by 1 test: end of block Executed by:
| 88 | ||||||||||||||||||
280 | } never executed: end of block | 0 | ||||||||||||||||||
281 | } executed 8 times by 1 test: end of block Executed by:
| 8 | ||||||||||||||||||
282 | - | |||||||||||||||||||
283 | bool QQmlDMCachedModelData::resolveIndex(const QQmlAdaptorModel &, int idx) | - | ||||||||||||||||||
284 | { | - | ||||||||||||||||||
285 | if (index == -1
| 0-120 | ||||||||||||||||||
286 | ((idx >= 0) ? static_cast<void>(0) : qt_assert("idx >= 0", __FILE__, 332)); | - | ||||||||||||||||||
287 | cachedData.clear(); | - | ||||||||||||||||||
288 | setModelIndex(idx); | - | ||||||||||||||||||
289 | const QMetaObject *meta = metaObject(); | - | ||||||||||||||||||
290 | const int propertyCount = type->propertyRoles.count(); | - | ||||||||||||||||||
291 | for (int i = 0; i < propertyCount
| 120-288 | ||||||||||||||||||
292 | QMetaObject::activate(this, meta, i, nullptr); executed 288 times by 1 test: QMetaObject::activate(this, meta, i, nullptr); Executed by:
| 288 | ||||||||||||||||||
293 | return executed 120 times by 1 test: true;return true; Executed by:
executed 120 times by 1 test: return true; Executed by:
| 120 | ||||||||||||||||||
294 | } else { | - | ||||||||||||||||||
295 | return never executed: false;return false; never executed: return false; | 0 | ||||||||||||||||||
296 | } | - | ||||||||||||||||||
297 | } | - | ||||||||||||||||||
298 | - | |||||||||||||||||||
299 | QV4::ReturnedValue QQmlDMCachedModelData::get_property(const QV4::FunctionObject *b, const QV4::Value *thisObject, const QV4::Value *, int) | - | ||||||||||||||||||
300 | { | - | ||||||||||||||||||
301 | QV4::Scope scope(b); | - | ||||||||||||||||||
302 | QV4::Scoped<QQmlDelegateModelItemObject> o(scope, thisObject->as<QQmlDelegateModelItemObject>()); | - | ||||||||||||||||||
303 | if (!o
| 0-2588 | ||||||||||||||||||
304 | return never executed: scope.engine->throwTypeError(([]() noexcept -> QString { enum { Size = sizeof(u"" "Not a valid VisualData object")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "Not a valid VisualData object" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); returnreturn scope.engine->throwTypeError(([]() noexcept -> QString { enum { Size = sizeof(u"" "Not a valid VisualData object")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "Not a valid VisualData object" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return qstring_literal_temp; }())); never executed: qstring_literal_temp;return qstring_literal_temp; never executed: }()));return qstring_literal_temp; never executed: return scope.engine->throwTypeError(([]() noexcept -> QString { enum { Size = sizeof(u"" "Not a valid VisualData object")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "Not a valid VisualData object" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return qstring_literal_temp; }())); | 0 | ||||||||||||||||||
305 | - | |||||||||||||||||||
306 | uint propertyId = static_cast<const QV4::IndexedBuiltinFunction *>(b)->d()->index; | - | ||||||||||||||||||
307 | - | |||||||||||||||||||
308 | QQmlDMCachedModelData *modelData = static_cast<QQmlDMCachedModelData *>(o->d()->item); | - | ||||||||||||||||||
309 | if (o->d()->item->index == -1
| 236-2352 | ||||||||||||||||||
310 | if (!modelData->cachedData.isEmpty()
| 0-236 | ||||||||||||||||||
311 | return executed 236 times by 1 test: scope.engine->fromVariant(return scope.engine->fromVariant( modelData->cachedData.at(modelData->type->hasModelData ? 0 : propertyId)); Executed by:
executed 236 times by 1 test: return scope.engine->fromVariant( modelData->cachedData.at(modelData->type->hasModelData ? 0 : propertyId)); Executed by:
| 236 | ||||||||||||||||||
312 | modelData->cachedData.at(modelData->type->hasModelData ? 0 : propertyId)); executed 236 times by 1 test: return scope.engine->fromVariant( modelData->cachedData.at(modelData->type->hasModelData ? 0 : propertyId)); Executed by:
| 236 | ||||||||||||||||||
313 | } | - | ||||||||||||||||||
314 | } never executed: else if (*end of block
| 0-2352 | ||||||||||||||||||
315 | return executed 2352 times by 2 tests: scope.engine->fromVariant(return scope.engine->fromVariant( modelData->value(modelData->type->propertyRoles.at(propertyId))); Executed by:
executed 2352 times by 2 tests: return scope.engine->fromVariant( modelData->value(modelData->type->propertyRoles.at(propertyId))); Executed by:
| 2352 | ||||||||||||||||||
316 | modelData->value(modelData->type->propertyRoles.at(propertyId))); executed 2352 times by 2 tests: return scope.engine->fromVariant( modelData->value(modelData->type->propertyRoles.at(propertyId))); Executed by:
| 2352 | ||||||||||||||||||
317 | } | - | ||||||||||||||||||
318 | return never executed: QV4::Encode::undefined();return QV4::Encode::undefined(); never executed: return QV4::Encode::undefined(); | 0 | ||||||||||||||||||
319 | } | - | ||||||||||||||||||
320 | - | |||||||||||||||||||
321 | QV4::ReturnedValue QQmlDMCachedModelData::set_property(const QV4::FunctionObject *b, const QV4::Value *thisObject, const QV4::Value *argv, int argc) | - | ||||||||||||||||||
322 | { | - | ||||||||||||||||||
323 | QV4::Scope scope(b); | - | ||||||||||||||||||
324 | QV4::Scoped<QQmlDelegateModelItemObject> o(scope, thisObject->as<QQmlDelegateModelItemObject>()); | - | ||||||||||||||||||
325 | if (!o
| 0-32 | ||||||||||||||||||
326 | return never executed: scope.engine->throwTypeError(([]() noexcept -> QString { enum { Size = sizeof(u"" "Not a valid VisualData object")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "Not a valid VisualData object" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); returnreturn scope.engine->throwTypeError(([]() noexcept -> QString { enum { Size = sizeof(u"" "Not a valid VisualData object")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "Not a valid VisualData object" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return qstring_literal_temp; }())); never executed: qstring_literal_temp;return qstring_literal_temp; never executed: }()));return qstring_literal_temp; never executed: return scope.engine->throwTypeError(([]() noexcept -> QString { enum { Size = sizeof(u"" "Not a valid VisualData object")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "Not a valid VisualData object" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return qstring_literal_temp; }())); | 0 | ||||||||||||||||||
327 | if (!argc
| 0-32 | ||||||||||||||||||
328 | return never executed: scope.engine->throwTypeError();return scope.engine->throwTypeError(); never executed: return scope.engine->throwTypeError(); | 0 | ||||||||||||||||||
329 | - | |||||||||||||||||||
330 | uint propertyId = static_cast<const QV4::IndexedBuiltinFunction *>(b)->d()->index; | - | ||||||||||||||||||
331 | - | |||||||||||||||||||
332 | if (o->d()->item->index == -1
| 12-20 | ||||||||||||||||||
333 | QQmlDMCachedModelData *modelData = static_cast<QQmlDMCachedModelData *>(o->d()->item); | - | ||||||||||||||||||
334 | if (!modelData->cachedData.isEmpty()
| 0-20 | ||||||||||||||||||
335 | if (modelData->cachedData.count() > 1
| 4-16 | ||||||||||||||||||
336 | modelData->cachedData[propertyId] = scope.engine->toVariant(argv[0], QVariant::Invalid); | - | ||||||||||||||||||
337 | QMetaObject::activate(o->d()->item, o->d()->item->metaObject(), propertyId, nullptr); | - | ||||||||||||||||||
338 | } executed 4 times by 1 test: else if (modelData->cachedData.count() == 1end of block Executed by:
| 0-16 | ||||||||||||||||||
339 | modelData->cachedData[0] = scope.engine->toVariant(argv[0], QVariant::Invalid); | - | ||||||||||||||||||
340 | QMetaObject::activate(o->d()->item, o->d()->item->metaObject(), 0, nullptr); | - | ||||||||||||||||||
341 | QMetaObject::activate(o->d()->item, o->d()->item->metaObject(), 1, nullptr); | - | ||||||||||||||||||
342 | } executed 16 times by 1 test: end of block Executed by:
| 16 | ||||||||||||||||||
343 | } executed 20 times by 1 test: end of block Executed by:
| 20 | ||||||||||||||||||
344 | } executed 20 times by 1 test: end of block Executed by:
| 20 | ||||||||||||||||||
345 | return executed 32 times by 1 test: QV4::Encode::undefined();return QV4::Encode::undefined(); Executed by:
executed 32 times by 1 test: return QV4::Encode::undefined(); Executed by:
| 32 | ||||||||||||||||||
346 | } | - | ||||||||||||||||||
347 | - | |||||||||||||||||||
348 | - | |||||||||||||||||||
349 | - | |||||||||||||||||||
350 | - | |||||||||||||||||||
351 | - | |||||||||||||||||||
352 | class QQmlDMAbstractItemModelData : public QQmlDMCachedModelData | - | ||||||||||||||||||
353 | { | - | ||||||||||||||||||
354 | public: | - | ||||||||||||||||||
355 | #pragma GCC diagnostic push | - | ||||||||||||||||||
356 | - | |||||||||||||||||||
357 | #pragma GCC diagnostic ignored "-Wsuggest-override" | - | ||||||||||||||||||
358 | static const QMetaObject staticMetaObject; virtual const QMetaObject *metaObject() const; virtual void *qt_metacast(const char *); virtual int qt_metacall(QMetaObject::Call, int, void **); static inline QString tr(const char *s, const char *c = nullptr, int n = -1) { return staticMetaObject.tr(s, c, n); } __attribute__ ((__deprecated__)) static inline QString trUtf8(const char *s, const char *c = nullptr, int n = -1) { return staticMetaObject.tr(s, c, n); } private: | - | ||||||||||||||||||
359 | #pragma GCC diagnostic ignored "-Wattributes" | - | ||||||||||||||||||
360 | __attribute__((visibility("hidden"))) static void qt_static_metacall(QObject *, QMetaObject::Call, int, void **); | - | ||||||||||||||||||
361 | #pragma GCC diagnostic pop | - | ||||||||||||||||||
362 | struct QPrivateSignal {}; | - | ||||||||||||||||||
363 | - | |||||||||||||||||||
364 | - | |||||||||||||||||||
365 | public: | - | ||||||||||||||||||
366 | QQmlDMAbstractItemModelData( | - | ||||||||||||||||||
367 | QQmlDelegateModelItemMetaType *metaType, | - | ||||||||||||||||||
368 | VDMModelDelegateDataType *dataType, | - | ||||||||||||||||||
369 | int index) | - | ||||||||||||||||||
370 | : QQmlDMCachedModelData(metaType, dataType, index) | - | ||||||||||||||||||
371 | { | - | ||||||||||||||||||
372 | } executed 77986 times by 12 tests: end of block Executed by:
| 77986 | ||||||||||||||||||
373 | - | |||||||||||||||||||
374 | bool hasModelChildren() const | - | ||||||||||||||||||
375 | { | - | ||||||||||||||||||
376 | if (index >= 0
| 0-34 | ||||||||||||||||||
377 | const QAbstractItemModel * const model = type->model->aim(); | - | ||||||||||||||||||
378 | return executed 34 times by 1 test: model->hasChildren(model->index(row, column, type->model->rootIndex));return model->hasChildren(model->index(row, column, type->model->rootIndex)); Executed by:
executed 34 times by 1 test: return model->hasChildren(model->index(row, column, type->model->rootIndex)); Executed by:
| 34 | ||||||||||||||||||
379 | } else { | - | ||||||||||||||||||
380 | return never executed: false;return false; never executed: return false; | 0 | ||||||||||||||||||
381 | } | - | ||||||||||||||||||
382 | } | - | ||||||||||||||||||
383 | - | |||||||||||||||||||
384 | QVariant value(int role) const override | - | ||||||||||||||||||
385 | { | - | ||||||||||||||||||
386 | return executed 235501 times by 11 tests: type->model->aim()->index(row, column, type->model->rootIndex).data(role);return type->model->aim()->index(row, column, type->model->rootIndex).data(role); Executed by:
executed 235501 times by 11 tests: return type->model->aim()->index(row, column, type->model->rootIndex).data(role); Executed by:
| 235501 | ||||||||||||||||||
387 | } | - | ||||||||||||||||||
388 | - | |||||||||||||||||||
389 | void setValue(int role, const QVariant &value) override | - | ||||||||||||||||||
390 | { | - | ||||||||||||||||||
391 | type->model->aim()->setData( | - | ||||||||||||||||||
392 | type->model->aim()->index(row, column, type->model->rootIndex), value, role); | - | ||||||||||||||||||
393 | } executed 6 times by 2 tests: end of block Executed by:
| 6 | ||||||||||||||||||
394 | - | |||||||||||||||||||
395 | QV4::ReturnedValue get() override | - | ||||||||||||||||||
396 | { | - | ||||||||||||||||||
397 | if (type->prototype.isUndefined()
| 362-4394 | ||||||||||||||||||
398 | QQmlAdaptorModelEngineData * const data = engineData(v4); | - | ||||||||||||||||||
399 | type->initializeConstructor(data); | - | ||||||||||||||||||
400 | } executed 362 times by 2 tests: end of block Executed by:
| 362 | ||||||||||||||||||
401 | QV4::Scope scope(v4); | - | ||||||||||||||||||
402 | QV4::ScopedObject proto(scope, type->prototype.value()); | - | ||||||||||||||||||
403 | QV4::ScopedObject o(scope, proto->engine()->memoryManager->allocate<QQmlDelegateModelItemObject>(this)); | - | ||||||||||||||||||
404 | o->setPrototypeOf(proto); | - | ||||||||||||||||||
405 | ++scriptRef; | - | ||||||||||||||||||
406 | return executed 4756 times by 2 tests: o.asReturnedValue();return o.asReturnedValue(); Executed by:
executed 4756 times by 2 tests: return o.asReturnedValue(); Executed by:
| 4756 | ||||||||||||||||||
407 | } | - | ||||||||||||||||||
408 | }; | - | ||||||||||||||||||
409 | - | |||||||||||||||||||
410 | class VDMAbstractItemModelDataType : public VDMModelDelegateDataType | - | ||||||||||||||||||
411 | { | - | ||||||||||||||||||
412 | public: | - | ||||||||||||||||||
413 | VDMAbstractItemModelDataType(QQmlAdaptorModel *model) | - | ||||||||||||||||||
414 | : VDMModelDelegateDataType(model) | - | ||||||||||||||||||
415 | { | - | ||||||||||||||||||
416 | } executed 4156 times by 12 tests: end of block Executed by:
| 4156 | ||||||||||||||||||
417 | - | |||||||||||||||||||
418 | int rowCount(const QQmlAdaptorModel &model) const override | - | ||||||||||||||||||
419 | { | - | ||||||||||||||||||
420 | return executed 259434 times by 12 tests: model.aim()->rowCount(model.rootIndex);return model.aim()->rowCount(model.rootIndex); Executed by:
executed 259434 times by 12 tests: return model.aim()->rowCount(model.rootIndex); Executed by:
| 259434 | ||||||||||||||||||
421 | } | - | ||||||||||||||||||
422 | - | |||||||||||||||||||
423 | int columnCount(const QQmlAdaptorModel &model) const override | - | ||||||||||||||||||
424 | { | - | ||||||||||||||||||
425 | return never executed: model.aim()->columnCount(model.rootIndex);return model.aim()->columnCount(model.rootIndex); never executed: return model.aim()->columnCount(model.rootIndex); | 0 | ||||||||||||||||||
426 | } | - | ||||||||||||||||||
427 | - | |||||||||||||||||||
428 | void cleanup(QQmlAdaptorModel &model, QQmlDelegateModel *vdm) const override | - | ||||||||||||||||||
429 | { | - | ||||||||||||||||||
430 | QAbstractItemModel * const aim = model.aim(); | - | ||||||||||||||||||
431 | if (aim
| 0-4080 | ||||||||||||||||||
432 | QObject::disconnect(aim, qFlagLocation("2""rowsInserted(QModelIndex,int,int)" "\0" __FILE__ ":" "470"), | - | ||||||||||||||||||
433 | vdm, qFlagLocation("1""_q_rowsInserted(QModelIndex,int,int)" "\0" __FILE__ ":" "471")); | - | ||||||||||||||||||
434 | QObject::disconnect(aim, qFlagLocation("2""rowsAboutToBeRemoved(QModelIndex,int,int)" "\0" __FILE__ ":" "472"), | - | ||||||||||||||||||
435 | vdm, qFlagLocation("1""_q_rowsAboutToBeRemoved(QModelIndex,int,int)" "\0" __FILE__ ":" "473")); | - | ||||||||||||||||||
436 | QObject::disconnect(aim, qFlagLocation("2""rowsRemoved(QModelIndex,int,int)" "\0" __FILE__ ":" "474"), | - | ||||||||||||||||||
437 | vdm, qFlagLocation("1""_q_rowsRemoved(QModelIndex,int,int)" "\0" __FILE__ ":" "475")); | - | ||||||||||||||||||
438 | QObject::disconnect(aim, qFlagLocation("2""dataChanged(QModelIndex,QModelIndex,QVector<int>)" "\0" __FILE__ ":" "476"), | - | ||||||||||||||||||
439 | vdm, qFlagLocation("1""_q_dataChanged(QModelIndex,QModelIndex,QVector<int>)" "\0" __FILE__ ":" "477")); | - | ||||||||||||||||||
440 | QObject::disconnect(aim, qFlagLocation("2""rowsMoved(QModelIndex,int,int,QModelIndex,int)" "\0" __FILE__ ":" "478"), | - | ||||||||||||||||||
441 | vdm, qFlagLocation("1""_q_rowsMoved(QModelIndex,int,int,QModelIndex,int)" "\0" __FILE__ ":" "479")); | - | ||||||||||||||||||
442 | QObject::disconnect(aim, qFlagLocation("2""modelReset()" "\0" __FILE__ ":" "480"), | - | ||||||||||||||||||
443 | vdm, qFlagLocation("1""_q_modelReset()" "\0" __FILE__ ":" "481")); | - | ||||||||||||||||||
444 | QObject::disconnect(aim, qFlagLocation("2""layoutChanged(QList<QPersistentModelIndex>,QAbstractItemModel::LayoutChangeHint)" "\0" __FILE__ ":" "482"), | - | ||||||||||||||||||
445 | vdm, qFlagLocation("1""_q_layoutChanged(QList<QPersistentModelIndex>,QAbstractItemModel::LayoutChangeHint)" "\0" __FILE__ ":" "483")); | - | ||||||||||||||||||
446 | } executed 70 times by 6 tests: end of block Executed by:
| 70 | ||||||||||||||||||
447 | - | |||||||||||||||||||
448 | const_cast<VDMAbstractItemModelDataType *>(this)->release(); | - | ||||||||||||||||||
449 | } executed 4150 times by 11 tests: end of block Executed by:
| 4150 | ||||||||||||||||||
450 | - | |||||||||||||||||||
451 | QVariant value(const QQmlAdaptorModel &model, int index, const QString &role) const override | - | ||||||||||||||||||
452 | { | - | ||||||||||||||||||
453 | QHash<QByteArray, int>::const_iterator it = roleNames.find(role.toUtf8()); | - | ||||||||||||||||||
454 | if (it != roleNames.end()
| 8-7278 | ||||||||||||||||||
455 | return executed 7278 times by 3 tests: model.aim()->index(model.rowAt(index), model.columnAt(index), model.rootIndex).data(*it);return model.aim()->index(model.rowAt(index), model.columnAt(index), model.rootIndex).data(*it); Executed by:
executed 7278 times by 3 tests: return model.aim()->index(model.rowAt(index), model.columnAt(index), model.rootIndex).data(*it); Executed by:
| 7278 | ||||||||||||||||||
456 | } else if (role == QLatin1String("hasModelChildren")
| 0-8 | ||||||||||||||||||
457 | return executed 8 times by 1 test: QVariant(model.aim()->hasChildren(model.aim()->index(model.rowAt(index), model.columnAt(index), model.rootIndex)));return QVariant(model.aim()->hasChildren(model.aim()->index(model.rowAt(index), model.columnAt(index), model.rootIndex))); Executed by:
executed 8 times by 1 test: return QVariant(model.aim()->hasChildren(model.aim()->index(model.rowAt(index), model.columnAt(index), model.rootIndex))); Executed by:
| 8 | ||||||||||||||||||
458 | } else { | - | ||||||||||||||||||
459 | return never executed: QVariant();return QVariant(); never executed: return QVariant(); | 0 | ||||||||||||||||||
460 | } | - | ||||||||||||||||||
461 | } | - | ||||||||||||||||||
462 | - | |||||||||||||||||||
463 | QVariant parentModelIndex(const QQmlAdaptorModel &model) const override | - | ||||||||||||||||||
464 | { | - | ||||||||||||||||||
465 | return executed 2 times by 1 test: modelreturn model ? QVariant::fromValue(model.aim()->parent(model.rootIndex)) : QVariant(); Executed by:
executed 2 times by 1 test: return model ? QVariant::fromValue(model.aim()->parent(model.rootIndex)) : QVariant(); Executed by:
| 2 | ||||||||||||||||||
466 | ? QVariant::fromValue(model.aim()->parent(model.rootIndex)) executed 2 times by 1 test: return model ? QVariant::fromValue(model.aim()->parent(model.rootIndex)) : QVariant(); Executed by:
| 2 | ||||||||||||||||||
467 | : QVariant(); executed 2 times by 1 test: return model ? QVariant::fromValue(model.aim()->parent(model.rootIndex)) : QVariant(); Executed by:
| 2 | ||||||||||||||||||
468 | } | - | ||||||||||||||||||
469 | - | |||||||||||||||||||
470 | QVariant modelIndex(const QQmlAdaptorModel &model, int index) const override | - | ||||||||||||||||||
471 | { | - | ||||||||||||||||||
472 | return executed 6 times by 2 tests: modelreturn model ? QVariant::fromValue(model.aim()->index(model.rowAt(index), model.columnAt(index), model.rootIndex)) : QVariant(); Executed by:
executed 6 times by 2 tests: return model ? QVariant::fromValue(model.aim()->index(model.rowAt(index), model.columnAt(index), model.rootIndex)) : QVariant(); Executed by:
| 6 | ||||||||||||||||||
473 | ? QVariant::fromValue(model.aim()->index(model.rowAt(index), model.columnAt(index), model.rootIndex)) executed 6 times by 2 tests: return model ? QVariant::fromValue(model.aim()->index(model.rowAt(index), model.columnAt(index), model.rootIndex)) : QVariant(); Executed by:
| 6 | ||||||||||||||||||
474 | : QVariant(); executed 6 times by 2 tests: return model ? QVariant::fromValue(model.aim()->index(model.rowAt(index), model.columnAt(index), model.rootIndex)) : QVariant(); Executed by:
| 6 | ||||||||||||||||||
475 | } | - | ||||||||||||||||||
476 | - | |||||||||||||||||||
477 | bool canFetchMore(const QQmlAdaptorModel &model) const override | - | ||||||||||||||||||
478 | { | - | ||||||||||||||||||
479 | return executed 11513 times by 12 tests: model && model.aim()->canFetchMore(model.rootIndex);return model && model.aim()->canFetchMore(model.rootIndex); Executed by:
executed 11513 times by 12 tests: return model && model.aim()->canFetchMore(model.rootIndex); Executed by:
| 11513 | ||||||||||||||||||
480 | } | - | ||||||||||||||||||
481 | - | |||||||||||||||||||
482 | void fetchMore(QQmlAdaptorModel &model) const override | - | ||||||||||||||||||
483 | { | - | ||||||||||||||||||
484 | if (model
| 0-18 | ||||||||||||||||||
485 | model.aim()->fetchMore(model.rootIndex); executed 18 times by 1 test: model.aim()->fetchMore(model.rootIndex); Executed by:
| 18 | ||||||||||||||||||
486 | } executed 18 times by 1 test: end of block Executed by:
| 18 | ||||||||||||||||||
487 | - | |||||||||||||||||||
488 | QQmlDelegateModelItem *createItem( | - | ||||||||||||||||||
489 | QQmlAdaptorModel &model, | - | ||||||||||||||||||
490 | QQmlDelegateModelItemMetaType *metaType, | - | ||||||||||||||||||
491 | int index) const override | - | ||||||||||||||||||
492 | { | - | ||||||||||||||||||
493 | VDMAbstractItemModelDataType *dataType = const_cast<VDMAbstractItemModelDataType *>(this); | - | ||||||||||||||||||
494 | if (!metaObject
| 3946-74040 | ||||||||||||||||||
495 | dataType->initializeMetaType(model); executed 3946 times by 12 tests: dataType->initializeMetaType(model); Executed by:
| 3946 | ||||||||||||||||||
496 | return executed 77986 times by 12 tests: new QQmlDMAbstractItemModelData(metaType, dataType, index);return new QQmlDMAbstractItemModelData(metaType, dataType, index); Executed by:
executed 77986 times by 12 tests: return new QQmlDMAbstractItemModelData(metaType, dataType, index); Executed by:
| 77986 | ||||||||||||||||||
497 | } | - | ||||||||||||||||||
498 | - | |||||||||||||||||||
499 | void initializeMetaType(QQmlAdaptorModel &model) | - | ||||||||||||||||||
500 | { | - | ||||||||||||||||||
501 | QMetaObjectBuilder builder; | - | ||||||||||||||||||
502 | setModelDataType<QQmlDMAbstractItemModelData>(&builder, this); | - | ||||||||||||||||||
503 | - | |||||||||||||||||||
504 | const QByteArray propertyType = ([]() -> QByteArray { enum { Size = sizeof("QVariant") - 1 }; static const QStaticByteArrayData<Size> qbytearray_literal = { { { { -1 } }, Size, 0, 0, sizeof(QByteArrayData) }, "QVariant" }; QByteArrayDataPtr holder = { qbytearray_literal.data_ptr() }; const QByteArray ba(holder); return executed 3946 times by 12 tests: ba;return ba; Executed by:
executed 3946 times by 12 tests: }());return ba; Executed by:
| 3946 | ||||||||||||||||||
505 | const QHash<int, QByteArray> names = model.aim()->roleNames(); | - | ||||||||||||||||||
506 | for (QHash<int, QByteArray>::const_iterator it = names.begin(), cend = names.end(); it != cend
| 3946-26316 | ||||||||||||||||||
507 | const int propertyId = propertyRoles.count(); | - | ||||||||||||||||||
508 | propertyRoles.append(it.key()); | - | ||||||||||||||||||
509 | roleNames.insert(it.value(), it.key()); | - | ||||||||||||||||||
510 | addProperty(&builder, propertyId, it.value(), propertyType); | - | ||||||||||||||||||
511 | } executed 26316 times by 12 tests: end of block Executed by:
| 26316 | ||||||||||||||||||
512 | if (propertyRoles.count() == 1
| 624-3322 | ||||||||||||||||||
513 | hasModelData = true; | - | ||||||||||||||||||
514 | const int role = names.begin().key(); | - | ||||||||||||||||||
515 | const QByteArray propertyName = ([]() -> QByteArray { enum { Size = sizeof("modelData") - 1 }; static const QStaticByteArrayData<Size> qbytearray_literal = { { { { -1 } }, Size, 0, 0, sizeof(QByteArrayData) }, "modelData" }; QByteArrayDataPtr holder = { qbytearray_literal.data_ptr() }; const QByteArray ba(holder); return executed 624 times by 10 tests: ba;return ba; Executed by:
executed 624 times by 10 tests: }());return ba; Executed by:
| 624 | ||||||||||||||||||
516 | - | |||||||||||||||||||
517 | propertyRoles.append(role); | - | ||||||||||||||||||
518 | roleNames.insert(propertyName, role); | - | ||||||||||||||||||
519 | addProperty(&builder, 1, propertyName, propertyType); | - | ||||||||||||||||||
520 | } executed 624 times by 10 tests: end of block Executed by:
| 624 | ||||||||||||||||||
521 | - | |||||||||||||||||||
522 | metaObject = builder.toMetaObject(); | - | ||||||||||||||||||
523 | *static_cast<QMetaObject *>(this) = *metaObject; | - | ||||||||||||||||||
524 | propertyCache = new QQmlPropertyCache(metaObject); | - | ||||||||||||||||||
525 | } executed 3946 times by 12 tests: end of block Executed by:
| 3946 | ||||||||||||||||||
526 | }; | - | ||||||||||||||||||
527 | - | |||||||||||||||||||
528 | - | |||||||||||||||||||
529 | - | |||||||||||||||||||
530 | - | |||||||||||||||||||
531 | - | |||||||||||||||||||
532 | class QQmlDMListAccessorData : public QQmlDelegateModelItem | - | ||||||||||||||||||
533 | { | - | ||||||||||||||||||
534 | public: | - | ||||||||||||||||||
535 | #pragma GCC diagnostic push | - | ||||||||||||||||||
536 | - | |||||||||||||||||||
537 | #pragma GCC diagnostic ignored "-Wsuggest-override" | - | ||||||||||||||||||
538 | static const QMetaObject staticMetaObject; virtual const QMetaObject *metaObject() const; virtual void *qt_metacast(const char *); virtual int qt_metacall(QMetaObject::Call, int, void **); static inline QString tr(const char *s, const char *c = nullptr, int n = -1) { return staticMetaObject.tr(s, c, n); } __attribute__ ((__deprecated__)) static inline QString trUtf8(const char *s, const char *c = nullptr, int n = -1) { return staticMetaObject.tr(s, c, n); } private: | - | ||||||||||||||||||
539 | #pragma GCC diagnostic ignored "-Wattributes" | - | ||||||||||||||||||
540 | __attribute__((visibility("hidden"))) static void qt_static_metacall(QObject *, QMetaObject::Call, int, void **); | - | ||||||||||||||||||
541 | #pragma GCC diagnostic pop | - | ||||||||||||||||||
542 | struct QPrivateSignal {}; | - | ||||||||||||||||||
543 | - | |||||||||||||||||||
544 | public: | - | ||||||||||||||||||
545 | QQmlDMListAccessorData(QQmlDelegateModelItemMetaType *metaType, int index, const QVariant &value) | - | ||||||||||||||||||
546 | : QQmlDelegateModelItem(metaType, index) | - | ||||||||||||||||||
547 | , cachedData(value) | - | ||||||||||||||||||
548 | { | - | ||||||||||||||||||
549 | } executed 9985 times by 22 tests: end of block Executed by:
| 9985 | ||||||||||||||||||
550 | - | |||||||||||||||||||
551 | QVariant modelData() const | - | ||||||||||||||||||
552 | { | - | ||||||||||||||||||
553 | return executed 5750 times by 7 tests: cachedData;return cachedData; Executed by:
executed 5750 times by 7 tests: return cachedData; Executed by:
| 5750 | ||||||||||||||||||
554 | } | - | ||||||||||||||||||
555 | - | |||||||||||||||||||
556 | void setModelData(const QVariant &data) | - | ||||||||||||||||||
557 | { | - | ||||||||||||||||||
558 | if (index == -1
| 0-12 | ||||||||||||||||||
559 | cachedData = data; | - | ||||||||||||||||||
560 | modelDataChanged(); | - | ||||||||||||||||||
561 | } executed 12 times by 1 test: end of block Executed by:
| 12 | ||||||||||||||||||
562 | } executed 16 times by 1 test: end of block Executed by:
| 16 | ||||||||||||||||||
563 | - | |||||||||||||||||||
564 | static QV4::ReturnedValue get_modelData(const QV4::FunctionObject *b, const QV4::Value *thisObject, const QV4::Value *, int) | - | ||||||||||||||||||
565 | { | - | ||||||||||||||||||
566 | QV4::ExecutionEngine *v4 = b->engine(); | - | ||||||||||||||||||
567 | const QQmlDelegateModelItemObject *o = thisObject->as<QQmlDelegateModelItemObject>(); | - | ||||||||||||||||||
568 | if (!o
| 0-208 | ||||||||||||||||||
569 | return never executed: v4->throwTypeError(([]() noexcept -> QString { enum { Size = sizeof(u"" "Not a valid VisualData object")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "Not a valid VisualData object" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); returnreturn v4->throwTypeError(([]() noexcept -> QString { enum { Size = sizeof(u"" "Not a valid VisualData object")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "Not a valid VisualData object" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return qstring_literal_temp; }())); never executed: qstring_literal_temp;return qstring_literal_temp; never executed: }()));return qstring_literal_temp; never executed: return v4->throwTypeError(([]() noexcept -> QString { enum { Size = sizeof(u"" "Not a valid VisualData object")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "Not a valid VisualData object" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return qstring_literal_temp; }())); | 0 | ||||||||||||||||||
570 | - | |||||||||||||||||||
571 | return executed 208 times by 1 test: v4->fromVariant(static_cast<QQmlDMListAccessorData *>(o->d()->item)->cachedData);return v4->fromVariant(static_cast<QQmlDMListAccessorData *>(o->d()->item)->cachedData); Executed by:
executed 208 times by 1 test: return v4->fromVariant(static_cast<QQmlDMListAccessorData *>(o->d()->item)->cachedData); Executed by:
| 208 | ||||||||||||||||||
572 | } | - | ||||||||||||||||||
573 | - | |||||||||||||||||||
574 | static QV4::ReturnedValue set_modelData(const QV4::FunctionObject *b, const QV4::Value *thisObject, const QV4::Value *argv, int argc) | - | ||||||||||||||||||
575 | { | - | ||||||||||||||||||
576 | QV4::ExecutionEngine *v4 = b->engine(); | - | ||||||||||||||||||
577 | const QQmlDelegateModelItemObject *o = thisObject->as<QQmlDelegateModelItemObject>(); | - | ||||||||||||||||||
578 | if (!o
| 0-8 | ||||||||||||||||||
579 | return never executed: v4->throwTypeError(([]() noexcept -> QString { enum { Size = sizeof(u"" "Not a valid VisualData object")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "Not a valid VisualData object" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); returnreturn v4->throwTypeError(([]() noexcept -> QString { enum { Size = sizeof(u"" "Not a valid VisualData object")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "Not a valid VisualData object" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return qstring_literal_temp; }())); never executed: qstring_literal_temp;return qstring_literal_temp; never executed: }()));return qstring_literal_temp; never executed: return v4->throwTypeError(([]() noexcept -> QString { enum { Size = sizeof(u"" "Not a valid VisualData object")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "Not a valid VisualData object" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return qstring_literal_temp; }())); | 0 | ||||||||||||||||||
580 | if (!argc
| 0-8 | ||||||||||||||||||
581 | return never executed: v4->throwTypeError();return v4->throwTypeError(); never executed: return v4->throwTypeError(); | 0 | ||||||||||||||||||
582 | - | |||||||||||||||||||
583 | static_cast<QQmlDMListAccessorData *>(o->d()->item)->setModelData(v4->toVariant(argv[0], QVariant::Invalid)); | - | ||||||||||||||||||
584 | return executed 8 times by 1 test: QV4::Encode::undefined();return QV4::Encode::undefined(); Executed by:
executed 8 times by 1 test: return QV4::Encode::undefined(); Executed by:
| 8 | ||||||||||||||||||
585 | } | - | ||||||||||||||||||
586 | - | |||||||||||||||||||
587 | QV4::ReturnedValue get() override | - | ||||||||||||||||||
588 | { | - | ||||||||||||||||||
589 | QQmlAdaptorModelEngineData *data = engineData(v4); | - | ||||||||||||||||||
590 | QV4::Scope scope(v4); | - | ||||||||||||||||||
591 | QV4::ScopedObject o(scope, v4->memoryManager->allocate<QQmlDelegateModelItemObject>(this)); | - | ||||||||||||||||||
592 | QV4::ScopedObject p(scope, data->listItemProto.value()); | - | ||||||||||||||||||
593 | o->setPrototypeOf(p); | - | ||||||||||||||||||
594 | ++scriptRef; | - | ||||||||||||||||||
595 | return executed 424 times by 1 test: o.asReturnedValue();return o.asReturnedValue(); Executed by:
executed 424 times by 1 test: return o.asReturnedValue(); Executed by:
| 424 | ||||||||||||||||||
596 | } | - | ||||||||||||||||||
597 | - | |||||||||||||||||||
598 | void setValue(const QString &role, const QVariant &value) override | - | ||||||||||||||||||
599 | { | - | ||||||||||||||||||
600 | if (role == QLatin1String("modelData")
| 0-44 | ||||||||||||||||||
601 | cachedData = value; executed 44 times by 1 test: cachedData = value; Executed by:
| 44 | ||||||||||||||||||
602 | } executed 44 times by 1 test: end of block Executed by:
| 44 | ||||||||||||||||||
603 | - | |||||||||||||||||||
604 | bool resolveIndex(const QQmlAdaptorModel &model, int idx) override | - | ||||||||||||||||||
605 | { | - | ||||||||||||||||||
606 | if (index == -1
| 0-12 | ||||||||||||||||||
607 | index = idx; | - | ||||||||||||||||||
608 | cachedData = model.list.at(idx); | - | ||||||||||||||||||
609 | modelIndexChanged(); | - | ||||||||||||||||||
610 | modelDataChanged(); | - | ||||||||||||||||||
611 | return executed 12 times by 1 test: true;return true; Executed by:
executed 12 times by 1 test: return true; Executed by:
| 12 | ||||||||||||||||||
612 | } else { | - | ||||||||||||||||||
613 | return never executed: false;return false; never executed: return false; | 0 | ||||||||||||||||||
614 | } | - | ||||||||||||||||||
615 | } | - | ||||||||||||||||||
616 | - | |||||||||||||||||||
617 | - | |||||||||||||||||||
618 | public : | - | ||||||||||||||||||
619 | void modelDataChanged(); | - | ||||||||||||||||||
620 | - | |||||||||||||||||||
621 | private: | - | ||||||||||||||||||
622 | QVariant cachedData; | - | ||||||||||||||||||
623 | }; | - | ||||||||||||||||||
624 | - | |||||||||||||||||||
625 | - | |||||||||||||||||||
626 | class VDMListDelegateDataType : public QQmlAdaptorModel::Accessors | - | ||||||||||||||||||
627 | { | - | ||||||||||||||||||
628 | public: | - | ||||||||||||||||||
629 | inline VDMListDelegateDataType() {} | - | ||||||||||||||||||
630 | - | |||||||||||||||||||
631 | int rowCount(const QQmlAdaptorModel &model) const override | - | ||||||||||||||||||
632 | { | - | ||||||||||||||||||
633 | return executed 20760 times by 22 tests: model.list.count();return model.list.count(); Executed by:
executed 20760 times by 22 tests: return model.list.count(); Executed by:
| 20760 | ||||||||||||||||||
634 | } | - | ||||||||||||||||||
635 | - | |||||||||||||||||||
636 | int columnCount(const QQmlAdaptorModel &) const override | - | ||||||||||||||||||
637 | { | - | ||||||||||||||||||
638 | return never executed: 1;return 1; never executed: return 1; | 0 | ||||||||||||||||||
639 | } | - | ||||||||||||||||||
640 | - | |||||||||||||||||||
641 | QVariant value(const QQmlAdaptorModel &model, int index, const QString &role) const override | - | ||||||||||||||||||
642 | { | - | ||||||||||||||||||
643 | return executed 102 times by 1 test: role == QLatin1String("modelData")return role == QLatin1String("modelData") ? model.list.at(index) : QVariant(); Executed by:
executed 102 times by 1 test: return role == QLatin1String("modelData") ? model.list.at(index) : QVariant(); Executed by:
| 102 | ||||||||||||||||||
644 | ? model.list.at(index) executed 102 times by 1 test: return role == QLatin1String("modelData") ? model.list.at(index) : QVariant(); Executed by:
| 102 | ||||||||||||||||||
645 | : QVariant(); executed 102 times by 1 test: return role == QLatin1String("modelData") ? model.list.at(index) : QVariant(); Executed by:
| 102 | ||||||||||||||||||
646 | } | - | ||||||||||||||||||
647 | - | |||||||||||||||||||
648 | QQmlDelegateModelItem *createItem( | - | ||||||||||||||||||
649 | QQmlAdaptorModel &model, | - | ||||||||||||||||||
650 | QQmlDelegateModelItemMetaType *metaType, | - | ||||||||||||||||||
651 | int index) const override | - | ||||||||||||||||||
652 | { | - | ||||||||||||||||||
653 | return executed 9985 times by 22 tests: new QQmlDMListAccessorData(return new QQmlDMListAccessorData( metaType, index, index >= 0 && index < model.list.count() ? model.list.at(index) : QVariant()); Executed by:
executed 9985 times by 22 tests: return new QQmlDMListAccessorData( metaType, index, index >= 0 && index < model.list.count() ? model.list.at(index) : QVariant()); Executed by:
| 9985 | ||||||||||||||||||
654 | metaType, executed 9985 times by 22 tests: return new QQmlDMListAccessorData( metaType, index, index >= 0 && index < model.list.count() ? model.list.at(index) : QVariant()); Executed by:
| 9985 | ||||||||||||||||||
655 | index, executed 9985 times by 22 tests: return new QQmlDMListAccessorData( metaType, index, index >= 0 && index < model.list.count() ? model.list.at(index) : QVariant()); Executed by:
| 9985 | ||||||||||||||||||
656 | index >= 0 && index < model.list.count() ? model.list.at(index) : QVariant()); executed 9985 times by 22 tests: return new QQmlDMListAccessorData( metaType, index, index >= 0 && index < model.list.count() ? model.list.at(index) : QVariant()); Executed by:
| 9985 | ||||||||||||||||||
657 | } | - | ||||||||||||||||||
658 | }; | - | ||||||||||||||||||
659 | - | |||||||||||||||||||
660 | - | |||||||||||||||||||
661 | - | |||||||||||||||||||
662 | - | |||||||||||||||||||
663 | - | |||||||||||||||||||
664 | class VDMObjectDelegateDataType; | - | ||||||||||||||||||
665 | class QQmlDMObjectData : public QQmlDelegateModelItem, public QQmlAdaptorModelProxyInterface | - | ||||||||||||||||||
666 | { | - | ||||||||||||||||||
667 | public: | - | ||||||||||||||||||
668 | #pragma GCC diagnostic push | - | ||||||||||||||||||
669 | - | |||||||||||||||||||
670 | #pragma GCC diagnostic ignored "-Wsuggest-override" | - | ||||||||||||||||||
671 | static const QMetaObject staticMetaObject; virtual const QMetaObject *metaObject() const; virtual void *qt_metacast(const char *); virtual int qt_metacall(QMetaObject::Call, int, void **); static inline QString tr(const char *s, const char *c = nullptr, int n = -1) { return staticMetaObject.tr(s, c, n); } __attribute__ ((__deprecated__)) static inline QString trUtf8(const char *s, const char *c = nullptr, int n = -1) { return staticMetaObject.tr(s, c, n); } private: | - | ||||||||||||||||||
672 | #pragma GCC diagnostic ignored "-Wattributes" | - | ||||||||||||||||||
673 | __attribute__((visibility("hidden"))) static void qt_static_metacall(QObject *, QMetaObject::Call, int, void **); | - | ||||||||||||||||||
674 | #pragma GCC diagnostic pop | - | ||||||||||||||||||
675 | struct QPrivateSignal {}; | - | ||||||||||||||||||
676 | - | |||||||||||||||||||
677 | - | |||||||||||||||||||
678 | public: | - | ||||||||||||||||||
679 | QQmlDMObjectData( | - | ||||||||||||||||||
680 | QQmlDelegateModelItemMetaType *metaType, | - | ||||||||||||||||||
681 | VDMObjectDelegateDataType *dataType, | - | ||||||||||||||||||
682 | int index, | - | ||||||||||||||||||
683 | QObject *object); | - | ||||||||||||||||||
684 | - | |||||||||||||||||||
685 | QObject *modelData() const { return executed 454 times by 3 tests: object;return object; Executed by:
executed 454 times by 3 tests: }return object; Executed by:
| 454 | ||||||||||||||||||
686 | QObject *proxiedObject() override { return executed 472 times by 3 tests: object;return object; Executed by:
executed 472 times by 3 tests: }return object; Executed by:
| 472 | ||||||||||||||||||
687 | - | |||||||||||||||||||
688 | QPointer<QObject> object; | - | ||||||||||||||||||
689 | }; | - | ||||||||||||||||||
690 | - | |||||||||||||||||||
691 | class VDMObjectDelegateDataType : public QQmlRefCount, public QQmlAdaptorModel::Accessors | - | ||||||||||||||||||
692 | { | - | ||||||||||||||||||
693 | public: | - | ||||||||||||||||||
694 | QMetaObject *metaObject; | - | ||||||||||||||||||
695 | int propertyOffset; | - | ||||||||||||||||||
696 | int signalOffset; | - | ||||||||||||||||||
697 | bool shared; | - | ||||||||||||||||||
698 | QMetaObjectBuilder builder; | - | ||||||||||||||||||
699 | - | |||||||||||||||||||
700 | VDMObjectDelegateDataType() | - | ||||||||||||||||||
701 | : metaObject(nullptr) | - | ||||||||||||||||||
702 | , propertyOffset(0) | - | ||||||||||||||||||
703 | , signalOffset(0) | - | ||||||||||||||||||
704 | , shared(true) | - | ||||||||||||||||||
705 | { | - | ||||||||||||||||||
706 | } executed 24 times by 3 tests: end of block Executed by:
| 24 | ||||||||||||||||||
707 | - | |||||||||||||||||||
708 | VDMObjectDelegateDataType(const VDMObjectDelegateDataType &type) | - | ||||||||||||||||||
709 | : QQmlRefCount() | - | ||||||||||||||||||
710 | , QQmlAdaptorModel::Accessors() | - | ||||||||||||||||||
711 | , metaObject(nullptr) | - | ||||||||||||||||||
712 | , propertyOffset(type.propertyOffset) | - | ||||||||||||||||||
713 | , signalOffset(type.signalOffset) | - | ||||||||||||||||||
714 | , shared(false) | - | ||||||||||||||||||
715 | , builder(type.metaObject, QMetaObjectBuilder::Properties | - | ||||||||||||||||||
716 | | QMetaObjectBuilder::Signals | - | ||||||||||||||||||
717 | | QMetaObjectBuilder::SuperClass | - | ||||||||||||||||||
718 | | QMetaObjectBuilder::ClassName) | - | ||||||||||||||||||
719 | { | - | ||||||||||||||||||
720 | builder.setFlags(QMetaObjectBuilder::DynamicMetaObject); | - | ||||||||||||||||||
721 | } executed 66 times by 1 test: end of block Executed by:
| 66 | ||||||||||||||||||
722 | - | |||||||||||||||||||
723 | ~VDMObjectDelegateDataType() | - | ||||||||||||||||||
724 | { | - | ||||||||||||||||||
725 | free(metaObject); | - | ||||||||||||||||||
726 | } executed 90 times by 3 tests: end of block Executed by:
| 90 | ||||||||||||||||||
727 | - | |||||||||||||||||||
728 | int rowCount(const QQmlAdaptorModel &model) const override | - | ||||||||||||||||||
729 | { | - | ||||||||||||||||||
730 | return executed 968 times by 3 tests: model.list.count();return model.list.count(); Executed by:
executed 968 times by 3 tests: return model.list.count(); Executed by:
| 968 | ||||||||||||||||||
731 | } | - | ||||||||||||||||||
732 | - | |||||||||||||||||||
733 | int columnCount(const QQmlAdaptorModel &) const override | - | ||||||||||||||||||
734 | { | - | ||||||||||||||||||
735 | return never executed: 1;return 1; never executed: return 1; | 0 | ||||||||||||||||||
736 | } | - | ||||||||||||||||||
737 | - | |||||||||||||||||||
738 | QVariant value(const QQmlAdaptorModel &model, int index, const QString &role) const override | - | ||||||||||||||||||
739 | { | - | ||||||||||||||||||
740 | if (QObject *object = model.list.at(index).value<QObject *>()
| 0-24 | ||||||||||||||||||
741 | return executed 24 times by 1 test: object->property(role.toUtf8());return object->property(role.toUtf8()); Executed by:
executed 24 times by 1 test: return object->property(role.toUtf8()); Executed by:
| 24 | ||||||||||||||||||
742 | return never executed: QVariant();return QVariant(); never executed: return QVariant(); | 0 | ||||||||||||||||||
743 | } | - | ||||||||||||||||||
744 | - | |||||||||||||||||||
745 | QQmlDelegateModelItem *createItem( | - | ||||||||||||||||||
746 | QQmlAdaptorModel &model, | - | ||||||||||||||||||
747 | QQmlDelegateModelItemMetaType *metaType, | - | ||||||||||||||||||
748 | int index) const override | - | ||||||||||||||||||
749 | { | - | ||||||||||||||||||
750 | VDMObjectDelegateDataType *dataType = const_cast<VDMObjectDelegateDataType *>(this); | - | ||||||||||||||||||
751 | if (!metaObject
| 24-460 | ||||||||||||||||||
752 | dataType->initializeMetaType(model); executed 24 times by 3 tests: dataType->initializeMetaType(model); Executed by:
| 24 | ||||||||||||||||||
753 | return executed 484 times by 3 tests: index >= 0 && index < model.list.count()return index >= 0 && index < model.list.count() ? new QQmlDMObjectData(metaType, dataType, index, qvariant_cast<QObject *>(model.list.at(index))) : nullptr; Executed by:
executed 484 times by 3 tests: return index >= 0 && index < model.list.count() ? new QQmlDMObjectData(metaType, dataType, index, qvariant_cast<QObject *>(model.list.at(index))) : nullptr; Executed by:
| 484 | ||||||||||||||||||
754 | ? new QQmlDMObjectData(metaType, dataType, index, qvariant_cast<QObject *>(model.list.at(index))) executed 484 times by 3 tests: return index >= 0 && index < model.list.count() ? new QQmlDMObjectData(metaType, dataType, index, qvariant_cast<QObject *>(model.list.at(index))) : nullptr; Executed by:
| 484 | ||||||||||||||||||
755 | : nullptr; executed 484 times by 3 tests: return index >= 0 && index < model.list.count() ? new QQmlDMObjectData(metaType, dataType, index, qvariant_cast<QObject *>(model.list.at(index))) : nullptr; Executed by:
| 484 | ||||||||||||||||||
756 | } | - | ||||||||||||||||||
757 | - | |||||||||||||||||||
758 | void initializeMetaType(QQmlAdaptorModel &) | - | ||||||||||||||||||
759 | { | - | ||||||||||||||||||
760 | setModelDataType<QQmlDMObjectData>(&builder, this); | - | ||||||||||||||||||
761 | - | |||||||||||||||||||
762 | metaObject = builder.toMetaObject(); | - | ||||||||||||||||||
763 | } executed 24 times by 3 tests: end of block Executed by:
| 24 | ||||||||||||||||||
764 | - | |||||||||||||||||||
765 | void cleanup(QQmlAdaptorModel &, QQmlDelegateModel *) const override | - | ||||||||||||||||||
766 | { | - | ||||||||||||||||||
767 | const_cast<VDMObjectDelegateDataType *>(this)->release(); | - | ||||||||||||||||||
768 | } executed 24 times by 3 tests: end of block Executed by:
| 24 | ||||||||||||||||||
769 | }; | - | ||||||||||||||||||
770 | - | |||||||||||||||||||
771 | class QQmlDMObjectDataMetaObject : public QAbstractDynamicMetaObject | - | ||||||||||||||||||
772 | { | - | ||||||||||||||||||
773 | public: | - | ||||||||||||||||||
774 | QQmlDMObjectDataMetaObject(QQmlDMObjectData *data, VDMObjectDelegateDataType *type) | - | ||||||||||||||||||
775 | : m_data(data) | - | ||||||||||||||||||
776 | , m_type(type) | - | ||||||||||||||||||
777 | { | - | ||||||||||||||||||
778 | QObjectPrivate *op = QObjectPrivate::get(m_data); | - | ||||||||||||||||||
779 | *static_cast<QMetaObject *>(this) = *type->metaObject; | - | ||||||||||||||||||
780 | op->metaObject = this; | - | ||||||||||||||||||
781 | m_type->addref(); | - | ||||||||||||||||||
782 | } executed 472 times by 3 tests: end of block Executed by:
| 472 | ||||||||||||||||||
783 | - | |||||||||||||||||||
784 | ~QQmlDMObjectDataMetaObject() | - | ||||||||||||||||||
785 | { | - | ||||||||||||||||||
786 | m_type->release(); | - | ||||||||||||||||||
787 | } executed 472 times by 3 tests: end of block Executed by:
| 472 | ||||||||||||||||||
788 | - | |||||||||||||||||||
789 | int metaCall(QObject *o, QMetaObject::Call call, int id, void **arguments) override | - | ||||||||||||||||||
790 | { | - | ||||||||||||||||||
791 | ((o == m_data) ? static_cast<void>(0) : qt_assert("o == m_data", __FILE__, 813)); | - | ||||||||||||||||||
792 | (void)o;; | - | ||||||||||||||||||
793 | - | |||||||||||||||||||
794 | static const int objectPropertyOffset = QObject::staticMetaObject.propertyCount(); | - | ||||||||||||||||||
795 | if (id >= m_type->propertyOffset
| 118-1314 | ||||||||||||||||||
796 | && (call == QMetaObject::ReadProperty
| 2-116 | ||||||||||||||||||
797 | || call == QMetaObject::WriteProperty
| 0-2 | ||||||||||||||||||
798 | || call == QMetaObject::ResetProperty
| 0-2 | ||||||||||||||||||
799 | if (m_data->object
| 0-116 | ||||||||||||||||||
800 | QMetaObject::metacall(m_data->object, call, id - m_type->propertyOffset + objectPropertyOffset, arguments); executed 116 times by 1 test: QMetaObject::metacall(m_data->object, call, id - m_type->propertyOffset + objectPropertyOffset, arguments); Executed by:
| 116 | ||||||||||||||||||
801 | return executed 116 times by 1 test: -1;return -1; Executed by:
executed 116 times by 1 test: return -1; Executed by:
| 116 | ||||||||||||||||||
802 | } else if (id >= m_type->signalOffset
| 0-1314 | ||||||||||||||||||
803 | QMetaObject::activate(m_data, this, id - m_type->signalOffset, nullptr); | - | ||||||||||||||||||
804 | return executed 2 times by 1 test: -1;return -1; Executed by:
executed 2 times by 1 test: return -1; Executed by:
| 2 | ||||||||||||||||||
805 | } else { | - | ||||||||||||||||||
806 | return executed 1314 times by 3 tests: m_data->qt_metacall(call, id, arguments);return m_data->qt_metacall(call, id, arguments); Executed by:
executed 1314 times by 3 tests: return m_data->qt_metacall(call, id, arguments); Executed by:
| 1314 | ||||||||||||||||||
807 | } | - | ||||||||||||||||||
808 | } | - | ||||||||||||||||||
809 | - | |||||||||||||||||||
810 | int createProperty(const char *name, const char *) override | - | ||||||||||||||||||
811 | { | - | ||||||||||||||||||
812 | if (!m_data->object
| 0-466 | ||||||||||||||||||
813 | return never executed: -1;return -1; never executed: return -1; | 0 | ||||||||||||||||||
814 | const QMetaObject *metaObject = m_data->object->metaObject(); | - | ||||||||||||||||||
815 | static const int objectPropertyOffset = QObject::staticMetaObject.propertyCount(); | - | ||||||||||||||||||
816 | - | |||||||||||||||||||
817 | const int previousPropertyCount = propertyCount() - propertyOffset(); | - | ||||||||||||||||||
818 | int propertyIndex = metaObject->indexOfProperty(name); | - | ||||||||||||||||||
819 | if (propertyIndex == -1
| 66-400 | ||||||||||||||||||
820 | return executed 400 times by 1 test: -1;return -1; Executed by:
executed 400 times by 1 test: return -1; Executed by:
| 400 | ||||||||||||||||||
821 | if (previousPropertyCount + objectPropertyOffset == metaObject->propertyCount()
| 0-66 | ||||||||||||||||||
822 | return never executed: propertyIndex + m_type->propertyOffset - objectPropertyOffset;return propertyIndex + m_type->propertyOffset - objectPropertyOffset; never executed: return propertyIndex + m_type->propertyOffset - objectPropertyOffset; | 0 | ||||||||||||||||||
823 | - | |||||||||||||||||||
824 | if (m_type->shared
| 0-66 | ||||||||||||||||||
825 | VDMObjectDelegateDataType *type = m_type; | - | ||||||||||||||||||
826 | m_type = new VDMObjectDelegateDataType(*m_type); | - | ||||||||||||||||||
827 | type->release(); | - | ||||||||||||||||||
828 | } executed 66 times by 1 test: end of block Executed by:
| 66 | ||||||||||||||||||
829 | - | |||||||||||||||||||
830 | const int previousMethodCount = methodCount(); | - | ||||||||||||||||||
831 | int notifierId = previousMethodCount - methodOffset(); | - | ||||||||||||||||||
832 | for (int propertyId = previousPropertyCount; propertyId < metaObject->propertyCount() - objectPropertyOffset
| 66-198 | ||||||||||||||||||
833 | QMetaProperty property = metaObject->property(propertyId + objectPropertyOffset); | - | ||||||||||||||||||
834 | QMetaPropertyBuilder propertyBuilder; | - | ||||||||||||||||||
835 | if (property.hasNotifySignal()
| 66-132 | ||||||||||||||||||
836 | m_type->builder.addSignal("__" + QByteArray::number(propertyId) + "()"); | - | ||||||||||||||||||
837 | propertyBuilder = m_type->builder.addProperty(property.name(), property.typeName(), notifierId); | - | ||||||||||||||||||
838 | ++notifierId; | - | ||||||||||||||||||
839 | } executed 132 times by 1 test: else {end of block Executed by:
| 132 | ||||||||||||||||||
840 | propertyBuilder = m_type->builder.addProperty(property.name(), property.typeName()); | - | ||||||||||||||||||
841 | } executed 66 times by 1 test: end of block Executed by:
| 66 | ||||||||||||||||||
842 | propertyBuilder.setWritable(property.isWritable()); | - | ||||||||||||||||||
843 | propertyBuilder.setResettable(property.isResettable()); | - | ||||||||||||||||||
844 | propertyBuilder.setConstant(property.isConstant()); | - | ||||||||||||||||||
845 | } executed 198 times by 1 test: end of block Executed by:
| 198 | ||||||||||||||||||
846 | - | |||||||||||||||||||
847 | if (m_type->metaObject
| 0-66 | ||||||||||||||||||
848 | free(m_type->metaObject); never executed: free(m_type->metaObject); | 0 | ||||||||||||||||||
849 | m_type->metaObject = m_type->builder.toMetaObject(); | - | ||||||||||||||||||
850 | *static_cast<QMetaObject *>(this) = *m_type->metaObject; | - | ||||||||||||||||||
851 | - | |||||||||||||||||||
852 | notifierId = previousMethodCount; | - | ||||||||||||||||||
853 | for (int i = previousPropertyCount; i < metaObject->propertyCount() - objectPropertyOffset
| 66-198 | ||||||||||||||||||
854 | QMetaProperty property = metaObject->property(i + objectPropertyOffset); | - | ||||||||||||||||||
855 | if (property.hasNotifySignal()
| 66-132 | ||||||||||||||||||
856 | QQmlPropertyPrivate::connect( | - | ||||||||||||||||||
857 | m_data->object, property.notifySignalIndex(), m_data, notifierId); | - | ||||||||||||||||||
858 | ++notifierId; | - | ||||||||||||||||||
859 | } executed 132 times by 1 test: end of block Executed by:
| 132 | ||||||||||||||||||
860 | } executed 198 times by 1 test: end of block Executed by:
| 198 | ||||||||||||||||||
861 | return executed 66 times by 1 test: propertyIndex + m_type->propertyOffset - objectPropertyOffset;return propertyIndex + m_type->propertyOffset - objectPropertyOffset; Executed by:
executed 66 times by 1 test: return propertyIndex + m_type->propertyOffset - objectPropertyOffset; Executed by:
| 66 | ||||||||||||||||||
862 | } | - | ||||||||||||||||||
863 | - | |||||||||||||||||||
864 | QQmlDMObjectData *m_data; | - | ||||||||||||||||||
865 | VDMObjectDelegateDataType *m_type; | - | ||||||||||||||||||
866 | }; | - | ||||||||||||||||||
867 | - | |||||||||||||||||||
868 | QQmlDMObjectData::QQmlDMObjectData( | - | ||||||||||||||||||
869 | QQmlDelegateModelItemMetaType *metaType, | - | ||||||||||||||||||
870 | VDMObjectDelegateDataType *dataType, | - | ||||||||||||||||||
871 | int index, | - | ||||||||||||||||||
872 | QObject *object) | - | ||||||||||||||||||
873 | : QQmlDelegateModelItem(metaType, index) | - | ||||||||||||||||||
874 | , object(object) | - | ||||||||||||||||||
875 | { | - | ||||||||||||||||||
876 | new QQmlDMObjectDataMetaObject(this, dataType); | - | ||||||||||||||||||
877 | } executed 472 times by 3 tests: end of block Executed by:
| 472 | ||||||||||||||||||
878 | - | |||||||||||||||||||
879 | - | |||||||||||||||||||
880 | - | |||||||||||||||||||
881 | - | |||||||||||||||||||
882 | - | |||||||||||||||||||
883 | static const QQmlAdaptorModel::Accessors qt_vdm_null_accessors; | - | ||||||||||||||||||
884 | static const VDMListDelegateDataType qt_vdm_list_accessors; | - | ||||||||||||||||||
885 | - | |||||||||||||||||||
886 | QQmlAdaptorModel::Accessors::~Accessors() | - | ||||||||||||||||||
887 | { | - | ||||||||||||||||||
888 | } | - | ||||||||||||||||||
889 | - | |||||||||||||||||||
890 | QQmlAdaptorModel::QQmlAdaptorModel() | - | ||||||||||||||||||
891 | : accessors(&qt_vdm_null_accessors) | - | ||||||||||||||||||
892 | { | - | ||||||||||||||||||
893 | } executed 5622 times by 27 tests: end of block Executed by:
| 5622 | ||||||||||||||||||
894 | - | |||||||||||||||||||
895 | QQmlAdaptorModel::~QQmlAdaptorModel() | - | ||||||||||||||||||
896 | { | - | ||||||||||||||||||
897 | accessors->cleanup(*this); | - | ||||||||||||||||||
898 | } executed 5556 times by 25 tests: end of block Executed by:
| 5556 | ||||||||||||||||||
899 | - | |||||||||||||||||||
900 | void QQmlAdaptorModel::setModel(const QVariant &variant, QQmlDelegateModel *vdm, QQmlEngine *engine) | - | ||||||||||||||||||
901 | { | - | ||||||||||||||||||
902 | accessors->cleanup(*this, vdm); | - | ||||||||||||||||||
903 | - | |||||||||||||||||||
904 | list.setList(variant, engine); | - | ||||||||||||||||||
905 | - | |||||||||||||||||||
906 | if (QObject *object = qvariant_cast<QObject *>(list.list())
| 1324-4158 | ||||||||||||||||||
907 | setObject(object, vdm); | - | ||||||||||||||||||
908 | if (QAbstractItemModel *model = qobject_cast<QAbstractItemModel *>(object)
| 2-4156 | ||||||||||||||||||
909 | accessors = new VDMAbstractItemModelDataType(this); | - | ||||||||||||||||||
910 | - | |||||||||||||||||||
911 | { QAbstractItemModel *sender = (model); QQmlDelegateModel *receiver = (vdm); const char *signal = (qFlagLocation("2""rowsInserted(QModelIndex,int,int)" "\0" __FILE__ ":" "934")); const char *method = (qFlagLocation("1""_q_rowsInserted(QModelIndex,int,int)" "\0" __FILE__ ":" "934")); static int signalIdx = -1; static int methodIdx = -1; if (signalIdx < 0
| 24-4132 | ||||||||||||||||||
912 | __FILE__ | - | ||||||||||||||||||
913 | , | - | ||||||||||||||||||
914 | 934 | - | ||||||||||||||||||
915 | )); signalIdx = QAbstractItemModel::staticMetaObject.indexOfSignal(signal+1); } executed 24 times by 12 tests: if (methodIdx < 0end of block Executed by:
| 24-4132 | ||||||||||||||||||
916 | __FILE__ | - | ||||||||||||||||||
917 | , | - | ||||||||||||||||||
918 | 934 | - | ||||||||||||||||||
919 | )); if (code == 1
executed 24 times by 12 tests: else methodIdx = QQmlDelegateModel::staticMetaObject.indexOfSignal(method+1);methodIdx = QQmlDelegateModel::staticMetaObject.indexOfSlot(method+1); Executed by:
never executed: } ((signalIdx != -1 && methodIdx != -1) ? static_cast<void>(0) : qt_assert("signalIdx != -1 && methodIdx != -1",methodIdx = QQmlDelegateModel::staticMetaObject.indexOfSignal(method+1); | 0-24 | ||||||||||||||||||
920 | __FILE__ | - | ||||||||||||||||||
921 | , | - | ||||||||||||||||||
922 | 934 | - | ||||||||||||||||||
923 | )); QMetaObject::connect(sender, signalIdx, receiver, methodIdx, Qt::DirectConnection); } | - | ||||||||||||||||||
924 | ; | - | ||||||||||||||||||
925 | { QAbstractItemModel *sender = (model); QQmlDelegateModel *receiver = (vdm); const char *signal = (qFlagLocation("2""rowsRemoved(QModelIndex,int,int)" "\0" __FILE__ ":" "936")); const char *method = (qFlagLocation("1""_q_rowsRemoved(QModelIndex,int,int)" "\0" __FILE__ ":" "936")); static int signalIdx = -1; static int methodIdx = -1; if (signalIdx < 0
| 24-4132 | ||||||||||||||||||
926 | __FILE__ | - | ||||||||||||||||||
927 | , | - | ||||||||||||||||||
928 | 936 | - | ||||||||||||||||||
929 | )); signalIdx = QAbstractItemModel::staticMetaObject.indexOfSignal(signal+1); } executed 24 times by 12 tests: if (methodIdx < 0end of block Executed by:
| 24-4132 | ||||||||||||||||||
930 | __FILE__ | - | ||||||||||||||||||
931 | , | - | ||||||||||||||||||
932 | 936 | - | ||||||||||||||||||
933 | )); if (code == 1
executed 24 times by 12 tests: else methodIdx = QQmlDelegateModel::staticMetaObject.indexOfSignal(method+1);methodIdx = QQmlDelegateModel::staticMetaObject.indexOfSlot(method+1); Executed by:
never executed: } ((signalIdx != -1 && methodIdx != -1) ? static_cast<void>(0) : qt_assert("signalIdx != -1 && methodIdx != -1",methodIdx = QQmlDelegateModel::staticMetaObject.indexOfSignal(method+1); | 0-24 | ||||||||||||||||||
934 | __FILE__ | - | ||||||||||||||||||
935 | , | - | ||||||||||||||||||
936 | 936 | - | ||||||||||||||||||
937 | )); QMetaObject::connect(sender, signalIdx, receiver, methodIdx, Qt::DirectConnection); } | - | ||||||||||||||||||
938 | ; | - | ||||||||||||||||||
939 | { QAbstractItemModel *sender = (model); QQmlDelegateModel *receiver = (vdm); const char *signal = (qFlagLocation("2""rowsAboutToBeRemoved(QModelIndex,int,int)" "\0" __FILE__ ":" "938")); const char *method = (qFlagLocation("1""_q_rowsAboutToBeRemoved(QModelIndex,int,int)" "\0" __FILE__ ":" "938")); static int signalIdx = -1; static int methodIdx = -1; if (signalIdx < 0
| 24-4132 | ||||||||||||||||||
940 | __FILE__ | - | ||||||||||||||||||
941 | , | - | ||||||||||||||||||
942 | 938 | - | ||||||||||||||||||
943 | )); signalIdx = QAbstractItemModel::staticMetaObject.indexOfSignal(signal+1); } executed 24 times by 12 tests: if (methodIdx < 0end of block Executed by:
| 24-4132 | ||||||||||||||||||
944 | __FILE__ | - | ||||||||||||||||||
945 | , | - | ||||||||||||||||||
946 | 938 | - | ||||||||||||||||||
947 | )); if (code == 1
executed 24 times by 12 tests: else methodIdx = QQmlDelegateModel::staticMetaObject.indexOfSignal(method+1);methodIdx = QQmlDelegateModel::staticMetaObject.indexOfSlot(method+1); Executed by:
never executed: } ((signalIdx != -1 && methodIdx != -1) ? static_cast<void>(0) : qt_assert("signalIdx != -1 && methodIdx != -1",methodIdx = QQmlDelegateModel::staticMetaObject.indexOfSignal(method+1); | 0-24 | ||||||||||||||||||
948 | __FILE__ | - | ||||||||||||||||||
949 | , | - | ||||||||||||||||||
950 | 938 | - | ||||||||||||||||||
951 | )); QMetaObject::connect(sender, signalIdx, receiver, methodIdx, Qt::DirectConnection); } | - | ||||||||||||||||||
952 | ; | - | ||||||||||||||||||
953 | { QAbstractItemModel *sender = (model); QQmlDelegateModel *receiver = (vdm); const char *signal = (qFlagLocation("2""dataChanged(QModelIndex,QModelIndex,QVector<int>)" "\0" __FILE__ ":" "940")); const char *method = (qFlagLocation("1""_q_dataChanged(QModelIndex,QModelIndex,QVector<int>)" "\0" __FILE__ ":" "940")); static int signalIdx = -1; static int methodIdx = -1; if (signalIdx < 0
| 24-4132 | ||||||||||||||||||
954 | __FILE__ | - | ||||||||||||||||||
955 | , | - | ||||||||||||||||||
956 | 940 | - | ||||||||||||||||||
957 | )); signalIdx = QAbstractItemModel::staticMetaObject.indexOfSignal(signal+1); } executed 24 times by 12 tests: if (methodIdx < 0end of block Executed by:
| 24-4132 | ||||||||||||||||||
958 | __FILE__ | - | ||||||||||||||||||
959 | , | - | ||||||||||||||||||
960 | 940 | - | ||||||||||||||||||
961 | )); if (code == 1
executed 24 times by 12 tests: else methodIdx = QQmlDelegateModel::staticMetaObject.indexOfSignal(method+1);methodIdx = QQmlDelegateModel::staticMetaObject.indexOfSlot(method+1); Executed by:
never executed: } ((signalIdx != -1 && methodIdx != -1) ? static_cast<void>(0) : qt_assert("signalIdx != -1 && methodIdx != -1",methodIdx = QQmlDelegateModel::staticMetaObject.indexOfSignal(method+1); | 0-24 | ||||||||||||||||||
962 | __FILE__ | - | ||||||||||||||||||
963 | , | - | ||||||||||||||||||
964 | 940 | - | ||||||||||||||||||
965 | )); QMetaObject::connect(sender, signalIdx, receiver, methodIdx, Qt::DirectConnection); } | - | ||||||||||||||||||
966 | ; | - | ||||||||||||||||||
967 | { QAbstractItemModel *sender = (model); QQmlDelegateModel *receiver = (vdm); const char *signal = (qFlagLocation("2""rowsMoved(QModelIndex,int,int,QModelIndex,int)" "\0" __FILE__ ":" "942")); const char *method = (qFlagLocation("1""_q_rowsMoved(QModelIndex,int,int,QModelIndex,int)" "\0" __FILE__ ":" "942")); static int signalIdx = -1; static int methodIdx = -1; if (signalIdx < 0
| 24-4132 | ||||||||||||||||||
968 | __FILE__ | - | ||||||||||||||||||
969 | , | - | ||||||||||||||||||
970 | 942 | - | ||||||||||||||||||
971 | )); signalIdx = QAbstractItemModel::staticMetaObject.indexOfSignal(signal+1); } executed 24 times by 12 tests: if (methodIdx < 0end of block Executed by:
| 24-4132 | ||||||||||||||||||
972 | __FILE__ | - | ||||||||||||||||||
973 | , | - | ||||||||||||||||||
974 | 942 | - | ||||||||||||||||||
975 | )); if (code == 1
executed 24 times by 12 tests: else methodIdx = QQmlDelegateModel::staticMetaObject.indexOfSignal(method+1);methodIdx = QQmlDelegateModel::staticMetaObject.indexOfSlot(method+1); Executed by:
never executed: } ((signalIdx != -1 && methodIdx != -1) ? static_cast<void>(0) : qt_assert("signalIdx != -1 && methodIdx != -1",methodIdx = QQmlDelegateModel::staticMetaObject.indexOfSignal(method+1); | 0-24 | ||||||||||||||||||
976 | __FILE__ | - | ||||||||||||||||||
977 | , | - | ||||||||||||||||||
978 | 942 | - | ||||||||||||||||||
979 | )); QMetaObject::connect(sender, signalIdx, receiver, methodIdx, Qt::DirectConnection); } | - | ||||||||||||||||||
980 | ; | - | ||||||||||||||||||
981 | { QAbstractItemModel *sender = (model); QQmlDelegateModel *receiver = (vdm); const char *signal = (qFlagLocation("2""modelReset()" "\0" __FILE__ ":" "944")); const char *method = (qFlagLocation("1""_q_modelReset()" "\0" __FILE__ ":" "944")); static int signalIdx = -1; static int methodIdx = -1; if (signalIdx < 0
| 24-4132 | ||||||||||||||||||
982 | __FILE__ | - | ||||||||||||||||||
983 | , | - | ||||||||||||||||||
984 | 944 | - | ||||||||||||||||||
985 | )); signalIdx = QAbstractItemModel::staticMetaObject.indexOfSignal(signal+1); } executed 24 times by 12 tests: if (methodIdx < 0end of block Executed by:
| 24-4132 | ||||||||||||||||||
986 | __FILE__ | - | ||||||||||||||||||
987 | , | - | ||||||||||||||||||
988 | 944 | - | ||||||||||||||||||
989 | )); if (code == 1
executed 24 times by 12 tests: else methodIdx = QQmlDelegateModel::staticMetaObject.indexOfSignal(method+1);methodIdx = QQmlDelegateModel::staticMetaObject.indexOfSlot(method+1); Executed by:
never executed: } ((signalIdx != -1 && methodIdx != -1) ? static_cast<void>(0) : qt_assert("signalIdx != -1 && methodIdx != -1",methodIdx = QQmlDelegateModel::staticMetaObject.indexOfSignal(method+1); | 0-24 | ||||||||||||||||||
990 | __FILE__ | - | ||||||||||||||||||
991 | , | - | ||||||||||||||||||
992 | 944 | - | ||||||||||||||||||
993 | )); QMetaObject::connect(sender, signalIdx, receiver, methodIdx, Qt::DirectConnection); } | - | ||||||||||||||||||
994 | ; | - | ||||||||||||||||||
995 | { QAbstractItemModel *sender = (model); QQmlDelegateModel *receiver = (vdm); const char *signal = (qFlagLocation("2""layoutChanged(QList<QPersistentModelIndex>,QAbstractItemModel::LayoutChangeHint)" "\0" __FILE__ ":" "946")); const char *method = (qFlagLocation("1""_q_layoutChanged(QList<QPersistentModelIndex>,QAbstractItemModel::LayoutChangeHint)" "\0" __FILE__ ":" "946")); static int signalIdx = -1; static int methodIdx = -1; if (signalIdx < 0
| 24-4132 | ||||||||||||||||||
996 | __FILE__ | - | ||||||||||||||||||
997 | , | - | ||||||||||||||||||
998 | 946 | - | ||||||||||||||||||
999 | )); signalIdx = QAbstractItemModel::staticMetaObject.indexOfSignal(signal+1); } executed 24 times by 12 tests: if (methodIdx < 0end of block Executed by:
| 24-4132 | ||||||||||||||||||
1000 | __FILE__ | - | ||||||||||||||||||
1001 | , | - | ||||||||||||||||||
1002 | 946 | - | ||||||||||||||||||
1003 | )); if (code == 1
executed 24 times by 12 tests: else methodIdx = QQmlDelegateModel::staticMetaObject.indexOfSignal(method+1);methodIdx = QQmlDelegateModel::staticMetaObject.indexOfSlot(method+1); Executed by:
never executed: } ((signalIdx != -1 && methodIdx != -1) ? static_cast<void>(0) : qt_assert("signalIdx != -1 && methodIdx != -1",methodIdx = QQmlDelegateModel::staticMetaObject.indexOfSignal(method+1); | 0-24 | ||||||||||||||||||
1004 | __FILE__ | - | ||||||||||||||||||
1005 | , | - | ||||||||||||||||||
1006 | 946 | - | ||||||||||||||||||
1007 | )); QMetaObject::connect(sender, signalIdx, receiver, methodIdx, Qt::DirectConnection); } | - | ||||||||||||||||||
1008 | ; | - | ||||||||||||||||||
1009 | } executed 4156 times by 12 tests: else {end of block Executed by:
| 4156 | ||||||||||||||||||
1010 | accessors = new VDMObjectDelegateDataType; | - | ||||||||||||||||||
1011 | } executed 2 times by 1 test: end of block Executed by:
| 2 | ||||||||||||||||||
1012 | } else if (list.type() == QQmlListAccessor::ListProperty
| 22-1302 | ||||||||||||||||||
1013 | setObject(static_cast<const QQmlListReference *>(variant.constData())->object(), vdm); | - | ||||||||||||||||||
1014 | accessors = new VDMObjectDelegateDataType; | - | ||||||||||||||||||
1015 | } executed 22 times by 3 tests: else if (list.type() != QQmlListAccessor::Invalidend of block Executed by:
| 22-754 | ||||||||||||||||||
1016 | && list.type() != QQmlListAccessor::Instance
| 4-750 | ||||||||||||||||||
1017 | setObject(nullptr, vdm); | - | ||||||||||||||||||
1018 | accessors = &qt_vdm_list_accessors; | - | ||||||||||||||||||
1019 | } executed 750 times by 22 tests: else {end of block Executed by:
| 750 | ||||||||||||||||||
1020 | setObject(nullptr, vdm); | - | ||||||||||||||||||
1021 | accessors = &qt_vdm_null_accessors; | - | ||||||||||||||||||
1022 | } executed 552 times by 7 tests: end of block Executed by:
| 552 | ||||||||||||||||||
1023 | } | - | ||||||||||||||||||
1024 | - | |||||||||||||||||||
1025 | void QQmlAdaptorModel::invalidateModel(QQmlDelegateModel *vdm) | - | ||||||||||||||||||
1026 | { | - | ||||||||||||||||||
1027 | accessors->cleanup(*this, vdm); | - | ||||||||||||||||||
1028 | accessors = &qt_vdm_null_accessors; | - | ||||||||||||||||||
1029 | - | |||||||||||||||||||
1030 | - | |||||||||||||||||||
1031 | } executed 2 times by 1 test: end of block Executed by:
| 2 | ||||||||||||||||||
1032 | - | |||||||||||||||||||
1033 | bool QQmlAdaptorModel::isValid() const | - | ||||||||||||||||||
1034 | { | - | ||||||||||||||||||
1035 | return executed 132 times by 4 tests: accessors != &qt_vdm_null_accessors;return accessors != &qt_vdm_null_accessors; Executed by:
executed 132 times by 4 tests: return accessors != &qt_vdm_null_accessors; Executed by:
| 132 | ||||||||||||||||||
1036 | } | - | ||||||||||||||||||
1037 | - | |||||||||||||||||||
1038 | int QQmlAdaptorModel::count() const | - | ||||||||||||||||||
1039 | { | - | ||||||||||||||||||
1040 | return never executed: rowCount() * columnCount();return rowCount() * columnCount(); never executed: return rowCount() * columnCount(); | 0 | ||||||||||||||||||
1041 | } | - | ||||||||||||||||||
1042 | - | |||||||||||||||||||
1043 | int QQmlAdaptorModel::rowCount() const | - | ||||||||||||||||||
1044 | { | - | ||||||||||||||||||
1045 | return executed 282606 times by 27 tests: qMax(0, accessors->rowCount(*this));return qMax(0, accessors->rowCount(*this)); Executed by:
executed 282606 times by 27 tests: return qMax(0, accessors->rowCount(*this)); Executed by:
| 282606 | ||||||||||||||||||
1046 | } | - | ||||||||||||||||||
1047 | - | |||||||||||||||||||
1048 | int QQmlAdaptorModel::columnCount() const | - | ||||||||||||||||||
1049 | { | - | ||||||||||||||||||
1050 | return executed 102 times by 1 test: qMax(isValid() ? 1 : 0, accessors->columnCount(*this));return qMax(isValid() ? 1 : 0, accessors->columnCount(*this)); Executed by:
executed 102 times by 1 test: return qMax(isValid() ? 1 : 0, accessors->columnCount(*this)); Executed by:
| 102 | ||||||||||||||||||
1051 | } | - | ||||||||||||||||||
1052 | - | |||||||||||||||||||
1053 | int QQmlAdaptorModel::rowAt(int index) const | - | ||||||||||||||||||
1054 | { | - | ||||||||||||||||||
1055 | int count = rowCount(); | - | ||||||||||||||||||
1056 | return executed 137920 times by 25 tests: count <= 0 ? -1 : index % count;return count <= 0 ? -1 : index % count; Executed by:
executed 137920 times by 25 tests: return count <= 0 ? -1 : index % count; Executed by:
| 137920 | ||||||||||||||||||
1057 | } | - | ||||||||||||||||||
1058 | - | |||||||||||||||||||
1059 | int QQmlAdaptorModel::columnAt(int index) const | - | ||||||||||||||||||
1060 | { | - | ||||||||||||||||||
1061 | int count = rowCount(); | - | ||||||||||||||||||
1062 | return executed 137920 times by 25 tests: count <= 0 ? -1 : index / count;return count <= 0 ? -1 : index / count; Executed by:
executed 137920 times by 25 tests: return count <= 0 ? -1 : index / count; Executed by:
| 137920 | ||||||||||||||||||
1063 | } | - | ||||||||||||||||||
1064 | - | |||||||||||||||||||
1065 | int QQmlAdaptorModel::indexAt(int row, int column) const | - | ||||||||||||||||||
1066 | { | - | ||||||||||||||||||
1067 | return executed 316 times by 5 tests: row + (column * rowCount());return row + (column * rowCount()); Executed by:
executed 316 times by 5 tests: return row + (column * rowCount()); Executed by:
| 316 | ||||||||||||||||||
1068 | } | - | ||||||||||||||||||
1069 | - | |||||||||||||||||||
1070 | void QQmlAdaptorModel::objectDestroyed(QObject *) | - | ||||||||||||||||||
1071 | { | - | ||||||||||||||||||
1072 | setModel(QVariant(), nullptr, nullptr); | - | ||||||||||||||||||
1073 | } executed 516 times by 6 tests: end of block Executed by:
| 516 | ||||||||||||||||||
1074 | - | |||||||||||||||||||
1075 | QQmlAdaptorModelEngineData::QQmlAdaptorModelEngineData(QV4::ExecutionEngine *v4) | - | ||||||||||||||||||
1076 | : v4(v4) | - | ||||||||||||||||||
1077 | { | - | ||||||||||||||||||
1078 | QV4::Scope scope(v4); | - | ||||||||||||||||||
1079 | QV4::ScopedObject proto(scope, v4->newObject()); | - | ||||||||||||||||||
1080 | proto->defineAccessorProperty(([]() noexcept -> QString { enum { Size = sizeof(u"" "index")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "index" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return executed 8 times by 2 tests: qstring_literal_temp;return qstring_literal_temp; Executed by:
executed 8 times by 2 tests: }()), get_index, nullptr);return qstring_literal_temp; Executed by:
| 8 | ||||||||||||||||||
1081 | proto->defineAccessorProperty(([]() noexcept -> QString { enum { Size = sizeof(u"" "modelData")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "modelData" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return executed 8 times by 2 tests: qstring_literal_temp;return qstring_literal_temp; Executed by:
executed 8 times by 2 tests: }()),return qstring_literal_temp; Executed by:
| 8 | ||||||||||||||||||
1082 | QQmlDMListAccessorData::get_modelData, QQmlDMListAccessorData::set_modelData); | - | ||||||||||||||||||
1083 | listItemProto.set(v4, proto); | - | ||||||||||||||||||
1084 | } executed 8 times by 2 tests: end of block Executed by:
| 8 | ||||||||||||||||||
1085 | - | |||||||||||||||||||
1086 | QQmlAdaptorModelEngineData::~QQmlAdaptorModelEngineData() | - | ||||||||||||||||||
1087 | { | - | ||||||||||||||||||
1088 | } | - | ||||||||||||||||||
1089 | - | |||||||||||||||||||
1090 | - | |||||||||||||||||||
1091 | - | |||||||||||||||||||
Switch to Source code | Preprocessed file |