summaryrefslogtreecommitdiffstats
path: root/src/declarative
diff options
context:
space:
mode:
authorMichael Brasser <michael.brasser@nokia.com>2010-04-23 02:15:13 (GMT)
committerMichael Brasser <michael.brasser@nokia.com>2010-04-23 04:54:14 (GMT)
commit5ef92c54cd35e6b2abf5f4b0db02c8980c48119d (patch)
tree043fadbec301b78a718016c38e8e6f80fd53fe7e /src/declarative
parent9a11e0288869cdf53350a95bedf28374c8fccb31 (diff)
downloadQt-5ef92c54cd35e6b2abf5f4b0db02c8980c48119d.zip
Qt-5ef92c54cd35e6b2abf5f4b0db02c8980c48119d.tar.gz
Qt-5ef92c54cd35e6b2abf5f4b0db02c8980c48119d.tar.bz2
Return null if creation fails.
Diffstat (limited to 'src/declarative')
-rw-r--r--src/declarative/qml/qdeclarativecomponent.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/declarative/qml/qdeclarativecomponent.cpp b/src/declarative/qml/qdeclarativecomponent.cpp
index 24edf7d..161ce56 100644
--- a/src/declarative/qml/qdeclarativecomponent.cpp
+++ b/src/declarative/qml/qdeclarativecomponent.cpp
@@ -594,7 +594,9 @@ QDeclarativeComponent::QDeclarativeComponent(QDeclarativeComponentPrivate &dd, Q
/*!
\qmlmethod object Component::createObject()
- Returns an object instance from this component.
+ Returns an object instance from this component, or null if object creation fails.
+
+ The object will be created in the same context as the component was created in.
*/
/*!
@@ -606,10 +608,10 @@ QScriptValue QDeclarativeComponent::createObject()
Q_D(QDeclarativeComponent);
QDeclarativeContext* ctxt = creationContext();
if(!ctxt)
- return QScriptValue();
+ return QScriptValue(QScriptValue::NullValue);
QObject* ret = create(ctxt);
if (!ret)
- return QScriptValue();
+ return QScriptValue(QScriptValue::NullValue);
QDeclarativeEnginePrivate *priv = QDeclarativeEnginePrivate::get(d->engine);
QDeclarativeData::get(ret, true)->setImplicitDestructible();
return priv->objectClass->newQObject(ret, QMetaType::QObjectStar);