summaryrefslogtreecommitdiffstats
path: root/examples/declarative/dynamic/dynamic.js
diff options
context:
space:
mode:
authorBea Lam <bea.lam@nokia.com>2009-10-08 05:08:40 (GMT)
committerBea Lam <bea.lam@nokia.com>2009-10-08 05:08:40 (GMT)
commitf149107f3281fd537c98aaac5cba5934d55aa78a (patch)
tree57bd2008434dbaeb857b29e4ec3f1c99c45139d3 /examples/declarative/dynamic/dynamic.js
parente79cf93c8b724c8eac042e68ba8dee0b9f2feee3 (diff)
downloadQt-f149107f3281fd537c98aaac5cba5934d55aa78a.zip
Qt-f149107f3281fd537c98aaac5cba5934d55aa78a.tar.gz
Qt-f149107f3281fd537c98aaac5cba5934d55aa78a.tar.bz2
Clean up
Diffstat (limited to 'examples/declarative/dynamic/dynamic.js')
-rw-r--r--examples/declarative/dynamic/dynamic.js26
1 files changed, 14 insertions, 12 deletions
diff --git a/examples/declarative/dynamic/dynamic.js b/examples/declarative/dynamic/dynamic.js
index 8f1e138..8bfdba3 100644
--- a/examples/declarative/dynamic/dynamic.js
+++ b/examples/declarative/dynamic/dynamic.js
@@ -2,54 +2,56 @@ var dynamicObject = null;
var fourthBox = null;
var component = null;
var started = false;
+
function createQml(p) {
- return createQmlObject('DynRect {}',p,'DynPart.qml');
+ return createQmlObject('DynRect {}', p, 'DynPart.qml');
}
function destroyDynamicObject() {
- if(!(dynamicObject==null)){
+ if (!(dynamicObject == null)) {
dynamicObject.destroy();
dynamicObject = null;
}
}
function instantCreateWithComponent() {//Like create, but assumes instant readyness
- if(dynamicObject!=null)//Already made
+ if (dynamicObject != null)//Already made
return null;
component = createComponent("dynamic.qml");
dynamicObject = component.createObject();
- if(dynamicObject == null){
+
+ if (dynamicObject == null) {
print("error creating component");
- }else{
+ } else {
dynamicObject.parent = targetItem;
return dynamicObject;
}
return null;
}
-function finishCreation(){
- if(component.isReady && dynamicObject == null){
+function finishCreation() {
+ if (component.isReady && dynamicObject == null) {
dynamicObject = component.createObject();
dynamicObject.parent = targetItem;
- }else if(component.isError){
+ } else if (component.isError) {
dynamicObject = null;
print("error creating component");
print(component.errorsString());
}
}
-function createWithComponent(){
- if(component!=null){
+function createWithComponent() {
+ if (component != null) {
return finishCreation();
}
- if(started!=false){
+ if (started != false) {
finishCreation();//Remakes if destroyed
return dynamicObject;
}
started = true;
component = createComponent("dynamic.qml");
finishCreation();
- if(dynamicObject != null){
+ if (dynamicObject != null) {
return dynamicObject;
}
component.statusChanged.connect(finishCreation);