diff options
author | Aaron Kennedy <aaron.kennedy@nokia.com> | 2009-07-06 08:35:31 (GMT) |
---|---|---|
committer | Aaron Kennedy <aaron.kennedy@nokia.com> | 2009-07-06 08:35:31 (GMT) |
commit | 319d0497bbb7e140570da30b511b6b20bceb6515 (patch) | |
tree | bd98a7452809045555933acfdd92bb85ef22edd8 /examples | |
parent | d641b621077d5cc81ce7b3de92af9a0f6d47f4d6 (diff) | |
parent | 395169a94dba47baec683c95874de9556ba4952d (diff) | |
download | Qt-319d0497bbb7e140570da30b511b6b20bceb6515.zip Qt-319d0497bbb7e140570da30b511b6b20bceb6515.tar.gz Qt-319d0497bbb7e140570da30b511b6b20bceb6515.tar.bz2 |
Merge branch 'kinetic-declarativeui' of git@scm.dev.nokia.troll.no:qt/kinetic into kinetic-declarativeui
Diffstat (limited to 'examples')
-rw-r--r-- | examples/declarative/dynamic/DynRect.qml | 1 | ||||
-rw-r--r-- | examples/declarative/dynamic/dynamic.js | 12 | ||||
-rw-r--r-- | examples/declarative/dynamic/dynamic.qml | 4 |
3 files changed, 10 insertions, 7 deletions
diff --git a/examples/declarative/dynamic/DynRect.qml b/examples/declarative/dynamic/DynRect.qml new file mode 100644 index 0000000..d9a2ef3 --- /dev/null +++ b/examples/declarative/dynamic/DynRect.qml @@ -0,0 +1 @@ +Rect { color: "steelblue"; width: 100; height: 100; id: newRect } diff --git a/examples/declarative/dynamic/dynamic.js b/examples/declarative/dynamic/dynamic.js index 6b483fd..13317df 100644 --- a/examples/declarative/dynamic/dynamic.js +++ b/examples/declarative/dynamic/dynamic.js @@ -1,10 +1,9 @@ var dynamicObject = null; var fourthBox = null; -var component; +var component = null; var started = false; -function createWithEvalQml(p) { - return evalQml('Rect { color: "lightsteelblue"; width: 100;' - + 'height: 100; id: newRect}','DynPart.qml'); +function createQml(p) { + return createQmlObject('DynRect {}',p,'DynPart.qml'); } function destroyDynamicObject() { @@ -29,7 +28,7 @@ function instantCreateWithComponent() {//Like create, but assumes instant readyn } function finishCreation(){ - if(component.isReady()){ + if(component.isReady() && dynamicObject == null){ dynamicObject = component.createObject(); dynamicObject.parent = targetItem; }else if(component.isError()){ @@ -40,6 +39,9 @@ function finishCreation(){ } function createWithComponent(){ + if(component!=null){ + return finishCreation(); + } if(started!=false){ finishCreation();//Remakes if destroyed return dynamicObject; diff --git a/examples/declarative/dynamic/dynamic.qml b/examples/declarative/dynamic/dynamic.qml index 3e0c12e..b9f3b35 100644 --- a/examples/declarative/dynamic/dynamic.qml +++ b/examples/declarative/dynamic/dynamic.qml @@ -13,9 +13,9 @@ Rect { id: page; width: 800; height: 800; color:"black" MouseRegion { anchors.fill:parent; onClicked: { if(fourthBox == null) { - a = createWithEvalQml(); + a = createQml(targetItem2); if(a!=null) { - a.parent = targetItem2; + a.parent = targetItem2;//BUG: this should happen automatically fourthBox = a; extendStars = true; } |