Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Allow parent to be specified for Qt.createComponent
Add an optional parameter to the Qt.createComponent function which allows the caller to specify the object that will become the parent for the created component. If the parent is not specified by the caller, it becomes the QML engine; this behavior will change in the near future to allow these component objects to be collected when no longer referenced. Task-number: QTBUG-24840 Change-Id: I2742133fe8ab8cbc80d8012a9d9b9fc2e4596fca Reviewed-by: Martin Jones <martin.jones@nokia.com>
- Loading branch information
Matthew Vogt
authored and
Qt by Nokia
committed
Mar 20, 2012
1 parent
c5cd60a
commit 610df5c
Showing
3 changed files
with
169 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import Qt.test 1.0 | ||
import QtQuick 2.0 | ||
|
||
MyTypeObject{ | ||
id: obj | ||
objectName: "obj" | ||
|
||
function url() | ||
{ | ||
obj.componentProperty = Qt.createComponent('dynamicCreation.helper.qml'); | ||
} | ||
|
||
function urlMode() | ||
{ | ||
obj.componentProperty = Qt.createComponent('dynamicCreation.helper.qml', Component.PreferSynchronous); | ||
} | ||
|
||
function urlParent() | ||
{ | ||
obj.componentProperty = Qt.createComponent('dynamicCreation.helper.qml', obj); | ||
} | ||
|
||
function urlNullParent() | ||
{ | ||
obj.componentProperty = Qt.createComponent('dynamicCreation.helper.qml', null); | ||
} | ||
|
||
function urlModeParent() | ||
{ | ||
obj.componentProperty = Qt.createComponent('dynamicCreation.helper.qml', Component.PreferSynchronous, obj); | ||
} | ||
|
||
function urlModeNullParent() | ||
{ | ||
obj.componentProperty = Qt.createComponent('dynamicCreation.helper.qml', Component.PreferSynchronous, null); | ||
} | ||
|
||
function invalidSecondArg() | ||
{ | ||
obj.componentProperty = Qt.createComponent('dynamicCreation.helper.qml', 'Bad argument'); | ||
} | ||
|
||
function invalidThirdArg() | ||
{ | ||
obj.componentProperty = Qt.createComponent('dynamicCreation.helper.qml', Component.PreferSynchronous, 'Bad argument'); | ||
} | ||
|
||
function invalidMode() | ||
{ | ||
obj.componentProperty = Qt.createComponent('dynamicCreation.helper.qml', -666); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters