diff options
author | Warwick Allison <warwick.allison@nokia.com> | 2010-04-21 07:24:41 (GMT) |
---|---|---|
committer | Warwick Allison <warwick.allison@nokia.com> | 2010-04-21 07:24:41 (GMT) |
commit | 550f7a2aadbd46c7bd6f30e1faa0bb9a1241a3cf (patch) | |
tree | 6096fb849261ad6328721a97cc06c4630d675040 /examples | |
parent | cffe02d1c7aa5f087558fcbabdab890b979ae5cc (diff) | |
parent | e39958e76340698cc2b0ac88a03167a016b9c07b (diff) | |
download | Qt-550f7a2aadbd46c7bd6f30e1faa0bb9a1241a3cf.zip Qt-550f7a2aadbd46c7bd6f30e1faa0bb9a1241a3cf.tar.gz Qt-550f7a2aadbd46c7bd6f30e1faa0bb9a1241a3cf.tar.bz2 |
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/qt-qml into 4.7
Diffstat (limited to 'examples')
5 files changed, 40 insertions, 5 deletions
diff --git a/examples/declarative/dynamic/dynamic.qml b/examples/declarative/dynamic/dynamic.qml index eea528f..0e6e197 100644 --- a/examples/declarative/dynamic/dynamic.qml +++ b/examples/declarative/dynamic/dynamic.qml @@ -7,6 +7,34 @@ Item { //This is a desktop-sized example width: 1024; height: 512 property int activeSuns: 0 + + //This is the message that pops up when there's an error + Rectangle{ + id: dialog + opacity: 0 + anchors.centerIn: parent + width: dialogText.width + 6 + height: dialogText.height + 6 + border.color: 'black' + color: 'lightsteelblue' + z: 65535 //Arbitrary number chosen to be above all the items, including the scaled perspective ones. + function show(str){ + dialogText.text = str; + dialogAnim.start(); + } + Text{ + id: dialogText + x:3 + y:3 + font.pixelSize: 14 + } + SequentialAnimation{ + id: dialogAnim + NumberAnimation{target: dialog; property:"opacity"; to: 1; duration: 1000} + PauseAnimation{duration: 5000} + NumberAnimation{target: dialog; property:"opacity"; to: 0; duration: 1000} + } + } // sky Rectangle { id: sky @@ -114,7 +142,14 @@ Item { } Button { text: "Create" - onClicked: createQmlObject(qmlText.text, window, 'CustomObject'); + function makeCustom() { + try{ + Qt.createQmlObject(qmlText.text, window, 'CustomObject'); + }catch(err){ + dialog.show('Error on line ' + err.qmlErrors[0].lineNumber + '\n' + err.qmlErrors[0].message ); + } + } + onClicked: makeCustom(); } } } diff --git a/examples/declarative/dynamic/qml/itemCreation.js b/examples/declarative/dynamic/qml/itemCreation.js index ccc03aa..4fa0d9f 100644 --- a/examples/declarative/dynamic/qml/itemCreation.js +++ b/examples/declarative/dynamic/qml/itemCreation.js @@ -31,7 +31,7 @@ function loadComponent() { if (itemComponent != null) //Already loaded the component createItem(); - itemComponent = createComponent(itemButton.file); + itemComponent = Qt.createComponent(itemButton.file); //print(itemButton.file) if(itemComponent.isLoading){ component.statusChanged.connect(finishCreation); diff --git a/examples/declarative/tutorials/samegame/samegame2/samegame.js b/examples/declarative/tutorials/samegame/samegame2/samegame.js index 9809c1d..81da31b 100644 --- a/examples/declarative/tutorials/samegame/samegame2/samegame.js +++ b/examples/declarative/tutorials/samegame/samegame2/samegame.js @@ -35,7 +35,7 @@ function startNewGame() { function createBlock(column, row) { if (component == null) - component = createComponent("Block.qml"); + component = Qt.createComponent("Block.qml"); // Note that if Block.qml was not a local file, component.isReady would be // false and we should wait for the component's statusChanged() signal to diff --git a/examples/declarative/tutorials/samegame/samegame3/samegame.js b/examples/declarative/tutorials/samegame/samegame3/samegame.js index c12def7..eaf47d9 100644 --- a/examples/declarative/tutorials/samegame/samegame3/samegame.js +++ b/examples/declarative/tutorials/samegame/samegame3/samegame.js @@ -32,7 +32,7 @@ function startNewGame() { function createBlock(column, row) { if (component == null) - component = createComponent("Block.qml"); + component = Qt.createComponent("Block.qml"); // Note that if Block.qml was not a local file, component.isReady would be // false and we should wait for the component's statusChanged() signal to diff --git a/examples/declarative/tutorials/samegame/samegame4/content/samegame.js b/examples/declarative/tutorials/samegame/samegame4/content/samegame.js index 7800b6e..c527f66 100755 --- a/examples/declarative/tutorials/samegame/samegame4/content/samegame.js +++ b/examples/declarative/tutorials/samegame/samegame4/content/samegame.js @@ -43,7 +43,7 @@ function startNewGame() { function createBlock(column, row) { if (component == null) - component = createComponent("content/BoomBlock.qml"); + component = Qt.createComponent("content/BoomBlock.qml"); // Note that if Block.qml was not a local file, component.isReady would be // false and we should wait for the component's statusChanged() signal to |