diff options
author | Alan Alpert <alan.alpert@nokia.com> | 2010-05-05 18:54:19 (GMT) |
---|---|---|
committer | Alan Alpert <alan.alpert@nokia.com> | 2010-05-05 18:54:19 (GMT) |
commit | 0a8379d9f01118d7ff0121e6ecbbc0307e1e7f63 (patch) | |
tree | dbbf96df4245ecd37d9c9f0b619afaf6ddd19e38 /tests/auto/declarative/qdeclarativeecmascript | |
parent | 337dbd5391b4e2b1bd88918a46f3392df8fd1312 (diff) | |
download | Qt-0a8379d9f01118d7ff0121e6ecbbc0307e1e7f63.zip Qt-0a8379d9f01118d7ff0121e6ecbbc0307e1e7f63.tar.gz Qt-0a8379d9f01118d7ff0121e6ecbbc0307e1e7f63.tar.bz2 |
Make component.createObject require a parent argument
For graphical objects (the common case) a common mistake is to not
parent a dynamically created item. Since you almost always want to add a
parent, and it's hard for a beginner to diagnose this problem, a parent
is now a required argument and dealt with by the createObject function.
Task-number: QTBUG-10110
Diffstat (limited to 'tests/auto/declarative/qdeclarativeecmascript')
-rw-r--r-- | tests/auto/declarative/qdeclarativeecmascript/data/dynamicCreation.qml | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/dynamicCreation.qml b/tests/auto/declarative/qdeclarativeecmascript/data/dynamicCreation.qml index 3047e9b..7b132e1 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/data/dynamicCreation.qml +++ b/tests/auto/declarative/qdeclarativeecmascript/data/dynamicCreation.qml @@ -11,7 +11,7 @@ MyQmlObject{ function createTwo() { var component = Qt.createComponent('dynamicCreation.helper.qml'); - obj.objectProperty = component.createObject(); + obj.objectProperty = component.createObject(obj); } function createThree() @@ -22,6 +22,6 @@ MyQmlObject{ function dontCrash() { var component = Qt.createComponent('file-doesnt-exist.qml'); - obj.objectProperty = component.createObject(); + obj.objectProperty = component.createObject(obj); } } |