| Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/qtdeclarative/src/qtdeclarative/src/qml/qml/qqmlopenmetaobject.cpp |
| Switch to Source code | Preprocessed file |
| Line | Source | Count | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | - | |||||||||||||
| 2 | - | |||||||||||||
| 3 | - | |||||||||||||
| 4 | - | |||||||||||||
| 5 | class QQmlOpenMetaObjectTypePrivate | - | ||||||||||||
| 6 | { | - | ||||||||||||
| 7 | public: | - | ||||||||||||
| 8 | QQmlOpenMetaObjectTypePrivate() : mem(nullptr), cache(nullptr), engine(nullptr) {} executed 5054 times by 19 tests: end of blockExecuted by:
| 5054 | ||||||||||||
| 9 | - | |||||||||||||
| 10 | void init(const QMetaObject *metaObj); | - | ||||||||||||
| 11 | - | |||||||||||||
| 12 | int propertyOffset; | - | ||||||||||||
| 13 | int signalOffset; | - | ||||||||||||
| 14 | QHash<QByteArray, int> names; | - | ||||||||||||
| 15 | QMetaObjectBuilder mob; | - | ||||||||||||
| 16 | QMetaObject *mem; | - | ||||||||||||
| 17 | QQmlPropertyCache *cache; | - | ||||||||||||
| 18 | QQmlEngine *engine; | - | ||||||||||||
| 19 | QSet<QQmlOpenMetaObject*> referers; | - | ||||||||||||
| 20 | }; | - | ||||||||||||
| 21 | - | |||||||||||||
| 22 | QQmlOpenMetaObjectType::QQmlOpenMetaObjectType(const QMetaObject *base, QQmlEngine *engine) | - | ||||||||||||
| 23 | : QQmlCleanup(engine), d(new QQmlOpenMetaObjectTypePrivate) | - | ||||||||||||
| 24 | { | - | ||||||||||||
| 25 | d->engine = engine; | - | ||||||||||||
| 26 | d->init(base); | - | ||||||||||||
| 27 | } executed 5054 times by 19 tests: end of blockExecuted by:
| 5054 | ||||||||||||
| 28 | - | |||||||||||||
| 29 | QQmlOpenMetaObjectType::~QQmlOpenMetaObjectType() | - | ||||||||||||
| 30 | { | - | ||||||||||||
| 31 | if (d->mem
| 0-5048 | ||||||||||||
| 32 | free(d->mem); executed 5048 times by 17 tests: free(d->mem);Executed by:
| 5048 | ||||||||||||
| 33 | if (d->cache
| 166-4882 | ||||||||||||
| 34 | d->cache->release(); executed 166 times by 3 tests: d->cache->release();Executed by:
| 166 | ||||||||||||
| 35 | delete d; | - | ||||||||||||
| 36 | } executed 5048 times by 17 tests: end of blockExecuted by:
| 5048 | ||||||||||||
| 37 | - | |||||||||||||
| 38 | void QQmlOpenMetaObjectType::clear() | - | ||||||||||||
| 39 | { | - | ||||||||||||
| 40 | d->engine = nullptr; | - | ||||||||||||
| 41 | } executed 81 times by 3 tests: end of blockExecuted by:
| 81 | ||||||||||||
| 42 | - | |||||||||||||
| 43 | int QQmlOpenMetaObjectType::propertyOffset() const | - | ||||||||||||
| 44 | { | - | ||||||||||||
| 45 | return executed 22 times by 1 test: d->propertyOffset;return d->propertyOffset;Executed by:
executed 22 times by 1 test: return d->propertyOffset;Executed by:
| 22 | ||||||||||||
| 46 | } | - | ||||||||||||
| 47 | - | |||||||||||||
| 48 | int QQmlOpenMetaObjectType::signalOffset() const | - | ||||||||||||
| 49 | { | - | ||||||||||||
| 50 | return executed 4 times by 1 test: d->signalOffset;return d->signalOffset;Executed by:
executed 4 times by 1 test: return d->signalOffset;Executed by:
| 4 | ||||||||||||
| 51 | } | - | ||||||||||||
| 52 | - | |||||||||||||
| 53 | int QQmlOpenMetaObjectType::propertyCount() const | - | ||||||||||||
| 54 | { | - | ||||||||||||
| 55 | return never executed: d->names.count();return d->names.count();never executed: return d->names.count(); | 0 | ||||||||||||
| 56 | } | - | ||||||||||||
| 57 | - | |||||||||||||
| 58 | QByteArray QQmlOpenMetaObjectType::propertyName(int idx) const | - | ||||||||||||
| 59 | { | - | ||||||||||||
| 60 | ((idx >= 0 && idx < d->names.count()) ? static_cast<void>(0) : qt_assert("idx >= 0 && idx < d->names.count()", __FILE__, 106)); | - | ||||||||||||
| 61 | - | |||||||||||||
| 62 | return never executed: d->mob.property(idx).name();return d->mob.property(idx).name();never executed: return d->mob.property(idx).name(); | 0 | ||||||||||||
| 63 | } | - | ||||||||||||
| 64 | - | |||||||||||||
| 65 | QMetaObject *QQmlOpenMetaObjectType::metaObject() const | - | ||||||||||||
| 66 | { | - | ||||||||||||
| 67 | return d->mem; | - | ||||||||||||
| 68 | } | - | ||||||||||||
| 69 | - | |||||||||||||
| 70 | void QQmlOpenMetaObjectType::createProperties(const QVector<QByteArray> &names) | - | ||||||||||||
| 71 | { | - | ||||||||||||
| 72 | for (int i = 0; i < names.count()
| 36-104 | ||||||||||||
| 73 | const QByteArray &name = names.at(i); | - | ||||||||||||
| 74 | const int id = d->mob.propertyCount(); | - | ||||||||||||
| 75 | d->mob.addSignal("__" + QByteArray::number(id) + "()"); | - | ||||||||||||
| 76 | QMetaPropertyBuilder build = d->mob.addProperty(name, "QVariant", id); | - | ||||||||||||
| 77 | propertyCreated(id, build); | - | ||||||||||||
| 78 | d->names.insert(name, id); | - | ||||||||||||
| 79 | } executed 104 times by 1 test: end of blockExecuted by:
| 104 | ||||||||||||
| 80 | free(d->mem); | - | ||||||||||||
| 81 | d->mem = d->mob.toMetaObject(); | - | ||||||||||||
| 82 | QSet<QQmlOpenMetaObject*>::iterator it = d->referers.begin(); | - | ||||||||||||
| 83 | while (it != d->referers.end()
| 36 | ||||||||||||
| 84 | QQmlOpenMetaObject *omo = *it; | - | ||||||||||||
| 85 | *static_cast<QMetaObject *>(omo) = *d->mem; | - | ||||||||||||
| 86 | if (d->cache
| 0-36 | ||||||||||||
| 87 | d->cache->update(omo); never executed: d->cache->update(omo); | 0 | ||||||||||||
| 88 | ++it; | - | ||||||||||||
| 89 | } executed 36 times by 1 test: end of blockExecuted by:
| 36 | ||||||||||||
| 90 | } executed 36 times by 1 test: end of blockExecuted by:
| 36 | ||||||||||||
| 91 | - | |||||||||||||
| 92 | int QQmlOpenMetaObjectType::createProperty(const QByteArray &name) | - | ||||||||||||
| 93 | { | - | ||||||||||||
| 94 | int id = d->mob.propertyCount(); | - | ||||||||||||
| 95 | d->mob.addSignal("__" + QByteArray::number(id) + "()"); | - | ||||||||||||
| 96 | QMetaPropertyBuilder build = d->mob.addProperty(name, "QVariant", id); | - | ||||||||||||
| 97 | propertyCreated(id, build); | - | ||||||||||||
| 98 | free(d->mem); | - | ||||||||||||
| 99 | d->mem = d->mob.toMetaObject(); | - | ||||||||||||
| 100 | d->names.insert(name, id); | - | ||||||||||||
| 101 | QSet<QQmlOpenMetaObject*>::iterator it = d->referers.begin(); | - | ||||||||||||
| 102 | while (it != d->referers.end()
| 3554-3724 | ||||||||||||
| 103 | QQmlOpenMetaObject *omo = *it; | - | ||||||||||||
| 104 | *static_cast<QMetaObject *>(omo) = *d->mem; | - | ||||||||||||
| 105 | if (d->cache
| 10-3544 | ||||||||||||
| 106 | d->cache->update(omo); executed 10 times by 2 tests: d->cache->update(omo);Executed by:
| 10 | ||||||||||||
| 107 | ++it; | - | ||||||||||||
| 108 | } executed 3554 times by 10 tests: end of blockExecuted by:
| 3554 | ||||||||||||
| 109 | - | |||||||||||||
| 110 | return executed 3724 times by 11 tests: d->propertyOffset + id;return d->propertyOffset + id;Executed by:
executed 3724 times by 11 tests: return d->propertyOffset + id;Executed by:
| 3724 | ||||||||||||
| 111 | } | - | ||||||||||||
| 112 | - | |||||||||||||
| 113 | void QQmlOpenMetaObjectType::propertyCreated(int id, QMetaPropertyBuilder &builder) | - | ||||||||||||
| 114 | { | - | ||||||||||||
| 115 | if (d->referers.count()
| 176-3652 | ||||||||||||
| 116 | (* executed 3652 times by 10 tests: d->referers.begin())->propertyCreated(id, builder);(*d->referers.begin())->propertyCreated(id, builder);Executed by:
executed 3652 times by 10 tests: (*d->referers.begin())->propertyCreated(id, builder);Executed by:
| 3652 | ||||||||||||
| 117 | } executed 3828 times by 11 tests: end of blockExecuted by:
| 3828 | ||||||||||||
| 118 | - | |||||||||||||
| 119 | void QQmlOpenMetaObjectTypePrivate::init(const QMetaObject *metaObj) | - | ||||||||||||
| 120 | { | - | ||||||||||||
| 121 | if (!mem
| 0-5054 | ||||||||||||
| 122 | mob.setSuperClass(metaObj); | - | ||||||||||||
| 123 | mob.setClassName(metaObj->className()); | - | ||||||||||||
| 124 | mob.setFlags(QMetaObjectBuilder::DynamicMetaObject); | - | ||||||||||||
| 125 | - | |||||||||||||
| 126 | mem = mob.toMetaObject(); | - | ||||||||||||
| 127 | - | |||||||||||||
| 128 | propertyOffset = mem->propertyOffset(); | - | ||||||||||||
| 129 | signalOffset = mem->methodOffset(); | - | ||||||||||||
| 130 | } executed 5054 times by 19 tests: end of blockExecuted by:
| 5054 | ||||||||||||
| 131 | } executed 5054 times by 19 tests: end of blockExecuted by:
| 5054 | ||||||||||||
| 132 | - | |||||||||||||
| 133 | - | |||||||||||||
| 134 | - | |||||||||||||
| 135 | class QQmlOpenMetaObjectPrivate | - | ||||||||||||
| 136 | { | - | ||||||||||||
| 137 | public: | - | ||||||||||||
| 138 | QQmlOpenMetaObjectPrivate(QQmlOpenMetaObject *_q, bool _autoCreate, QObject *obj) | - | ||||||||||||
| 139 | : q(_q), object(obj), autoCreate(_autoCreate) {} executed 6658 times by 18 tests: end of blockExecuted by:
| 6658 | ||||||||||||
| 140 | - | |||||||||||||
| 141 | struct Property { | - | ||||||||||||
| 142 | private: | - | ||||||||||||
| 143 | QVariant m_value; | - | ||||||||||||
| 144 | QPointer<QObject> qobjectTracker; | - | ||||||||||||
| 145 | public: | - | ||||||||||||
| 146 | bool valueSet = false; | - | ||||||||||||
| 147 | - | |||||||||||||
| 148 | QVariant value() const { | - | ||||||||||||
| 149 | if (QMetaType::typeFlags(m_value.userType()) & QMetaType::PointerToQObject | - | ||||||||||||
| 150 | && qobjectTracker.isNull()
| 50-906 | ||||||||||||
| 151 | return executed 50 times by 2 tests: QVariant::fromValue<QObject*>(nullptr);return QVariant::fromValue<QObject*>(nullptr);Executed by:
executed 50 times by 2 tests: return QVariant::fromValue<QObject*>(nullptr);Executed by:
| 50 | ||||||||||||
| 152 | return executed 15904 times by 9 tests: m_value;return m_value;Executed by:
executed 15904 times by 9 tests: return m_value;Executed by:
| 15904 | ||||||||||||
| 153 | } | - | ||||||||||||
| 154 | QVariant &valueRef() { return executed 6 times by 1 test: m_value;return m_value;Executed by:
executed 6 times by 1 test: }return m_value;Executed by:
| 6 | ||||||||||||
| 155 | void setValue(const QVariant &v) { | - | ||||||||||||
| 156 | m_value = v; | - | ||||||||||||
| 157 | valueSet = true; | - | ||||||||||||
| 158 | if (QMetaType::typeFlags(v.userType()) & QMetaType::PointerToQObject
| 648-11452 | ||||||||||||
| 159 | qobjectTracker = m_value.value<QObject*>(); executed 648 times by 8 tests: qobjectTracker = m_value.value<QObject*>();Executed by:
| 648 | ||||||||||||
| 160 | } executed 12100 times by 9 tests: end of blockExecuted by:
| 12100 | ||||||||||||
| 161 | }; | - | ||||||||||||
| 162 | - | |||||||||||||
| 163 | inline void setPropertyValue(int idx, const QVariant &value) { | - | ||||||||||||
| 164 | if (data.count() <= idx
| 18-6718 | ||||||||||||
| 165 | data.resize(idx + 1); executed 18 times by 2 tests: data.resize(idx + 1);Executed by:
| 18 | ||||||||||||
| 166 | data[idx].setValue(value); | - | ||||||||||||
| 167 | } executed 6736 times by 5 tests: end of blockExecuted by:
| 6736 | ||||||||||||
| 168 | - | |||||||||||||
| 169 | inline Property &propertyRef(int idx) { | - | ||||||||||||
| 170 | if (data.count() <= idx
| 5364-10542 | ||||||||||||
| 171 | data.resize(idx + 1); executed 5364 times by 9 tests: data.resize(idx + 1);Executed by:
| 5364 | ||||||||||||
| 172 | Property &prop = data[idx]; | - | ||||||||||||
| 173 | if (!prop.valueSet
| 5364-10542 | ||||||||||||
| 174 | prop.setValue(q->initialValue(idx)); executed 5364 times by 9 tests: prop.setValue(q->initialValue(idx));Executed by:
| 5364 | ||||||||||||
| 175 | return executed 15906 times by 9 tests: prop;return prop;Executed by:
executed 15906 times by 9 tests: return prop;Executed by:
| 15906 | ||||||||||||
| 176 | } | - | ||||||||||||
| 177 | - | |||||||||||||
| 178 | inline QVariant propertyValue(int idx) { | - | ||||||||||||
| 179 | auto &prop = propertyRef(idx); | - | ||||||||||||
| 180 | return executed 15900 times by 9 tests: prop.value();return prop.value();Executed by:
executed 15900 times by 9 tests: return prop.value();Executed by:
| 15900 | ||||||||||||
| 181 | } | - | ||||||||||||
| 182 | - | |||||||||||||
| 183 | inline QVariant &propertyValueRef(int idx) { | - | ||||||||||||
| 184 | auto &prop = propertyRef(idx); | - | ||||||||||||
| 185 | return executed 6 times by 1 test: prop.valueRef();return prop.valueRef();Executed by:
executed 6 times by 1 test: return prop.valueRef();Executed by:
| 6 | ||||||||||||
| 186 | } | - | ||||||||||||
| 187 | - | |||||||||||||
| 188 | inline bool hasProperty(int idx) const { | - | ||||||||||||
| 189 | if (idx >= data.count()
| 0 | ||||||||||||
| 190 | return never executed: false;return false;never executed: return false; | 0 | ||||||||||||
| 191 | return never executed: data[idx].valueSet;return data[idx].valueSet;never executed: return data[idx].valueSet; | 0 | ||||||||||||
| 192 | } | - | ||||||||||||
| 193 | - | |||||||||||||
| 194 | QQmlOpenMetaObject *q; | - | ||||||||||||
| 195 | QAbstractDynamicMetaObject *parent = nullptr; | - | ||||||||||||
| 196 | QVector<Property> data; | - | ||||||||||||
| 197 | QObject *object; | - | ||||||||||||
| 198 | QQmlRefPointer<QQmlOpenMetaObjectType> type; | - | ||||||||||||
| 199 | bool autoCreate; | - | ||||||||||||
| 200 | bool cacheProperties = false; | - | ||||||||||||
| 201 | }; | - | ||||||||||||
| 202 | - | |||||||||||||
| 203 | QQmlOpenMetaObject::QQmlOpenMetaObject(QObject *obj, const QMetaObject *base, bool automatic) | - | ||||||||||||
| 204 | : d(new QQmlOpenMetaObjectPrivate(this, automatic, obj)) | - | ||||||||||||
| 205 | { | - | ||||||||||||
| 206 | d->type.adopt(new QQmlOpenMetaObjectType(base ? base : obj->metaObject(), nullptr)); | - | ||||||||||||
| 207 | d->type->d->referers.insert(this); | - | ||||||||||||
| 208 | - | |||||||||||||
| 209 | QObjectPrivate *op = QObjectPrivate::get(obj); | - | ||||||||||||
| 210 | d->parent = static_cast<QAbstractDynamicMetaObject *>(op->metaObject); | - | ||||||||||||
| 211 | *static_cast<QMetaObject *>(this) = *d->type->d->mem; | - | ||||||||||||
| 212 | op->metaObject = this; | - | ||||||||||||
| 213 | } executed 4768 times by 17 tests: end of blockExecuted by:
| 4768 | ||||||||||||
| 214 | - | |||||||||||||
| 215 | QQmlOpenMetaObject::QQmlOpenMetaObject(QObject *obj, QQmlOpenMetaObjectType *type, bool automatic) | - | ||||||||||||
| 216 | : d(new QQmlOpenMetaObjectPrivate(this, automatic, obj)) | - | ||||||||||||
| 217 | { | - | ||||||||||||
| 218 | d->type = type; | - | ||||||||||||
| 219 | d->type->d->referers.insert(this); | - | ||||||||||||
| 220 | - | |||||||||||||
| 221 | QObjectPrivate *op = QObjectPrivate::get(obj); | - | ||||||||||||
| 222 | d->parent = static_cast<QAbstractDynamicMetaObject *>(op->metaObject); | - | ||||||||||||
| 223 | *static_cast<QMetaObject *>(this) = *d->type->d->mem; | - | ||||||||||||
| 224 | op->metaObject = this; | - | ||||||||||||
| 225 | } executed 1890 times by 4 tests: end of blockExecuted by:
| 1890 | ||||||||||||
| 226 | - | |||||||||||||
| 227 | QQmlOpenMetaObject::~QQmlOpenMetaObject() | - | ||||||||||||
| 228 | { | - | ||||||||||||
| 229 | if (d->parent
| 0-6658 | ||||||||||||
| 230 | delete d->parent; never executed: delete d->parent; | 0 | ||||||||||||
| 231 | d->type->d->referers.remove(this); | - | ||||||||||||
| 232 | delete d; | - | ||||||||||||
| 233 | } executed 6658 times by 18 tests: end of blockExecuted by:
| 6658 | ||||||||||||
| 234 | - | |||||||||||||
| 235 | QQmlOpenMetaObjectType *QQmlOpenMetaObject::type() const | - | ||||||||||||
| 236 | { | - | ||||||||||||
| 237 | return executed 36 times by 1 test: d->type.data();return d->type.data();Executed by:
executed 36 times by 1 test: return d->type.data();Executed by:
| 36 | ||||||||||||
| 238 | } | - | ||||||||||||
| 239 | - | |||||||||||||
| 240 | void QQmlOpenMetaObject::emitPropertyNotification(const QByteArray &propertyName) | - | ||||||||||||
| 241 | { | - | ||||||||||||
| 242 | QHash<QByteArray, int>::ConstIterator iter = d->type->d->names.constFind(propertyName); | - | ||||||||||||
| 243 | if (iter == d->type->d->names.constEnd()
| 0-4 | ||||||||||||
| 244 | return; never executed: return; | 0 | ||||||||||||
| 245 | activate(d->object, *iter + d->type->d->signalOffset, nullptr); | - | ||||||||||||
| 246 | } executed 4 times by 1 test: end of blockExecuted by:
| 4 | ||||||||||||
| 247 | - | |||||||||||||
| 248 | int QQmlOpenMetaObject::metaCall(QObject *o, QMetaObject::Call c, int id, void **a) | - | ||||||||||||
| 249 | { | - | ||||||||||||
| 250 | ((d->object == o) ? static_cast<void>(0) : qt_assert("d->object == o", __FILE__, 296)); | - | ||||||||||||
| 251 | - | |||||||||||||
| 252 | if (( c == QMetaObject::ReadProperty
| 4-5448 | ||||||||||||
| 253 | && id >= d->type->d->propertyOffset
| 1482-4038 | ||||||||||||
| 254 | int propId = id - d->type->d->propertyOffset; | - | ||||||||||||
| 255 | if (c == QMetaObject::ReadProperty
| 72-1410 | ||||||||||||
| 256 | propertyRead(propId); | - | ||||||||||||
| 257 | *reinterpret_cast<QVariant *>(a[0]) = d->propertyValue(propId); | - | ||||||||||||
| 258 | } executed 1410 times by 9 tests: else if (c == QMetaObject::WritePropertyend of blockExecuted by:
| 0-1410 | ||||||||||||
| 259 | if (propId >= d->data.count()
| 4-54 | ||||||||||||
| 260 | propertyWrite(propId); | - | ||||||||||||
| 261 | d->setPropertyValue(propId, propertyWriteValue(propId, *reinterpret_cast<QVariant *>(a[0]))); | - | ||||||||||||
| 262 | propertyWritten(propId); | - | ||||||||||||
| 263 | activate(o, d->type->d->signalOffset + propId, nullptr); | - | ||||||||||||
| 264 | } executed 68 times by 3 tests: end of blockExecuted by:
| 68 | ||||||||||||
| 265 | } executed 72 times by 3 tests: end of blockExecuted by:
| 72 | ||||||||||||
| 266 | return executed 1482 times by 9 tests: -1;return -1;Executed by:
executed 1482 times by 9 tests: return -1;Executed by:
| 1482 | ||||||||||||
| 267 | } else { | - | ||||||||||||
| 268 | if (d->parent
| 0-4042 | ||||||||||||
| 269 | return never executed: d->parent->metaCall(o, c, id, a);return d->parent->metaCall(o, c, id, a);never executed: return d->parent->metaCall(o, c, id, a); | 0 | ||||||||||||
| 270 | else | - | ||||||||||||
| 271 | return executed 4042 times by 4 tests: o->qt_metacall(c, id, a);return o->qt_metacall(c, id, a);Executed by:
executed 4042 times by 4 tests: return o->qt_metacall(c, id, a);Executed by:
| 4042 | ||||||||||||
| 272 | } | - | ||||||||||||
| 273 | } | - | ||||||||||||
| 274 | - | |||||||||||||
| 275 | QAbstractDynamicMetaObject *QQmlOpenMetaObject::parent() const | - | ||||||||||||
| 276 | { | - | ||||||||||||
| 277 | return never executed: d->parent;return d->parent;never executed: return d->parent; | 0 | ||||||||||||
| 278 | } | - | ||||||||||||
| 279 | - | |||||||||||||
| 280 | QVariant QQmlOpenMetaObject::value(int id) const | - | ||||||||||||
| 281 | { | - | ||||||||||||
| 282 | return executed 5454 times by 3 tests: d->propertyValue(id);return d->propertyValue(id);Executed by:
executed 5454 times by 3 tests: return d->propertyValue(id);Executed by:
| 5454 | ||||||||||||
| 283 | } | - | ||||||||||||
| 284 | - | |||||||||||||
| 285 | void QQmlOpenMetaObject::setValue(int id, const QVariant &value) | - | ||||||||||||
| 286 | { | - | ||||||||||||
| 287 | d->setPropertyValue(id, propertyWriteValue(id, value)); | - | ||||||||||||
| 288 | activate(d->object, id + d->type->d->signalOffset, nullptr); | - | ||||||||||||
| 289 | } executed 12 times by 2 tests: end of blockExecuted by:
| 12 | ||||||||||||
| 290 | - | |||||||||||||
| 291 | QVariant QQmlOpenMetaObject::value(const QByteArray &name) const | - | ||||||||||||
| 292 | { | - | ||||||||||||
| 293 | QHash<QByteArray, int>::ConstIterator iter = d->type->d->names.constFind(name); | - | ||||||||||||
| 294 | if (iter == d->type->d->names.cend()
| 268-2162 | ||||||||||||
| 295 | return executed 2162 times by 3 tests: QVariant();return QVariant();Executed by:
executed 2162 times by 3 tests: return QVariant();Executed by:
| 2162 | ||||||||||||
| 296 | - | |||||||||||||
| 297 | return executed 268 times by 3 tests: d->propertyValue(*iter);return d->propertyValue(*iter);Executed by:
executed 268 times by 3 tests: return d->propertyValue(*iter);Executed by:
| 268 | ||||||||||||
| 298 | } | - | ||||||||||||
| 299 | - | |||||||||||||
| 300 | QVariant &QQmlOpenMetaObject::valueRef(const QByteArray &name) | - | ||||||||||||
| 301 | { | - | ||||||||||||
| 302 | QHash<QByteArray, int>::ConstIterator iter = d->type->d->names.constFind(name); | - | ||||||||||||
| 303 | ((iter != d->type->d->names.cend()) ? static_cast<void>(0) : qt_assert("iter != d->type->d->names.cend()", __FILE__, 349)); | - | ||||||||||||
| 304 | - | |||||||||||||
| 305 | return executed 6 times by 1 test: d->propertyValueRef(*iter);return d->propertyValueRef(*iter);Executed by:
executed 6 times by 1 test: return d->propertyValueRef(*iter);Executed by:
| 6 | ||||||||||||
| 306 | } | - | ||||||||||||
| 307 | - | |||||||||||||
| 308 | bool QQmlOpenMetaObject::setValue(const QByteArray &name, const QVariant &val, bool force) | - | ||||||||||||
| 309 | { | - | ||||||||||||
| 310 | QHash<QByteArray, int>::ConstIterator iter = d->type->d->names.constFind(name); | - | ||||||||||||
| 311 | - | |||||||||||||
| 312 | int id = -1; | - | ||||||||||||
| 313 | if (iter == d->type->d->names.cend()
| 3138-5654 | ||||||||||||
| 314 | id = createProperty(name.constData(), "") - d->type->d->propertyOffset; | - | ||||||||||||
| 315 | } executed 3138 times by 4 tests: else {end of blockExecuted by:
| 3138 | ||||||||||||
| 316 | id = *iter; | - | ||||||||||||
| 317 | } executed 5654 times by 5 tests: end of blockExecuted by:
| 5654 | ||||||||||||
| 318 | - | |||||||||||||
| 319 | if (id >= 0
| 0-8792 | ||||||||||||
| 320 | if (!force
| 24-8768 | ||||||||||||
| 321 | return executed 2136 times by 5 tests: false;return false;Executed by:
executed 2136 times by 5 tests: return false;Executed by:
| 2136 | ||||||||||||
| 322 | - | |||||||||||||
| 323 | d->setPropertyValue(id, val); | - | ||||||||||||
| 324 | activate(d->object, id + d->type->d->signalOffset, nullptr); | - | ||||||||||||
| 325 | return executed 6656 times by 5 tests: true;return true;Executed by:
executed 6656 times by 5 tests: return true;Executed by:
| 6656 | ||||||||||||
| 326 | } | - | ||||||||||||
| 327 | - | |||||||||||||
| 328 | return never executed: false;return false;never executed: return false; | 0 | ||||||||||||
| 329 | } | - | ||||||||||||
| 330 | - | |||||||||||||
| 331 | - | |||||||||||||
| 332 | bool QQmlOpenMetaObject::hasValue(int id) const | - | ||||||||||||
| 333 | { | - | ||||||||||||
| 334 | return never executed: d->hasProperty(id);return d->hasProperty(id);never executed: return d->hasProperty(id); | 0 | ||||||||||||
| 335 | } | - | ||||||||||||
| 336 | - | |||||||||||||
| 337 | void QQmlOpenMetaObject::setCached(bool c) | - | ||||||||||||
| 338 | { | - | ||||||||||||
| 339 | if (c == d->cacheProperties
| 0-1890 | ||||||||||||
| 340 | return; never executed: return; | 0 | ||||||||||||
| 341 | - | |||||||||||||
| 342 | d->cacheProperties = c; | - | ||||||||||||
| 343 | - | |||||||||||||
| 344 | QQmlData *qmldata = QQmlData::get(d->object, true); | - | ||||||||||||
| 345 | if (d->cacheProperties
| 0-1890 | ||||||||||||
| 346 | if (!d->type->d->cache
| 168-1722 | ||||||||||||
| 347 | d->type->d->cache = new QQmlPropertyCache(this); executed 168 times by 4 tests: d->type->d->cache = new QQmlPropertyCache(this);Executed by:
| 168 | ||||||||||||
| 348 | qmldata->propertyCache = d->type->d->cache; | - | ||||||||||||
| 349 | d->type->d->cache->addref(); | - | ||||||||||||
| 350 | } executed 1890 times by 4 tests: else {end of blockExecuted by:
| 1890 | ||||||||||||
| 351 | if (d->type->d->cache
| 0 | ||||||||||||
| 352 | d->type->d->cache->release(); never executed: d->type->d->cache->release(); | 0 | ||||||||||||
| 353 | qmldata->propertyCache = nullptr; | - | ||||||||||||
| 354 | } never executed: end of block | 0 | ||||||||||||
| 355 | } | - | ||||||||||||
| 356 | - | |||||||||||||
| 357 | - | |||||||||||||
| 358 | int QQmlOpenMetaObject::createProperty(const char *name, const char *) | - | ||||||||||||
| 359 | { | - | ||||||||||||
| 360 | if (d->autoCreate
| 0-3546 | ||||||||||||
| 361 | int result = d->type->createProperty(name); | - | ||||||||||||
| 362 | - | |||||||||||||
| 363 | if (QQmlData *ddata = QQmlData::get(d->object, false)
| 422-3124 | ||||||||||||
| 364 | if (ddata->propertyCache
| 2-420 | ||||||||||||
| 365 | ddata->propertyCache->release(); | - | ||||||||||||
| 366 | ddata->propertyCache = nullptr; | - | ||||||||||||
| 367 | } executed 2 times by 1 test: end of blockExecuted by:
| 2 | ||||||||||||
| 368 | } executed 422 times by 9 tests: end of blockExecuted by:
| 422 | ||||||||||||
| 369 | - | |||||||||||||
| 370 | return executed 3546 times by 9 tests: result;return result;Executed by:
executed 3546 times by 9 tests: return result;Executed by:
| 3546 | ||||||||||||
| 371 | } else | - | ||||||||||||
| 372 | return never executed: -1;return -1;never executed: return -1; | 0 | ||||||||||||
| 373 | } | - | ||||||||||||
| 374 | - | |||||||||||||
| 375 | void QQmlOpenMetaObject::propertyRead(int) | - | ||||||||||||
| 376 | { | - | ||||||||||||
| 377 | } | - | ||||||||||||
| 378 | - | |||||||||||||
| 379 | void QQmlOpenMetaObject::propertyWrite(int) | - | ||||||||||||
| 380 | { | - | ||||||||||||
| 381 | } | - | ||||||||||||
| 382 | - | |||||||||||||
| 383 | QVariant QQmlOpenMetaObject::propertyWriteValue(int, const QVariant &value) | - | ||||||||||||
| 384 | { | - | ||||||||||||
| 385 | return executed 70 times by 2 tests: value;return value;Executed by:
executed 70 times by 2 tests: return value;Executed by:
| 70 | ||||||||||||
| 386 | } | - | ||||||||||||
| 387 | - | |||||||||||||
| 388 | void QQmlOpenMetaObject::propertyWritten(int) | - | ||||||||||||
| 389 | { | - | ||||||||||||
| 390 | } | - | ||||||||||||
| 391 | - | |||||||||||||
| 392 | void QQmlOpenMetaObject::propertyCreated(int, QMetaPropertyBuilder &) | - | ||||||||||||
| 393 | { | - | ||||||||||||
| 394 | } | - | ||||||||||||
| 395 | - | |||||||||||||
| 396 | QVariant QQmlOpenMetaObject::initialValue(int) | - | ||||||||||||
| 397 | { | - | ||||||||||||
| 398 | return executed 4996 times by 5 tests: QVariant();return QVariant();Executed by:
executed 4996 times by 5 tests: return QVariant();Executed by:
| 4996 | ||||||||||||
| 399 | } | - | ||||||||||||
| 400 | - | |||||||||||||
| 401 | int QQmlOpenMetaObject::count() const | - | ||||||||||||
| 402 | { | - | ||||||||||||
| 403 | return executed 7274 times by 2 tests: d->type->d->names.count();return d->type->d->names.count();Executed by:
executed 7274 times by 2 tests: return d->type->d->names.count();Executed by:
| 7274 | ||||||||||||
| 404 | } | - | ||||||||||||
| 405 | - | |||||||||||||
| 406 | QByteArray QQmlOpenMetaObject::name(int idx) const | - | ||||||||||||
| 407 | { | - | ||||||||||||
| 408 | ((idx >= 0 && idx < d->type->d->names.count()) ? static_cast<void>(0) : qt_assert("idx >= 0 && idx < d->type->d->names.count()", __FILE__, 454)); | - | ||||||||||||
| 409 | - | |||||||||||||
| 410 | return executed 1542 times by 8 tests: d->type->d->mob.property(idx).name();return d->type->d->mob.property(idx).name();Executed by:
executed 1542 times by 8 tests: return d->type->d->mob.property(idx).name();Executed by:
| 1542 | ||||||||||||
| 411 | } | - | ||||||||||||
| 412 | - | |||||||||||||
| 413 | QObject *QQmlOpenMetaObject::object() const | - | ||||||||||||
| 414 | { | - | ||||||||||||
| 415 | return executed 386 times by 8 tests: d->object;return d->object;Executed by:
executed 386 times by 8 tests: return d->object;Executed by:
| 386 | ||||||||||||
| 416 | } | - | ||||||||||||
| 417 | - | |||||||||||||
| 418 | - | |||||||||||||
| Switch to Source code | Preprocessed file |