diff options
author | Qt Continuous Integration System <qt-info@nokia.com> | 2010-05-24 15:51:52 (GMT) |
---|---|---|
committer | Qt Continuous Integration System <qt-info@nokia.com> | 2010-05-24 15:51:52 (GMT) |
commit | 5ace2ec2a272091ba6dfb15274d387fb58bfa772 (patch) | |
tree | 9c1fbdf2475e831fc9cce597586f37836589f60b /src | |
parent | c6d893bc8ada7ddd3b9896ab43d05f7d764edf51 (diff) | |
parent | 1079096a57112d9615812771adba18d2e9297320 (diff) | |
download | Qt-5ace2ec2a272091ba6dfb15274d387fb58bfa772.zip Qt-5ace2ec2a272091ba6dfb15274d387fb58bfa772.tar.gz Qt-5ace2ec2a272091ba6dfb15274d387fb58bfa772.tar.bz2 |
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/qt-qml into 4.7-integration
* '4.7' of scm.dev.nokia.troll.no:qt/qt-qml:
Added autotest for Component.createObject() without Qt.createComponent()
Diffstat (limited to 'src')
-rw-r--r-- | src/declarative/qml/qdeclarativecomponent.cpp | 10 | ||||
-rw-r--r-- | src/declarative/qml/qdeclarativeengine.cpp | 4 |
2 files changed, 9 insertions, 5 deletions
diff --git a/src/declarative/qml/qdeclarativecomponent.cpp b/src/declarative/qml/qdeclarativecomponent.cpp index 3b782e7..7aa17e8 100644 --- a/src/declarative/qml/qdeclarativecomponent.cpp +++ b/src/declarative/qml/qdeclarativecomponent.cpp @@ -549,15 +549,19 @@ QDeclarativeComponent::QDeclarativeComponent(QDeclarativeComponentPrivate &dd, Q Returns an object instance from this component, or null if object creation fails. The object will be created in the same context as the one in which the component - was created. + was created. This function will always return null when called on components + which were not created in QML. Note that if the returned object is to be displayed, its \c parent must be set to - an existing item in a scene, or else the object will not be visible. + an existing item in a scene, or else the object will not be visible. The parent + argument is required to help you avoid this, you must explicitly pass in null if + you wish to create an object without setting a parent. */ /*! \internal - A version of create which returns a scriptObject, for use in script + A version of create which returns a scriptObject, for use in script. + This function will only work on components created in QML. Sets graphics object parent because forgetting to do this is a frequent and serious problem. diff --git a/src/declarative/qml/qdeclarativeengine.cpp b/src/declarative/qml/qdeclarativeengine.cpp index df9aa59..a7384a9 100644 --- a/src/declarative/qml/qdeclarativeengine.cpp +++ b/src/declarative/qml/qdeclarativeengine.cpp @@ -1049,9 +1049,9 @@ If you are certain the files will be local, you could simplify to: \snippet doc/src/snippets/declarative/componentCreation.js 2 -The methods and properties of the Component element are defined in its own +The methods and properties of the \l {Component} element are defined in its own page, but when using it dynamically only two methods are usually used. -\c Component.createObject() returns the created object or \c null if there is an error. + \l {Component::createObject()}{Component.createObject()} returns the created object or \c null if there is an error. If there is an error, \l {Component::errorString()}{Component.errorString()} describes the error that occurred. Note that createObject() takes exactly one argument, which is set to the parent of the created object. Graphical objects without a parent will not appear |