aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/qml/qqmlobjectcreator.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/qml/qml/qqmlobjectcreator.cpp')
-rw-r--r--src/qml/qml/qqmlobjectcreator.cpp34
1 files changed, 17 insertions, 17 deletions
diff --git a/src/qml/qml/qqmlobjectcreator.cpp b/src/qml/qml/qqmlobjectcreator.cpp
index 2cbcfbbfb6..6867aaad75 100644
--- a/src/qml/qml/qqmlobjectcreator.cpp
+++ b/src/qml/qml/qqmlobjectcreator.cpp
@@ -613,11 +613,11 @@ void QQmlObjectCreator::setPropertyValue(const QQmlPropertyData *property, const
}
}
-static QQmlType *qmlTypeForObject(QObject *object)
+static QQmlType qmlTypeForObject(QObject *object)
{
- QQmlType *type = 0;
+ QQmlType type;
const QMetaObject *mo = object->metaObject();
- while (mo && !type) {
+ while (mo && !type.isValid()) {
type = QQmlMetaType::qmlType(mo);
mo = mo->superClass();
}
@@ -654,7 +654,7 @@ void QQmlObjectCreator::setupBindings(bool applyDeferredBindings)
} else if (binding) {
QQmlValueTypeProxyBinding *proxy = static_cast<QQmlValueTypeProxyBinding *>(binding);
- if (qmlTypeForObject(_bindingTarget)) {
+ if (qmlTypeForObject(_bindingTarget).isValid()) {
quint32 bindingSkipList = 0;
QQmlPropertyData *defaultProperty = _compiledObject->indexOfDefaultPropertyOrAlias != -1 ? _propertyCache->parent()->defaultProperty() : _propertyCache->defaultProperty();
@@ -712,15 +712,15 @@ bool QQmlObjectCreator::setPropertyBinding(const QQmlPropertyData *property, con
Q_ASSERT(stringAt(qmlUnit->objectAt(binding->value.objectIndex)->inheritedTypeNameIndex).isEmpty());
QV4::CompiledData::ResolvedTypeReference *tr = resolvedTypes.value(binding->propertyNameIndex);
Q_ASSERT(tr);
- QQmlType *attachedType = tr->type;
- if (!attachedType) {
+ QQmlType attachedType = tr->type;
+ if (!attachedType.isValid()) {
QQmlTypeNameCache::Result res = context->imports->query(stringAt(binding->propertyNameIndex));
if (res.isValid())
attachedType = res.type;
else
return false;
}
- const int id = attachedType->attachedPropertiesId(QQmlEnginePrivate::get(engine));
+ const int id = attachedType.attachedPropertiesId(QQmlEnginePrivate::get(engine));
QObject *qmlObject = qmlAttachedPropertiesObjectById(id, _qobject);
if (!populateInstance(binding->value.objectIndex, qmlObject, qmlObject, /*value type property*/0))
return false;
@@ -850,10 +850,10 @@ bool QQmlObjectCreator::setPropertyBinding(const QQmlPropertyData *property, con
if (binding->type == QV4::CompiledData::Binding::Type_Object) {
if (binding->flags & QV4::CompiledData::Binding::IsOnAssignment) {
// ### determine value source and interceptor casts ahead of time.
- QQmlType *type = qmlTypeForObject(createdSubObject);
- Q_ASSERT(type);
+ QQmlType type = qmlTypeForObject(createdSubObject);
+ Q_ASSERT(type.isValid());
- int valueSourceCast = type->propertyValueSourceCast();
+ int valueSourceCast = type.propertyValueSourceCast();
if (valueSourceCast != -1) {
QQmlPropertyValueSource *vs = reinterpret_cast<QQmlPropertyValueSource *>(reinterpret_cast<char *>(createdSubObject) + valueSourceCast);
QObject *target = createdSubObject->parent();
@@ -865,7 +865,7 @@ bool QQmlObjectCreator::setPropertyBinding(const QQmlPropertyData *property, con
vs->setTarget(prop);
return true;
}
- int valueInterceptorCast = type->propertyValueInterceptorCast();
+ int valueInterceptorCast = type.propertyValueInterceptorCast();
if (valueInterceptorCast != -1) {
QQmlPropertyValueInterceptor *vi = reinterpret_cast<QQmlPropertyValueInterceptor *>(reinterpret_cast<char *>(createdSubObject) + valueInterceptorCast);
QObject *target = createdSubObject->parent();
@@ -1060,13 +1060,13 @@ QObject *QQmlObjectCreator::createInstance(int index, QObject *parent, bool isCo
QV4::CompiledData::ResolvedTypeReference *typeRef = resolvedTypes.value(obj->inheritedTypeNameIndex);
Q_ASSERT(typeRef);
installPropertyCache = !typeRef->isFullyDynamicType;
- QQmlType *type = typeRef->type;
- if (type) {
+ QQmlType type = typeRef->type;
+ if (type.isValid()) {
Q_QML_OC_PROFILE(sharedState->profiler, profiler.update(
- compilationUnit, obj, type->qmlTypeName(), context->url()));
+ compilationUnit, obj, type.qmlTypeName(), context->url()));
void *ddataMemory = 0;
- type->create(&instance, &ddataMemory, sizeof(QQmlData));
+ type.create(&instance, &ddataMemory, sizeof(QQmlData));
if (!instance) {
recordError(obj->location, tr("Unable to create object of type %1").arg(stringAt(obj->inheritedTypeNameIndex)));
return 0;
@@ -1080,11 +1080,11 @@ QObject *QQmlObjectCreator::createInstance(int index, QObject *parent, bool isCo
p->declarativeData = ddata;
}
- const int parserStatusCast = type->parserStatusCast();
+ const int parserStatusCast = type.parserStatusCast();
if (parserStatusCast != -1)
parserStatus = reinterpret_cast<QQmlParserStatus*>(reinterpret_cast<char *>(instance) + parserStatusCast);
- customParser = type->customParser();
+ customParser = type.customParser();
if (sharedState->rootContext && sharedState->rootContext->isRootObjectInCreation) {
QQmlData *ddata = QQmlData::get(instance, /*create*/true);