From 2738c57e51b4fcb70f25ea4ff46c966ce5287c27 Mon Sep 17 00:00:00 2001 From: Alan Alpert Date: Mon, 5 Mar 2012 15:40:59 +1000 Subject: Fix renaming merge with examples Some examples were duplicated a few times. Removing the excess. Change-Id: I6fa59f79de63ac952103421ba1c063f5912b702b Reviewed-by: Martin Jones --- .../dynamicview/dynamicview1/PetsModel.qml | 102 ---------- .../dynamicview/dynamicview1/dynamicview.qml | 90 -------- .../dynamicview/dynamicview2/PetsModel.qml | 98 --------- .../dynamicview/dynamicview2/dynamicview.qml | 121 ----------- .../dynamicview/dynamicview3/PetsModel.qml | 98 --------- .../dynamicview/dynamicview3/dynamicview.qml | 143 ------------- .../dynamicview/dynamicview4/ListSelector.qml | 120 ----------- .../dynamicview/dynamicview4/PetsModel.qml | 98 --------- .../dynamicview/dynamicview4/dynamicview.qml | 219 -------------------- .../tutorials/extending/chapter1-basics/app.qml | 60 ------ .../extending/chapter1-basics/chapter1-basics.pro | 5 - .../tutorials/extending/chapter1-basics/main.cpp | 57 ------ .../extending/chapter1-basics/piechart.cpp | 79 ------- .../tutorials/extending/chapter1-basics/piechart.h | 71 ------- .../tutorials/extending/chapter2-methods/app.qml | 66 ------ .../chapter2-methods/chapter2-methods.pro | 5 - .../tutorials/extending/chapter2-methods/main.cpp | 57 ------ .../extending/chapter2-methods/piechart.cpp | 84 -------- .../extending/chapter2-methods/piechart.h | 84 -------- .../tutorials/extending/chapter3-bindings/app.qml | 74 ------- .../chapter3-bindings/chapter3-bindings.pro | 5 - .../tutorials/extending/chapter3-bindings/main.cpp | 57 ------ .../extending/chapter3-bindings/piechart.cpp | 86 -------- .../extending/chapter3-bindings/piechart.h | 84 -------- .../extending/chapter4-customPropertyTypes/app.qml | 60 ------ .../chapter4-customPropertyTypes.pro | 7 - .../chapter4-customPropertyTypes/main.cpp | 66 ------ .../chapter4-customPropertyTypes/piechart.cpp | 70 ------- .../chapter4-customPropertyTypes/piechart.h | 78 ------- .../chapter4-customPropertyTypes/pieslice.cpp | 66 ------ .../chapter4-customPropertyTypes/pieslice.h | 66 ------ .../extending/chapter5-listproperties/app.qml | 70 ------- .../chapter5-listproperties.pro | 7 - .../extending/chapter5-listproperties/main.cpp | 58 ------ .../extending/chapter5-listproperties/piechart.cpp | 72 ------- .../extending/chapter5-listproperties/piechart.h | 75 ------- .../extending/chapter5-listproperties/pieslice.cpp | 86 -------- .../extending/chapter5-listproperties/pieslice.h | 76 ------- .../extending/chapter6-plugins/ChartsPlugin/qmldir | 1 - .../tutorials/extending/chapter6-plugins/app.qml | 69 ------- .../chapter6-plugins/chapter6-plugins.pro | 18 -- .../extending/chapter6-plugins/chartsplugin.cpp | 54 ----- .../extending/chapter6-plugins/chartsplugin.h | 55 ----- .../extending/chapter6-plugins/piechart.cpp | 71 ------- .../extending/chapter6-plugins/piechart.h | 69 ------- .../extending/chapter6-plugins/pieslice.cpp | 86 -------- .../extending/chapter6-plugins/pieslice.h | 74 ------- examples/qml/tutorials/extending/extending.pro | 10 - examples/qml/tutorials/helloworld/Cell.qml | 72 ------- examples/qml/tutorials/helloworld/tutorial1.qml | 63 ------ examples/qml/tutorials/helloworld/tutorial2.qml | 72 ------- examples/qml/tutorials/helloworld/tutorial3.qml | 91 --------- .../qml/tutorials/samegame/samegame1/Block.qml | 53 ----- .../qml/tutorials/samegame/samegame1/Button.qml | 83 -------- .../qml/tutorials/samegame/samegame1/samegame.qml | 82 -------- .../samegame/samegame1/samegame1.qmlproject | 16 -- .../qml/tutorials/samegame/samegame2/Block.qml | 51 ----- .../qml/tutorials/samegame/samegame2/Button.qml | 81 -------- .../qml/tutorials/samegame/samegame2/samegame.js | 63 ------ .../qml/tutorials/samegame/samegame2/samegame.qml | 85 -------- .../samegame/samegame2/samegame2.qmlproject | 16 -- .../qml/tutorials/samegame/samegame3/Block.qml | 63 ------ .../qml/tutorials/samegame/samegame3/Button.qml | 81 -------- .../qml/tutorials/samegame/samegame3/Dialog.qml | 71 ------- .../qml/tutorials/samegame/samegame3/samegame.js | 174 ---------------- .../qml/tutorials/samegame/samegame3/samegame.qml | 109 ---------- .../samegame/samegame3/samegame3.qmlproject | 16 -- .../samegame/samegame4/content/BoomBlock.qml | 122 ----------- .../samegame/samegame4/content/Button.qml | 81 -------- .../samegame/samegame4/content/Dialog.qml | 107 ---------- .../samegame/samegame4/content/samegame.js | 226 --------------------- .../tutorials/samegame/samegame4/highscores/README | 1 - .../samegame/samegame4/highscores/score_data.xml | 2 - .../samegame/samegame4/highscores/score_style.xsl | 28 --- .../samegame/samegame4/highscores/scores.php | 31 --- .../qml/tutorials/samegame/samegame4/samegame.qml | 115 ----------- .../samegame/samegame4/samegame4.qmlproject | 16 -- .../tutorials/samegame/shared/pics/background.jpg | Bin 36473 -> 0 bytes .../tutorials/samegame/shared/pics/blueStar.png | Bin 278 -> 0 bytes .../tutorials/samegame/shared/pics/blueStone.png | Bin 3054 -> 0 bytes .../tutorials/samegame/shared/pics/greenStar.png | Bin 273 -> 0 bytes .../tutorials/samegame/shared/pics/greenStone.png | Bin 2932 -> 0 bytes .../qml/tutorials/samegame/shared/pics/redStar.png | Bin 274 -> 0 bytes .../tutorials/samegame/shared/pics/redStone.png | Bin 2902 -> 0 bytes .../qml/tutorials/samegame/shared/pics/star.png | Bin 262 -> 0 bytes .../tutorials/samegame/shared/pics/yellowStone.png | Bin 3056 -> 0 bytes examples/qml/tutorials/tutorials.pro | 5 - examples/qml/tutorials/tutorials.qmlproject | 14 -- 88 files changed, 5417 deletions(-) delete mode 100644 examples/qml/tutorials/dynamicview/dynamicview1/PetsModel.qml delete mode 100644 examples/qml/tutorials/dynamicview/dynamicview1/dynamicview.qml delete mode 100644 examples/qml/tutorials/dynamicview/dynamicview2/PetsModel.qml delete mode 100644 examples/qml/tutorials/dynamicview/dynamicview2/dynamicview.qml delete mode 100644 examples/qml/tutorials/dynamicview/dynamicview3/PetsModel.qml delete mode 100644 examples/qml/tutorials/dynamicview/dynamicview3/dynamicview.qml delete mode 100644 examples/qml/tutorials/dynamicview/dynamicview4/ListSelector.qml delete mode 100644 examples/qml/tutorials/dynamicview/dynamicview4/PetsModel.qml delete mode 100644 examples/qml/tutorials/dynamicview/dynamicview4/dynamicview.qml delete mode 100644 examples/qml/tutorials/extending/chapter1-basics/app.qml delete mode 100644 examples/qml/tutorials/extending/chapter1-basics/chapter1-basics.pro delete mode 100644 examples/qml/tutorials/extending/chapter1-basics/main.cpp delete mode 100644 examples/qml/tutorials/extending/chapter1-basics/piechart.cpp delete mode 100644 examples/qml/tutorials/extending/chapter1-basics/piechart.h delete mode 100644 examples/qml/tutorials/extending/chapter2-methods/app.qml delete mode 100644 examples/qml/tutorials/extending/chapter2-methods/chapter2-methods.pro delete mode 100644 examples/qml/tutorials/extending/chapter2-methods/main.cpp delete mode 100644 examples/qml/tutorials/extending/chapter2-methods/piechart.cpp delete mode 100644 examples/qml/tutorials/extending/chapter2-methods/piechart.h delete mode 100644 examples/qml/tutorials/extending/chapter3-bindings/app.qml delete mode 100644 examples/qml/tutorials/extending/chapter3-bindings/chapter3-bindings.pro delete mode 100644 examples/qml/tutorials/extending/chapter3-bindings/main.cpp delete mode 100644 examples/qml/tutorials/extending/chapter3-bindings/piechart.cpp delete mode 100644 examples/qml/tutorials/extending/chapter3-bindings/piechart.h delete mode 100644 examples/qml/tutorials/extending/chapter4-customPropertyTypes/app.qml delete mode 100644 examples/qml/tutorials/extending/chapter4-customPropertyTypes/chapter4-customPropertyTypes.pro delete mode 100644 examples/qml/tutorials/extending/chapter4-customPropertyTypes/main.cpp delete mode 100644 examples/qml/tutorials/extending/chapter4-customPropertyTypes/piechart.cpp delete mode 100644 examples/qml/tutorials/extending/chapter4-customPropertyTypes/piechart.h delete mode 100644 examples/qml/tutorials/extending/chapter4-customPropertyTypes/pieslice.cpp delete mode 100644 examples/qml/tutorials/extending/chapter4-customPropertyTypes/pieslice.h delete mode 100644 examples/qml/tutorials/extending/chapter5-listproperties/app.qml delete mode 100644 examples/qml/tutorials/extending/chapter5-listproperties/chapter5-listproperties.pro delete mode 100644 examples/qml/tutorials/extending/chapter5-listproperties/main.cpp delete mode 100644 examples/qml/tutorials/extending/chapter5-listproperties/piechart.cpp delete mode 100644 examples/qml/tutorials/extending/chapter5-listproperties/piechart.h delete mode 100644 examples/qml/tutorials/extending/chapter5-listproperties/pieslice.cpp delete mode 100644 examples/qml/tutorials/extending/chapter5-listproperties/pieslice.h delete mode 100644 examples/qml/tutorials/extending/chapter6-plugins/ChartsPlugin/qmldir delete mode 100644 examples/qml/tutorials/extending/chapter6-plugins/app.qml delete mode 100644 examples/qml/tutorials/extending/chapter6-plugins/chapter6-plugins.pro delete mode 100644 examples/qml/tutorials/extending/chapter6-plugins/chartsplugin.cpp delete mode 100644 examples/qml/tutorials/extending/chapter6-plugins/chartsplugin.h delete mode 100644 examples/qml/tutorials/extending/chapter6-plugins/piechart.cpp delete mode 100644 examples/qml/tutorials/extending/chapter6-plugins/piechart.h delete mode 100644 examples/qml/tutorials/extending/chapter6-plugins/pieslice.cpp delete mode 100644 examples/qml/tutorials/extending/chapter6-plugins/pieslice.h delete mode 100644 examples/qml/tutorials/extending/extending.pro delete mode 100644 examples/qml/tutorials/helloworld/Cell.qml delete mode 100644 examples/qml/tutorials/helloworld/tutorial1.qml delete mode 100644 examples/qml/tutorials/helloworld/tutorial2.qml delete mode 100644 examples/qml/tutorials/helloworld/tutorial3.qml delete mode 100644 examples/qml/tutorials/samegame/samegame1/Block.qml delete mode 100644 examples/qml/tutorials/samegame/samegame1/Button.qml delete mode 100644 examples/qml/tutorials/samegame/samegame1/samegame.qml delete mode 100644 examples/qml/tutorials/samegame/samegame1/samegame1.qmlproject delete mode 100644 examples/qml/tutorials/samegame/samegame2/Block.qml delete mode 100644 examples/qml/tutorials/samegame/samegame2/Button.qml delete mode 100644 examples/qml/tutorials/samegame/samegame2/samegame.js delete mode 100644 examples/qml/tutorials/samegame/samegame2/samegame.qml delete mode 100644 examples/qml/tutorials/samegame/samegame2/samegame2.qmlproject delete mode 100644 examples/qml/tutorials/samegame/samegame3/Block.qml delete mode 100644 examples/qml/tutorials/samegame/samegame3/Button.qml delete mode 100644 examples/qml/tutorials/samegame/samegame3/Dialog.qml delete mode 100644 examples/qml/tutorials/samegame/samegame3/samegame.js delete mode 100644 examples/qml/tutorials/samegame/samegame3/samegame.qml delete mode 100644 examples/qml/tutorials/samegame/samegame3/samegame3.qmlproject delete mode 100644 examples/qml/tutorials/samegame/samegame4/content/BoomBlock.qml delete mode 100644 examples/qml/tutorials/samegame/samegame4/content/Button.qml delete mode 100644 examples/qml/tutorials/samegame/samegame4/content/Dialog.qml delete mode 100755 examples/qml/tutorials/samegame/samegame4/content/samegame.js delete mode 100644 examples/qml/tutorials/samegame/samegame4/highscores/README delete mode 100755 examples/qml/tutorials/samegame/samegame4/highscores/score_data.xml delete mode 100755 examples/qml/tutorials/samegame/samegame4/highscores/score_style.xsl delete mode 100755 examples/qml/tutorials/samegame/samegame4/highscores/scores.php delete mode 100644 examples/qml/tutorials/samegame/samegame4/samegame.qml delete mode 100644 examples/qml/tutorials/samegame/samegame4/samegame4.qmlproject delete mode 100644 examples/qml/tutorials/samegame/shared/pics/background.jpg delete mode 100644 examples/qml/tutorials/samegame/shared/pics/blueStar.png delete mode 100644 examples/qml/tutorials/samegame/shared/pics/blueStone.png delete mode 100644 examples/qml/tutorials/samegame/shared/pics/greenStar.png delete mode 100644 examples/qml/tutorials/samegame/shared/pics/greenStone.png delete mode 100644 examples/qml/tutorials/samegame/shared/pics/redStar.png delete mode 100644 examples/qml/tutorials/samegame/shared/pics/redStone.png delete mode 100644 examples/qml/tutorials/samegame/shared/pics/star.png delete mode 100644 examples/qml/tutorials/samegame/shared/pics/yellowStone.png delete mode 100644 examples/qml/tutorials/tutorials.pro delete mode 100644 examples/qml/tutorials/tutorials.qmlproject (limited to 'examples/qml/tutorials') diff --git a/examples/qml/tutorials/dynamicview/dynamicview1/PetsModel.qml b/examples/qml/tutorials/dynamicview/dynamicview1/PetsModel.qml deleted file mode 100644 index f07613c968..0000000000 --- a/examples/qml/tutorials/dynamicview/dynamicview1/PetsModel.qml +++ /dev/null @@ -1,102 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor -** the names of its contributors may be used to endorse or promote -** products derived from this software without specific prior written -** permission. -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -//![0] -import QtQuick 2.0 - -ListModel { - ListElement { - name: "Polly" - type: "Parrot" - age: 12 - size: "Small" - } - ListElement { - name: "Penny" - type: "Turtle" - age: 4 - size: "Small" - } -//![0] - ListElement { - name: "Warren" - type: "Rabbit" - age: 2 - size: "Small" - } - ListElement { - name: "Spot" - type: "Dog" - age: 9 - size: "Medium" - } - ListElement { - name: "Schrödinger" - type: "Cat" - age: 2 - size: "Medium" - } - ListElement { - name: "Joey" - type: "Kangaroo" - age: 1 - size: "Medium" - } - ListElement { - name: "Kimba" - type: "Bunny" - age: 65 - size: "Large" - } - ListElement { - name: "Rover" - type: "Dog" - age: 5 - size: "Large" - } - ListElement { - name: "Tiny" - type: "Elephant" - age: 15 - size: "Large" - } -//![1] -} -//![1] diff --git a/examples/qml/tutorials/dynamicview/dynamicview1/dynamicview.qml b/examples/qml/tutorials/dynamicview/dynamicview1/dynamicview.qml deleted file mode 100644 index 1a9dd453ce..0000000000 --- a/examples/qml/tutorials/dynamicview/dynamicview1/dynamicview.qml +++ /dev/null @@ -1,90 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor -** the names of its contributors may be used to endorse or promote -** products derived from this software without specific prior written -** permission. -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -//![0] -import QtQuick 2.0 - -Rectangle { - id: root - - width: 300; height: 400 - -//![1] - Component { - id: dragDelegate - - Rectangle { - id: content - - anchors { left: parent.left; right: parent.right } - height: column.implicitHeight + 4 - - border.width: 1 - border.color: "lightsteelblue" - - radius: 2 - - Column { - id: column - anchors { fill: parent; margins: 2 } - - Text { text: 'Name: ' + name } - Text { text: 'Type: ' + type } - Text { text: 'Age: ' + age } - Text { text: 'Size: ' + size } - } - } - } -//![1] -//![2] - ListView { - id: view - - anchors { fill: parent; margins: 2 } - - model: PetsModel {} - delegate: dragDelegate - - spacing: 4 - cacheBuffer: 50 - } -//![2] -} -//![0] diff --git a/examples/qml/tutorials/dynamicview/dynamicview2/PetsModel.qml b/examples/qml/tutorials/dynamicview/dynamicview2/PetsModel.qml deleted file mode 100644 index 4f2087d95e..0000000000 --- a/examples/qml/tutorials/dynamicview/dynamicview2/PetsModel.qml +++ /dev/null @@ -1,98 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor -** the names of its contributors may be used to endorse or promote -** products derived from this software without specific prior written -** permission. -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.0 - -ListModel { - ListElement { - name: "Polly" - type: "Parrot" - age: 12 - size: "Small" - } - ListElement { - name: "Penny" - type: "Turtle" - age: 4 - size: "Small" - } - ListElement { - name: "Warren" - type: "Rabbit" - age: 2 - size: "Small" - } - ListElement { - name: "Spot" - type: "Dog" - age: 9 - size: "Medium" - } - ListElement { - name: "Schrödinger" - type: "Cat" - age: 2 - size: "Medium" - } - ListElement { - name: "Joey" - type: "Kangaroo" - age: 1 - size: "Medium" - } - ListElement { - name: "Kimba" - type: "Bunny" - age: 65 - size: "Large" - } - ListElement { - name: "Rover" - type: "Dog" - age: 5 - size: "Large" - } - ListElement { - name: "Tiny" - type: "Elephant" - age: 15 - size: "Large" - } -} diff --git a/examples/qml/tutorials/dynamicview/dynamicview2/dynamicview.qml b/examples/qml/tutorials/dynamicview/dynamicview2/dynamicview.qml deleted file mode 100644 index 9e654a685c..0000000000 --- a/examples/qml/tutorials/dynamicview/dynamicview2/dynamicview.qml +++ /dev/null @@ -1,121 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor -** the names of its contributors may be used to endorse or promote -** products derived from this software without specific prior written -** permission. -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.0 - -Rectangle { - id: root - - width: 300; height: 400 - -//![0] - Component { - id: dragDelegate - -//![1] - MouseArea { - id: dragArea - - property bool held: false - - anchors { left: parent.left; right: parent.right } - height: content.height - - drag.target: held ? content : undefined - drag.axis: Drag.YAxis - - onPressAndHold: held = true - onReleased: held = false - - Rectangle { - id: content -//![1] - anchors { - horizontalCenter: parent.horizontalCenter - verticalCenter: parent.verticalCenter - } - width: dragArea.width; height: column.implicitHeight + 4 - - border.width: 1 - border.color: "lightsteelblue" -//![3] - color: dragArea.held ? "lightsteelblue" : "white" - Behavior on color { ColorAnimation { duration: 100 } } -//![3] - radius: 2 -//![4] - states: State { - when: dragArea.held - - ParentChange { target: content; parent: root } - AnchorChanges { - target: content - anchors { horizontalCenter: undefined; verticalCenter: undefined } - } - } -//![4] - Column { - id: column - anchors { fill: parent; margins: 2 } - - Text { text: 'Name: ' + name } - Text { text: 'Type: ' + type } - Text { text: 'Age: ' + age } - Text { text: 'Size: ' + size } - } -//![2] - } - } -//![2] - } -//![0] - - ListView { - id: view - - anchors { fill: parent; margins: 2 } - - model: PetsModel {} - delegate: dragDelegate - - spacing: 4 - cacheBuffer: 50 - } -} diff --git a/examples/qml/tutorials/dynamicview/dynamicview3/PetsModel.qml b/examples/qml/tutorials/dynamicview/dynamicview3/PetsModel.qml deleted file mode 100644 index 4f2087d95e..0000000000 --- a/examples/qml/tutorials/dynamicview/dynamicview3/PetsModel.qml +++ /dev/null @@ -1,98 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor -** the names of its contributors may be used to endorse or promote -** products derived from this software without specific prior written -** permission. -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.0 - -ListModel { - ListElement { - name: "Polly" - type: "Parrot" - age: 12 - size: "Small" - } - ListElement { - name: "Penny" - type: "Turtle" - age: 4 - size: "Small" - } - ListElement { - name: "Warren" - type: "Rabbit" - age: 2 - size: "Small" - } - ListElement { - name: "Spot" - type: "Dog" - age: 9 - size: "Medium" - } - ListElement { - name: "Schrödinger" - type: "Cat" - age: 2 - size: "Medium" - } - ListElement { - name: "Joey" - type: "Kangaroo" - age: 1 - size: "Medium" - } - ListElement { - name: "Kimba" - type: "Bunny" - age: 65 - size: "Large" - } - ListElement { - name: "Rover" - type: "Dog" - age: 5 - size: "Large" - } - ListElement { - name: "Tiny" - type: "Elephant" - age: 15 - size: "Large" - } -} diff --git a/examples/qml/tutorials/dynamicview/dynamicview3/dynamicview.qml b/examples/qml/tutorials/dynamicview/dynamicview3/dynamicview.qml deleted file mode 100644 index 5a579f78d9..0000000000 --- a/examples/qml/tutorials/dynamicview/dynamicview3/dynamicview.qml +++ /dev/null @@ -1,143 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor -** the names of its contributors may be used to endorse or promote -** products derived from this software without specific prior written -** permission. -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.0 -//![0] -Rectangle { - id: root - - width: 300; height: 400 - - Component { - id: dragDelegate - - MouseArea { - id: dragArea - - property bool held: false - - anchors { left: parent.left; right: parent.right } - height: content.height - - drag.target: held ? content : undefined - drag.axis: Drag.YAxis - - onPressAndHold: held = true - onReleased: held = false - - Rectangle { - id: content -//![0] - anchors { - horizontalCenter: parent.horizontalCenter - verticalCenter: parent.verticalCenter - } - width: dragArea.width; height: column.implicitHeight + 4 - - border.width: 1 - border.color: "lightsteelblue" - - color: dragArea.held ? "lightsteelblue" : "white" - Behavior on color { ColorAnimation { duration: 100 } } - - radius: 2 -//![1] - Drag.active: dragArea.held - Drag.source: dragArea - Drag.hotSpot.x: width / 2 - Drag.hotSpot.y: height / 2 -//![1] - states: State { - when: dragArea.held - - ParentChange { target: content; parent: root } - AnchorChanges { - target: content - anchors { horizontalCenter: undefined; verticalCenter: undefined } - } - } - - Column { - id: column - anchors { fill: parent; margins: 2 } - - Text { text: 'Name: ' + name } - Text { text: 'Type: ' + type } - Text { text: 'Age: ' + age } - Text { text: 'Size: ' + size } - } -//![2] - } -//![3] - DropArea { - anchors { fill: parent; margins: 10 } - - onEntered: { - visualModel.items.move( - drag.source.VisualDataModel.itemsIndex, - dragArea.VisualDataModel.itemsIndex) - } - } -//![3] - } - } -//![2] -//![4] - VisualDataModel { - id: visualModel - - model: PetsModel {} - delegate: dragDelegate - } - - ListView { - id: view - - anchors { fill: parent; margins: 2 } - - model: visualModel - - spacing: 4 - cacheBuffer: 50 - } -//![4] -//![5] -} -//![5] diff --git a/examples/qml/tutorials/dynamicview/dynamicview4/ListSelector.qml b/examples/qml/tutorials/dynamicview/dynamicview4/ListSelector.qml deleted file mode 100644 index c6b8287beb..0000000000 --- a/examples/qml/tutorials/dynamicview/dynamicview4/ListSelector.qml +++ /dev/null @@ -1,120 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor -** the names of its contributors may be used to endorse or promote -** products derived from this software without specific prior written -** permission. -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.0 - -Item { - id: selector - - property alias list: view.model - property alias selectedIndex: view.currentIndex - property alias label: labelText.text - property bool expanded - - width: 100; height: labelText.implicitHeight + 26 - - Rectangle { - anchors { left: parent.left; right: parent.right; bottom: parent.bottom; } - - height: labelText.implicitHeight + 4 + (expanded ? 20 * view.count : 20) - Behavior on height { NumberAnimation { duration: 300 } } - - radius: 2 - border.width: 1 - border.color: "yellow" - color: "yellow" - - MouseArea { - anchors.fill: parent - - onClicked: selector.expanded = !selector.expanded - - Text { - id: labelText - anchors { left: parent.left; top: parent.top; margins: 2 } - } - - Rectangle { - anchors { - left: parent.left; top: labelText.bottom; - right: parent.right; bottom: parent.bottom; - margins: 2 - leftMargin: 10 - } - - radius: 2 - color: "white" - - ListView { - id: view - - anchors.fill: parent - - clip: true - - delegate: Text { - anchors { left: parent.left; right: parent.right } - height: 20 - - verticalAlignment: Text.AlignVCenter - - text: modelData - - MouseArea { - anchors.fill: parent - - onClicked: { - view.currentIndex = index - selector.expanded = !selector.expanded - } - } - } - highlight: Rectangle { - anchors { left: parent.left; right: parent.right } - height: 20 - radius: 2 - - color: "yellow" - } - } - } - } - } -} diff --git a/examples/qml/tutorials/dynamicview/dynamicview4/PetsModel.qml b/examples/qml/tutorials/dynamicview/dynamicview4/PetsModel.qml deleted file mode 100644 index 4f2087d95e..0000000000 --- a/examples/qml/tutorials/dynamicview/dynamicview4/PetsModel.qml +++ /dev/null @@ -1,98 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor -** the names of its contributors may be used to endorse or promote -** products derived from this software without specific prior written -** permission. -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.0 - -ListModel { - ListElement { - name: "Polly" - type: "Parrot" - age: 12 - size: "Small" - } - ListElement { - name: "Penny" - type: "Turtle" - age: 4 - size: "Small" - } - ListElement { - name: "Warren" - type: "Rabbit" - age: 2 - size: "Small" - } - ListElement { - name: "Spot" - type: "Dog" - age: 9 - size: "Medium" - } - ListElement { - name: "Schrödinger" - type: "Cat" - age: 2 - size: "Medium" - } - ListElement { - name: "Joey" - type: "Kangaroo" - age: 1 - size: "Medium" - } - ListElement { - name: "Kimba" - type: "Bunny" - age: 65 - size: "Large" - } - ListElement { - name: "Rover" - type: "Dog" - age: 5 - size: "Large" - } - ListElement { - name: "Tiny" - type: "Elephant" - age: 15 - size: "Large" - } -} diff --git a/examples/qml/tutorials/dynamicview/dynamicview4/dynamicview.qml b/examples/qml/tutorials/dynamicview/dynamicview4/dynamicview.qml deleted file mode 100644 index 9bd4e0c438..0000000000 --- a/examples/qml/tutorials/dynamicview/dynamicview4/dynamicview.qml +++ /dev/null @@ -1,219 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor -** the names of its contributors may be used to endorse or promote -** products derived from this software without specific prior written -** permission. -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.0 - -Rectangle { - id: root - - width: 300; height: 400 - - Component { - id: dragDelegate - - MouseArea { - id: dragArea - - property bool held: false - - anchors { left: parent.left; right: parent.right } - height: content.height - - enabled: visualModel.sortOrder == visualModel.lessThan.length - - drag.target: held ? content : undefined - drag.axis: Drag.YAxis - - onPressAndHold: held = true - onReleased: held = false - - Rectangle { - id: content - - anchors { - horizontalCenter: parent.horizontalCenter - verticalCenter: parent.verticalCenter - } - width: dragArea.width; height: column.implicitHeight + 4 - - border.width: 1 - border.color: "lightsteelblue" - - color: dragArea.held ? "lightsteelblue" : "white" - Behavior on color { ColorAnimation { duration: 100 } } - - radius: 2 - - Drag.active: dragArea.held - Drag.source: dragArea - Drag.hotSpot.x: width / 2 - Drag.hotSpot.y: height / 2 - - states: State { - when: dragArea.held - - ParentChange { target: content; parent: root } - AnchorChanges { - target: content - anchors { horizontalCenter: undefined; verticalCenter: undefined } - } - } - - Column { - id: column - anchors { fill: parent; margins: 2 } - - Text { text: 'Name: ' + name } - Text { text: 'Type: ' + type } - Text { text: 'Age: ' + age } - Text { text: 'Size: ' + size } - } - } - - DropArea { - anchors { fill: parent; margins: 10 } - - onEntered: { - visualModel.items.move( - drag.source.VisualDataModel.itemsIndex, - dragArea.VisualDataModel.itemsIndex) - } - } - } - } -//![0] - VisualDataModel { - id: visualModel -//![4] - property var lessThan: [ - function(left, right) { return left.name < right.name }, - function(left, right) { return left.type < right.type }, - function(left, right) { return left.age < right.age }, - function(left, right) { - if (left.size == "Small") - return true - else if (right.size == "Small") - return false - else if (left.size == "Medium") - return true - else - return false - } - ] -//![4] -//![6] - - property int sortOrder: orderSelector.selectedIndex - onSortOrderChanged: items.setGroups(0, items.count, "unsorted") - -//![6] -//![3] - function insertPosition(lessThan, item) { - var lower = 0 - var upper = items.count - while (lower < upper) { - var middle = Math.floor(lower + (upper - lower) / 2) - var result = lessThan(item.model, items.get(middle).model); - if (result) { - upper = middle - } else { - lower = middle + 1 - } - } - return lower - } - - function sort(lessThan) { - while (unsortedItems.count > 0) { - var item = unsortedItems.get(0) - var index = insertPosition(lessThan, item) - - item.groups = "items" - items.move(item.itemsIndex, index) - } - } -//![3] - -//![1] - items.includeByDefault: false -//![5] - groups: VisualDataGroup { - id: unsortedItems - name: "unsorted" - - includeByDefault: true -//![1] - onChanged: { - if (visualModel.sortOrder == visualModel.lessThan.length) - setGroups(0, count, "items") - else - visualModel.sort(visualModel.lessThan[visualModel.sortOrder]) - } -//![2] - } -//![2] -//![5] - model: PetsModel {} - delegate: dragDelegate - } -//![0] - ListView { - id: view - - anchors { - left: parent.left; top: parent.top; right: parent.right; bottom: orderSelector.top; - margins: 2 - } - - model: visualModel - - spacing: 4 - cacheBuffer: 50 - } - - ListSelector { - id: orderSelector - - anchors { left: parent.left; right: parent.right; bottom: parent.bottom; margins: 2 } - - label: "Sort By" - list: [ "Name", "Type", "Age", "Size", "Custom" ] - } -} diff --git a/examples/qml/tutorials/extending/chapter1-basics/app.qml b/examples/qml/tutorials/extending/chapter1-basics/app.qml deleted file mode 100644 index 6f0c1d3a23..0000000000 --- a/examples/qml/tutorials/extending/chapter1-basics/app.qml +++ /dev/null @@ -1,60 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor -** the names of its contributors may be used to endorse or promote -** products derived from this software without specific prior written -** permission. -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -//![0] -import Charts 1.0 -import QtQuick 2.0 - -Item { - width: 300; height: 200 - - PieChart { - id: aPieChart - anchors.centerIn: parent - width: 100; height: 100 - name: "A simple pie chart" - color: "red" - } - - Text { - anchors { bottom: parent.bottom; horizontalCenter: parent.horizontalCenter; bottomMargin: 20 } - text: aPieChart.name - } -} -//![0] diff --git a/examples/qml/tutorials/extending/chapter1-basics/chapter1-basics.pro b/examples/qml/tutorials/extending/chapter1-basics/chapter1-basics.pro deleted file mode 100644 index 8ed66f8b66..0000000000 --- a/examples/qml/tutorials/extending/chapter1-basics/chapter1-basics.pro +++ /dev/null @@ -1,5 +0,0 @@ -QT += qml quick - -HEADERS += piechart.h -SOURCES += piechart.cpp \ - main.cpp diff --git a/examples/qml/tutorials/extending/chapter1-basics/main.cpp b/examples/qml/tutorials/extending/chapter1-basics/main.cpp deleted file mode 100644 index ed9e412bd6..0000000000 --- a/examples/qml/tutorials/extending/chapter1-basics/main.cpp +++ /dev/null @@ -1,57 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor -** the names of its contributors may be used to endorse or promote -** products derived from this software without specific prior written -** permission. -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -//![0] -#include "piechart.h" -#include -#include - -int main(int argc, char *argv[]) -{ - QGuiApplication app(argc, argv); - - qmlRegisterType("Charts", 1, 0, "PieChart"); - - QQuickView view; - view.setResizeMode(QQuickView::SizeRootObjectToView); - view.setSource(QUrl::fromLocalFile("app.qml")); - view.show(); - return app.exec(); -} -//![0] diff --git a/examples/qml/tutorials/extending/chapter1-basics/piechart.cpp b/examples/qml/tutorials/extending/chapter1-basics/piechart.cpp deleted file mode 100644 index bc81d6a3a0..0000000000 --- a/examples/qml/tutorials/extending/chapter1-basics/piechart.cpp +++ /dev/null @@ -1,79 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor -** the names of its contributors may be used to endorse or promote -** products derived from this software without specific prior written -** permission. -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#include "piechart.h" -#include - -//![0] -PieChart::PieChart(QQuickItem *parent) - : QQuickPaintedItem(parent) -{ -} -//![0] - -QString PieChart::name() const -{ - return m_name; -} - -void PieChart::setName(const QString &name) -{ - m_name = name; -} - -QColor PieChart::color() const -{ - return m_color; -} - -void PieChart::setColor(const QColor &color) -{ - m_color = color; -} - -//![1] -void PieChart::paint(QPainter *painter) -{ - QPen pen(m_color, 2); - painter->setPen(pen); - painter->setRenderHints(QPainter::HighQualityAntialiasing, true); - painter->drawPie(boundingRect(), 90 * 16, 290 * 16); -} -//![1] - diff --git a/examples/qml/tutorials/extending/chapter1-basics/piechart.h b/examples/qml/tutorials/extending/chapter1-basics/piechart.h deleted file mode 100644 index 71a8786e7d..0000000000 --- a/examples/qml/tutorials/extending/chapter1-basics/piechart.h +++ /dev/null @@ -1,71 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor -** the names of its contributors may be used to endorse or promote -** products derived from this software without specific prior written -** permission. -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#ifndef PIECHART_H -#define PIECHART_H - -//![0] -#include -#include - -class PieChart : public QQuickPaintedItem -{ - Q_OBJECT - Q_PROPERTY(QString name READ name WRITE setName) - Q_PROPERTY(QColor color READ color WRITE setColor) - -public: - PieChart(QQuickItem *parent = 0); - - QString name() const; - void setName(const QString &name); - - QColor color() const; - void setColor(const QColor &color); - - void paint(QPainter *painter); - -private: - QString m_name; - QColor m_color; -}; -//![0] - -#endif - diff --git a/examples/qml/tutorials/extending/chapter2-methods/app.qml b/examples/qml/tutorials/extending/chapter2-methods/app.qml deleted file mode 100644 index eee0933734..0000000000 --- a/examples/qml/tutorials/extending/chapter2-methods/app.qml +++ /dev/null @@ -1,66 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor -** the names of its contributors may be used to endorse or promote -** products derived from this software without specific prior written -** permission. -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -//![0] -import Charts 1.0 -import QtQuick 2.0 - -Item { - width: 300; height: 200 - - PieChart { - id: aPieChart - anchors.centerIn: parent - width: 100; height: 100 - color: "red" - - onChartCleared: console.log("The chart has been cleared") - } - - MouseArea { - anchors.fill: parent - onClicked: aPieChart.clearChart() - } - - Text { - anchors { bottom: parent.bottom; horizontalCenter: parent.horizontalCenter; bottomMargin: 20 } - text: "Click anywhere to clear the chart" - } -} -//![0] diff --git a/examples/qml/tutorials/extending/chapter2-methods/chapter2-methods.pro b/examples/qml/tutorials/extending/chapter2-methods/chapter2-methods.pro deleted file mode 100644 index 8ed66f8b66..0000000000 --- a/examples/qml/tutorials/extending/chapter2-methods/chapter2-methods.pro +++ /dev/null @@ -1,5 +0,0 @@ -QT += qml quick - -HEADERS += piechart.h -SOURCES += piechart.cpp \ - main.cpp diff --git a/examples/qml/tutorials/extending/chapter2-methods/main.cpp b/examples/qml/tutorials/extending/chapter2-methods/main.cpp deleted file mode 100644 index ed9e412bd6..0000000000 --- a/examples/qml/tutorials/extending/chapter2-methods/main.cpp +++ /dev/null @@ -1,57 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor -** the names of its contributors may be used to endorse or promote -** products derived from this software without specific prior written -** permission. -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -//![0] -#include "piechart.h" -#include -#include - -int main(int argc, char *argv[]) -{ - QGuiApplication app(argc, argv); - - qmlRegisterType("Charts", 1, 0, "PieChart"); - - QQuickView view; - view.setResizeMode(QQuickView::SizeRootObjectToView); - view.setSource(QUrl::fromLocalFile("app.qml")); - view.show(); - return app.exec(); -} -//![0] diff --git a/examples/qml/tutorials/extending/chapter2-methods/piechart.cpp b/examples/qml/tutorials/extending/chapter2-methods/piechart.cpp deleted file mode 100644 index 71be74e943..0000000000 --- a/examples/qml/tutorials/extending/chapter2-methods/piechart.cpp +++ /dev/null @@ -1,84 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor -** the names of its contributors may be used to endorse or promote -** products derived from this software without specific prior written -** permission. -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#include "piechart.h" -#include - -PieChart::PieChart(QQuickItem *parent) - : QQuickPaintedItem(parent) -{ -} - -QString PieChart::name() const -{ - return m_name; -} - -void PieChart::setName(const QString &name) -{ - m_name = name; -} - -QColor PieChart::color() const -{ - return m_color; -} - -void PieChart::setColor(const QColor &color) -{ - m_color = color; -} - -void PieChart::paint(QPainter *painter) -{ - QPen pen(m_color, 2); - painter->setPen(pen); - painter->setRenderHints(QPainter::HighQualityAntialiasing, true); - painter->drawPie(boundingRect(), 90 * 16, 290 * 16); -} - -//![0] -void PieChart::clearChart() -{ - setColor(QColor(Qt::transparent)); - update(); - - emit chartCleared(); -} -//![0] diff --git a/examples/qml/tutorials/extending/chapter2-methods/piechart.h b/examples/qml/tutorials/extending/chapter2-methods/piechart.h deleted file mode 100644 index 7650d6e8d7..0000000000 --- a/examples/qml/tutorials/extending/chapter2-methods/piechart.h +++ /dev/null @@ -1,84 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor -** the names of its contributors may be used to endorse or promote -** products derived from this software without specific prior written -** permission. -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#ifndef PIECHART_H -#define PIECHART_H - -#include -#include - -//![0] -class PieChart : public QQuickPaintedItem -{ -//![0] - Q_OBJECT - Q_PROPERTY(QString name READ name WRITE setName) - Q_PROPERTY(QColor color READ color WRITE setColor) - -//![1] -public: -//![1] - - PieChart(QQuickItem *parent = 0); - - QString name() const; - void setName(const QString &name); - - QColor color() const; - void setColor(const QColor &color); - - void paint(QPainter *painter); - -//![2] - Q_INVOKABLE void clearChart(); - -signals: - void chartCleared(); -//![2] - -private: - QString m_name; - QColor m_color; - -//![3] -}; -//![3] - -#endif - diff --git a/examples/qml/tutorials/extending/chapter3-bindings/app.qml b/examples/qml/tutorials/extending/chapter3-bindings/app.qml deleted file mode 100644 index 4ad929132c..0000000000 --- a/examples/qml/tutorials/extending/chapter3-bindings/app.qml +++ /dev/null @@ -1,74 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor -** the names of its contributors may be used to endorse or promote -** products derived from this software without specific prior written -** permission. -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -//![0] -import Charts 1.0 -import QtQuick 2.0 - -Item { - width: 300; height: 200 - - Row { - anchors.centerIn: parent - spacing: 20 - - PieChart { - id: chartA - width: 100; height: 100 - color: "red" - } - - PieChart { - id: chartB - width: 100; height: 100 - color: chartA.color - } - } - - MouseArea { - anchors.fill: parent - onClicked: { chartA.color = "blue" } - } - - Text { - anchors { bottom: parent.bottom; horizontalCenter: parent.horizontalCenter; bottomMargin: 20 } - text: "Click anywhere to change the chart color" - } -} -//![0] diff --git a/examples/qml/tutorials/extending/chapter3-bindings/chapter3-bindings.pro b/examples/qml/tutorials/extending/chapter3-bindings/chapter3-bindings.pro deleted file mode 100644 index 8ed66f8b66..0000000000 --- a/examples/qml/tutorials/extending/chapter3-bindings/chapter3-bindings.pro +++ /dev/null @@ -1,5 +0,0 @@ -QT += qml quick - -HEADERS += piechart.h -SOURCES += piechart.cpp \ - main.cpp diff --git a/examples/qml/tutorials/extending/chapter3-bindings/main.cpp b/examples/qml/tutorials/extending/chapter3-bindings/main.cpp deleted file mode 100644 index ed9e412bd6..0000000000 --- a/examples/qml/tutorials/extending/chapter3-bindings/main.cpp +++ /dev/null @@ -1,57 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor -** the names of its contributors may be used to endorse or promote -** products derived from this software without specific prior written -** permission. -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -//![0] -#include "piechart.h" -#include -#include - -int main(int argc, char *argv[]) -{ - QGuiApplication app(argc, argv); - - qmlRegisterType("Charts", 1, 0, "PieChart"); - - QQuickView view; - view.setResizeMode(QQuickView::SizeRootObjectToView); - view.setSource(QUrl::fromLocalFile("app.qml")); - view.show(); - return app.exec(); -} -//![0] diff --git a/examples/qml/tutorials/extending/chapter3-bindings/piechart.cpp b/examples/qml/tutorials/extending/chapter3-bindings/piechart.cpp deleted file mode 100644 index 2a392125da..0000000000 --- a/examples/qml/tutorials/extending/chapter3-bindings/piechart.cpp +++ /dev/null @@ -1,86 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor -** the names of its contributors may be used to endorse or promote -** products derived from this software without specific prior written -** permission. -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#include "piechart.h" -#include - -PieChart::PieChart(QQuickItem *parent) - : QQuickPaintedItem(parent) -{ -} - -QString PieChart::name() const -{ - return m_name; -} - -void PieChart::setName(const QString &name) -{ - m_name = name; -} - -QColor PieChart::color() const -{ - return m_color; -} - -//![0] -void PieChart::setColor(const QColor &color) -{ - if (color != m_color) { - m_color = color; - update(); // repaint with the new color - emit colorChanged(); - } -} -//![0] - -void PieChart::paint(QPainter *painter) -{ - QPen pen(m_color, 2); - painter->setPen(pen); - painter->setRenderHints(QPainter::HighQualityAntialiasing, true); - painter->drawPie(boundingRect(), 90 * 16, 290 * 16); -} - -void PieChart::clearChart() -{ - setColor(QColor(Qt::transparent)); - update(); -} diff --git a/examples/qml/tutorials/extending/chapter3-bindings/piechart.h b/examples/qml/tutorials/extending/chapter3-bindings/piechart.h deleted file mode 100644 index 77075b5727..0000000000 --- a/examples/qml/tutorials/extending/chapter3-bindings/piechart.h +++ /dev/null @@ -1,84 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor -** the names of its contributors may be used to endorse or promote -** products derived from this software without specific prior written -** permission. -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#ifndef PIECHART_H -#define PIECHART_H - -#include -#include - -//![0] -class PieChart : public QQuickPaintedItem -{ -//![0] - Q_OBJECT - Q_PROPERTY(QString name READ name WRITE setName) - -//![1] - Q_PROPERTY(QColor color READ color WRITE setColor NOTIFY colorChanged) -public: -//![1] - - PieChart(QQuickItem *parent = 0); - - QString name() const; - void setName(const QString &name); - - QColor color() const; - void setColor(const QColor &color); - - void paint(QPainter *painter); - - Q_INVOKABLE void clearChart(); - -//![2] -signals: - void colorChanged(); -//![2] - -private: - QString m_name; - QColor m_color; - -//![3] -}; -//![3] - -#endif - diff --git a/examples/qml/tutorials/extending/chapter4-customPropertyTypes/app.qml b/examples/qml/tutorials/extending/chapter4-customPropertyTypes/app.qml deleted file mode 100644 index 06490773f4..0000000000 --- a/examples/qml/tutorials/extending/chapter4-customPropertyTypes/app.qml +++ /dev/null @@ -1,60 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor -** the names of its contributors may be used to endorse or promote -** products derived from this software without specific prior written -** permission. -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -//![0] -import Charts 1.0 -import QtQuick 2.0 - -Item { - width: 300; height: 200 - - PieChart { - id: chart - anchors.centerIn: parent - width: 100; height: 100 - - pieSlice: PieSlice { - anchors.fill: parent - color: "red" - } - } - - Component.onCompleted: console.log("The pie is colored " + chart.pieSlice.color) -} -//![0] diff --git a/examples/qml/tutorials/extending/chapter4-customPropertyTypes/chapter4-customPropertyTypes.pro b/examples/qml/tutorials/extending/chapter4-customPropertyTypes/chapter4-customPropertyTypes.pro deleted file mode 100644 index 23eb222ea3..0000000000 --- a/examples/qml/tutorials/extending/chapter4-customPropertyTypes/chapter4-customPropertyTypes.pro +++ /dev/null @@ -1,7 +0,0 @@ -QT += qml quick - -HEADERS += piechart.h \ - pieslice.h -SOURCES += piechart.cpp \ - pieslice.cpp \ - main.cpp diff --git a/examples/qml/tutorials/extending/chapter4-customPropertyTypes/main.cpp b/examples/qml/tutorials/extending/chapter4-customPropertyTypes/main.cpp deleted file mode 100644 index 537ea766fc..0000000000 --- a/examples/qml/tutorials/extending/chapter4-customPropertyTypes/main.cpp +++ /dev/null @@ -1,66 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor -** the names of its contributors may be used to endorse or promote -** products derived from this software without specific prior written -** permission. -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#include "piechart.h" -#include "pieslice.h" - -#include -#include - -//![0] -int main(int argc, char *argv[]) -{ -//![0] - QGuiApplication app(argc, argv); - - qmlRegisterType("Charts", 1, 0, "PieChart"); - -//![1] - qmlRegisterType("Charts", 1, 0, "PieSlice"); -//![1] - - QQuickView view; - view.setResizeMode(QQuickView::SizeRootObjectToView); - view.setSource(QUrl::fromLocalFile("app.qml")); - view.show(); - return app.exec(); - -//![2] -} -//![2] diff --git a/examples/qml/tutorials/extending/chapter4-customPropertyTypes/piechart.cpp b/examples/qml/tutorials/extending/chapter4-customPropertyTypes/piechart.cpp deleted file mode 100644 index 3cf9bdc00c..0000000000 --- a/examples/qml/tutorials/extending/chapter4-customPropertyTypes/piechart.cpp +++ /dev/null @@ -1,70 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor -** the names of its contributors may be used to endorse or promote -** products derived from this software without specific prior written -** permission. -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#include "piechart.h" -#include "pieslice.h" - -PieChart::PieChart(QQuickItem *parent) - : QQuickItem(parent) -{ -} - -QString PieChart::name() const -{ - return m_name; -} - -void PieChart::setName(const QString &name) -{ - m_name = name; -} - -PieSlice *PieChart::pieSlice() const -{ - return m_pieSlice; -} - -//![0] -void PieChart::setPieSlice(PieSlice *pieSlice) -{ - m_pieSlice = pieSlice; - pieSlice->setParentItem(this); -} -//![0] - diff --git a/examples/qml/tutorials/extending/chapter4-customPropertyTypes/piechart.h b/examples/qml/tutorials/extending/chapter4-customPropertyTypes/piechart.h deleted file mode 100644 index b89db5a2b1..0000000000 --- a/examples/qml/tutorials/extending/chapter4-customPropertyTypes/piechart.h +++ /dev/null @@ -1,78 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor -** the names of its contributors may be used to endorse or promote -** products derived from this software without specific prior written -** permission. -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#ifndef PIECHART_H -#define PIECHART_H - -#include - -class PieSlice; - -//![0] -class PieChart : public QQuickItem -{ - Q_OBJECT - Q_PROPERTY(PieSlice* pieSlice READ pieSlice WRITE setPieSlice) -//![0] - Q_PROPERTY(QString name READ name WRITE setName) - -//![1] -public: -//![1] - - PieChart(QQuickItem *parent = 0); - - QString name() const; - void setName(const QString &name); - -//![2] - PieSlice *pieSlice() const; - void setPieSlice(PieSlice *pieSlice); -//![2] - -private: - QString m_name; - PieSlice *m_pieSlice; - -//![3] -}; -//![3] - -#endif - diff --git a/examples/qml/tutorials/extending/chapter4-customPropertyTypes/pieslice.cpp b/examples/qml/tutorials/extending/chapter4-customPropertyTypes/pieslice.cpp deleted file mode 100644 index 654a46fc8d..0000000000 --- a/examples/qml/tutorials/extending/chapter4-customPropertyTypes/pieslice.cpp +++ /dev/null @@ -1,66 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor -** the names of its contributors may be used to endorse or promote -** products derived from this software without specific prior written -** permission. -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#include "pieslice.h" - -#include - -PieSlice::PieSlice(QQuickItem *parent) - : QQuickPaintedItem(parent) -{ -} - -QColor PieSlice::color() const -{ - return m_color; -} - -void PieSlice::setColor(const QColor &color) -{ - m_color = color; -} - -void PieSlice::paint(QPainter *painter) -{ - QPen pen(m_color, 2); - painter->setPen(pen); - painter->setRenderHints(QPainter::HighQualityAntialiasing, true); - painter->drawPie(boundingRect(), 90 * 16, 290 * 16); -} - diff --git a/examples/qml/tutorials/extending/chapter4-customPropertyTypes/pieslice.h b/examples/qml/tutorials/extending/chapter4-customPropertyTypes/pieslice.h deleted file mode 100644 index 8fc445d471..0000000000 --- a/examples/qml/tutorials/extending/chapter4-customPropertyTypes/pieslice.h +++ /dev/null @@ -1,66 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor -** the names of its contributors may be used to endorse or promote -** products derived from this software without specific prior written -** permission. -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#ifndef PIESLICE_H -#define PIESLICE_H - -#include -#include - -//![0] -class PieSlice : public QQuickPaintedItem -{ - Q_OBJECT - Q_PROPERTY(QColor color READ color WRITE setColor) - -public: - PieSlice(QQuickItem *parent = 0); - - QColor color() const; - void setColor(const QColor &color); - - void paint(QPainter *painter); - -private: - QColor m_color; -}; -//![0] - -#endif - diff --git a/examples/qml/tutorials/extending/chapter5-listproperties/app.qml b/examples/qml/tutorials/extending/chapter5-listproperties/app.qml deleted file mode 100644 index 37b0626948..0000000000 --- a/examples/qml/tutorials/extending/chapter5-listproperties/app.qml +++ /dev/null @@ -1,70 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor -** the names of its contributors may be used to endorse or promote -** products derived from this software without specific prior written -** permission. -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -//![0] -import Charts 1.0 -import QtQuick 2.0 - -Item { - width: 300; height: 200 - - PieChart { - anchors.centerIn: parent - width: 100; height: 100 - - slices: [ - PieSlice { - anchors.fill: parent - color: "red" - fromAngle: 0; angleSpan: 110 - }, - PieSlice { - anchors.fill: parent - color: "black" - fromAngle: 110; angleSpan: 50 - }, - PieSlice { - anchors.fill: parent - color: "blue" - fromAngle: 160; angleSpan: 100 - } - ] - } -} -//![0] diff --git a/examples/qml/tutorials/extending/chapter5-listproperties/chapter5-listproperties.pro b/examples/qml/tutorials/extending/chapter5-listproperties/chapter5-listproperties.pro deleted file mode 100644 index 23eb222ea3..0000000000 --- a/examples/qml/tutorials/extending/chapter5-listproperties/chapter5-listproperties.pro +++ /dev/null @@ -1,7 +0,0 @@ -QT += qml quick - -HEADERS += piechart.h \ - pieslice.h -SOURCES += piechart.cpp \ - pieslice.cpp \ - main.cpp diff --git a/examples/qml/tutorials/extending/chapter5-listproperties/main.cpp b/examples/qml/tutorials/extending/chapter5-listproperties/main.cpp deleted file mode 100644 index 59587733eb..0000000000 --- a/examples/qml/tutorials/extending/chapter5-listproperties/main.cpp +++ /dev/null @@ -1,58 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor -** the names of its contributors may be used to endorse or promote -** products derived from this software without specific prior written -** permission. -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#include "piechart.h" -#include "pieslice.h" - -#include -#include - -int main(int argc, char *argv[]) -{ - QGuiApplication app(argc, argv); - - qmlRegisterType("Charts", 1, 0, "PieChart"); - qmlRegisterType("Charts", 1, 0, "PieSlice"); - - QQuickView view; - view.setResizeMode(QQuickView::SizeRootObjectToView); - view.setSource(QUrl::fromLocalFile("app.qml")); - view.show(); - return app.exec(); -} diff --git a/examples/qml/tutorials/extending/chapter5-listproperties/piechart.cpp b/examples/qml/tutorials/extending/chapter5-listproperties/piechart.cpp deleted file mode 100644 index 9c2c6accf3..0000000000 --- a/examples/qml/tutorials/extending/chapter5-listproperties/piechart.cpp +++ /dev/null @@ -1,72 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor -** the names of its contributors may be used to endorse or promote -** products derived from this software without specific prior written -** permission. -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#include "piechart.h" -#include "pieslice.h" - -PieChart::PieChart(QQuickItem *parent) - : QQuickItem(parent) -{ -} - -QString PieChart::name() const -{ - return m_name; -} - -void PieChart::setName(const QString &name) -{ - m_name = name; -} - -//![0] -QQmlListProperty PieChart::slices() -{ - return QQmlListProperty(this, 0, &PieChart::append_slice); -} - -void PieChart::append_slice(QQmlListProperty *list, PieSlice *slice) -{ - PieChart *chart = qobject_cast(list->object); - if (chart) { - slice->setParentItem(chart); - chart->m_slices.append(slice); - } -} -//![0] diff --git a/examples/qml/tutorials/extending/chapter5-listproperties/piechart.h b/examples/qml/tutorials/extending/chapter5-listproperties/piechart.h deleted file mode 100644 index 6c17bc1258..0000000000 --- a/examples/qml/tutorials/extending/chapter5-listproperties/piechart.h +++ /dev/null @@ -1,75 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor -** the names of its contributors may be used to endorse or promote -** products derived from this software without specific prior written -** permission. -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#ifndef PIECHART_H -#define PIECHART_H - -#include - -class PieSlice; - -//![0] -class PieChart : public QQuickItem -{ - Q_OBJECT - Q_PROPERTY(QQmlListProperty slices READ slices) -//![0] - Q_PROPERTY(QString name READ name WRITE setName) - -//![1] -public: -//![1] - PieChart(QQuickItem *parent = 0); - - QString name() const; - void setName(const QString &name); - -//![2] - QQmlListProperty slices(); - -private: - static void append_slice(QQmlListProperty *list, PieSlice *slice); - - QString m_name; - QList m_slices; -}; -//![2] - -#endif - diff --git a/examples/qml/tutorials/extending/chapter5-listproperties/pieslice.cpp b/examples/qml/tutorials/extending/chapter5-listproperties/pieslice.cpp deleted file mode 100644 index 5bca2d58d8..0000000000 --- a/examples/qml/tutorials/extending/chapter5-listproperties/pieslice.cpp +++ /dev/null @@ -1,86 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor -** the names of its contributors may be used to endorse or promote -** products derived from this software without specific prior written -** permission. -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#include "pieslice.h" - -#include - -PieSlice::PieSlice(QQuickItem *parent) - : QQuickPaintedItem(parent) -{ -} - -QColor PieSlice::color() const -{ - return m_color; -} - -void PieSlice::setColor(const QColor &color) -{ - m_color = color; -} - -int PieSlice::fromAngle() const -{ - return m_fromAngle; -} - -void PieSlice::setFromAngle(int angle) -{ - m_fromAngle = angle; -} - -int PieSlice::angleSpan() const -{ - return m_angleSpan; -} - -void PieSlice::setAngleSpan(int angle) -{ - m_angleSpan = angle; -} - -void PieSlice::paint(QPainter *painter) -{ - QPen pen(m_color, 2); - painter->setPen(pen); - painter->setRenderHints(QPainter::HighQualityAntialiasing, true); - painter->drawPie(boundingRect(), m_fromAngle * 16, m_angleSpan * 16); -} - diff --git a/examples/qml/tutorials/extending/chapter5-listproperties/pieslice.h b/examples/qml/tutorials/extending/chapter5-listproperties/pieslice.h deleted file mode 100644 index f6497fcbae..0000000000 --- a/examples/qml/tutorials/extending/chapter5-listproperties/pieslice.h +++ /dev/null @@ -1,76 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor -** the names of its contributors may be used to endorse or promote -** products derived from this software without specific prior written -** permission. -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#ifndef PIESLICE_H -#define PIESLICE_H - -#include -#include - -//![0] -class PieSlice : public QQuickPaintedItem -{ - Q_OBJECT - Q_PROPERTY(QColor color READ color WRITE setColor) - Q_PROPERTY(int fromAngle READ fromAngle WRITE setFromAngle) - Q_PROPERTY(int angleSpan READ angleSpan WRITE setAngleSpan) -//![0] - -public: - PieSlice(QQuickItem *parent = 0); - - QColor color() const; - void setColor(const QColor &color); - - int fromAngle() const; - void setFromAngle(int angle); - - int angleSpan() const; - void setAngleSpan(int span); - - void paint(QPainter *painter); - -private: - QColor m_color; - int m_fromAngle; - int m_angleSpan; -}; - -#endif - diff --git a/examples/qml/tutorials/extending/chapter6-plugins/ChartsPlugin/qmldir b/examples/qml/tutorials/extending/chapter6-plugins/ChartsPlugin/qmldir deleted file mode 100644 index 72650d8243..0000000000 --- a/examples/qml/tutorials/extending/chapter6-plugins/ChartsPlugin/qmldir +++ /dev/null @@ -1 +0,0 @@ -plugin chartsplugin \ No newline at end of file diff --git a/examples/qml/tutorials/extending/chapter6-plugins/app.qml b/examples/qml/tutorials/extending/chapter6-plugins/app.qml deleted file mode 100644 index b6eac44e27..0000000000 --- a/examples/qml/tutorials/extending/chapter6-plugins/app.qml +++ /dev/null @@ -1,69 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor -** the names of its contributors may be used to endorse or promote -** products derived from this software without specific prior written -** permission. -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -import QtQuick 2.0 -import "ChartsPlugin" 1.0 - -Item { - width: 300; height: 200 - - PieChart { - anchors.centerIn: parent - width: 100; height: 100 - - slices: [ - PieSlice { - anchors.fill: parent - color: "red" - fromAngle: 0; angleSpan: 110 - }, - PieSlice { - anchors.fill: parent - color: "black" - fromAngle: 110; angleSpan: 50 - }, - PieSlice { - anchors.fill: parent - color: "blue" - fromAngle: 160; angleSpan: 100 - } - ] - } -} - diff --git a/examples/qml/tutorials/extending/chapter6-plugins/chapter6-plugins.pro b/examples/qml/tutorials/extending/chapter6-plugins/chapter6-plugins.pro deleted file mode 100644 index 75f88b2eaa..0000000000 --- a/examples/qml/tutorials/extending/chapter6-plugins/chapter6-plugins.pro +++ /dev/null @@ -1,18 +0,0 @@ -TEMPLATE = lib -CONFIG += qt plugin -QT += qml quick - -DESTDIR = ChartsPlugin -TARGET = chartsplugin - -OBJECTS_DIR = tmp -MOC_DIR = tmp - -HEADERS += piechart.h \ - pieslice.h \ - chartsplugin.h - -SOURCES += piechart.cpp \ - pieslice.cpp \ - chartsplugin.cpp - diff --git a/examples/qml/tutorials/extending/chapter6-plugins/chartsplugin.cpp b/examples/qml/tutorials/extending/chapter6-plugins/chartsplugin.cpp deleted file mode 100644 index f95cf1003b..0000000000 --- a/examples/qml/tutorials/extending/chapter6-plugins/chartsplugin.cpp +++ /dev/null @@ -1,54 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor -** the names of its contributors may be used to endorse or promote -** products derived from this software without specific prior written -** permission. -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#include "chartsplugin.h" -//![0] -#include "piechart.h" -#include "pieslice.h" -#include - -void ChartsPlugin::registerTypes(const char *uri) -{ - qmlRegisterType(uri, 1, 0, "PieChart"); - qmlRegisterType(uri, 1, 0, "PieSlice"); -} - -Q_EXPORT_PLUGIN2(chartsplugin, ChartsPlugin); -//![0] - diff --git a/examples/qml/tutorials/extending/chapter6-plugins/chartsplugin.h b/examples/qml/tutorials/extending/chapter6-plugins/chartsplugin.h deleted file mode 100644 index 2dc477f794..0000000000 --- a/examples/qml/tutorials/extending/chapter6-plugins/chartsplugin.h +++ /dev/null @@ -1,55 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor -** the names of its contributors may be used to endorse or promote -** products derived from this software without specific prior written -** permission. -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#ifndef CHARTSPLUGIN_H -#define CHARTSPLUGIN_H - -//![0] -#include - -class ChartsPlugin : public QQmlExtensionPlugin -{ - Q_OBJECT -public: - void registerTypes(const char *uri); -}; -//![0] - -#endif - diff --git a/examples/qml/tutorials/extending/chapter6-plugins/piechart.cpp b/examples/qml/tutorials/extending/chapter6-plugins/piechart.cpp deleted file mode 100644 index b00f4139be..0000000000 --- a/examples/qml/tutorials/extending/chapter6-plugins/piechart.cpp +++ /dev/null @@ -1,71 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor -** the names of its contributors may be used to endorse or promote -** products derived from this software without specific prior written -** permission. -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#include "piechart.h" -#include "pieslice.h" - -PieChart::PieChart(QQuickItem *parent) - : QQuickItem(parent) -{ -} - -QString PieChart::name() const -{ - return m_name; -} - -void PieChart::setName(const QString &name) -{ - m_name = name; -} - -QQmlListProperty PieChart::slices() -{ - return QQmlListProperty(this, 0, &PieChart::append_slice); -} - -void PieChart::append_slice(QQmlListProperty *list, PieSlice *slice) -{ - PieChart *chart = qobject_cast(list->object); - if (chart) { - slice->setParentItem(chart); - chart->m_slices.append(slice); - } -} - diff --git a/examples/qml/tutorials/extending/chapter6-plugins/piechart.h b/examples/qml/tutorials/extending/chapter6-plugins/piechart.h deleted file mode 100644 index 2ee8108784..0000000000 --- a/examples/qml/tutorials/extending/chapter6-plugins/piechart.h +++ /dev/null @@ -1,69 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor -** the names of its contributors may be used to endorse or promote -** products derived from this software without specific prior written -** permission. -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#ifndef PIECHART_H -#define PIECHART_H - -#include - -class PieSlice; - -class PieChart : public QQuickItem -{ - Q_OBJECT - Q_PROPERTY(QQmlListProperty slices READ slices) - Q_PROPERTY(QString name READ name WRITE setName) - -public: - PieChart(QQuickItem *parent = 0); - - QString name() const; - void setName(const QString &name); - - QQmlListProperty slices(); - -private: - static void append_slice(QQmlListProperty *list, PieSlice *slice); - - QString m_name; - QList m_slices; -}; - -#endif - diff --git a/examples/qml/tutorials/extending/chapter6-plugins/pieslice.cpp b/examples/qml/tutorials/extending/chapter6-plugins/pieslice.cpp deleted file mode 100644 index 5bca2d58d8..0000000000 --- a/examples/qml/tutorials/extending/chapter6-plugins/pieslice.cpp +++ /dev/null @@ -1,86 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor -** the names of its contributors may be used to endorse or promote -** products derived from this software without specific prior written -** permission. -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#include "pieslice.h" - -#include - -PieSlice::PieSlice(QQuickItem *parent) - : QQuickPaintedItem(parent) -{ -} - -QColor PieSlice::color() const -{ - return m_color; -} - -void PieSlice::setColor(const QColor &color) -{ - m_color = color; -} - -int PieSlice::fromAngle() const -{ - return m_fromAngle; -} - -void PieSlice::setFromAngle(int angle) -{ - m_fromAngle = angle; -} - -int PieSlice::angleSpan() const -{ - return m_angleSpan; -} - -void PieSlice::setAngleSpan(int angle) -{ - m_angleSpan = angle; -} - -void PieSlice::paint(QPainter *painter) -{ - QPen pen(m_color, 2); - painter->setPen(pen); - painter->setRenderHints(QPainter::HighQualityAntialiasing, true); - painter->drawPie(boundingRect(), m_fromAngle * 16, m_angleSpan * 16); -} - diff --git a/examples/qml/tutorials/extending/chapter6-plugins/pieslice.h b/examples/qml/tutorials/extending/chapter6-plugins/pieslice.h deleted file mode 100644 index 8a636fb3e7..0000000000 --- a/examples/qml/tutorials/extending/chapter6-plugins/pieslice.h +++ /dev/null @@ -1,74 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor -** the names of its contributors may be used to endorse or promote -** products derived from this software without specific prior written -** permission. -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#ifndef PIESLICE_H -#define PIESLICE_H - -#include -#include - -class PieSlice : public QQuickPaintedItem -{ - Q_OBJECT - Q_PROPERTY(QColor color READ color WRITE setColor) - Q_PROPERTY(int fromAngle READ fromAngle WRITE setFromAngle) - Q_PROPERTY(int angleSpan READ angleSpan WRITE setAngleSpan) - -public: - PieSlice(QQuickItem *parent = 0); - - QColor color() const; - void setColor(const QColor &color); - - int fromAngle() const; - void setFromAngle(int angle); - - int angleSpan() const; - void setAngleSpan(int span); - - void paint(QPainter *painter); - -private: - QColor m_color; - int m_fromAngle; - int m_angleSpan; -}; - -#endif - diff --git a/examples/qml/tutorials/extending/extending.pro b/examples/qml/tutorials/extending/extending.pro deleted file mode 100644 index 967473fda0..0000000000 --- a/examples/qml/tutorials/extending/extending.pro +++ /dev/null @@ -1,10 +0,0 @@ -TEMPLATE = subdirs - -SUBDIRS += \ - chapter1-basics \ - chapter2-methods \ - chapter3-bindings \ - chapter4-customPropertyTypes \ - chapter5-listproperties \ - chapter6-plugins - diff --git a/examples/qml/tutorials/helloworld/Cell.qml b/examples/qml/tutorials/helloworld/Cell.qml deleted file mode 100644 index 7140dcb2c1..0000000000 --- a/examples/qml/tutorials/helloworld/Cell.qml +++ /dev/null @@ -1,72 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor -** the names of its contributors may be used to endorse or promote -** products derived from this software without specific prior written -** permission. -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -//![0] -import QtQuick 2.0 - -//![1] -Item { - id: container -//![4] - property alias cellColor: rectangle.color -//![4] -//![5] - signal clicked(color cellColor) -//![5] - - width: 40; height: 25 -//![1] - -//![2] - Rectangle { - id: rectangle - border.color: "white" - anchors.fill: parent - } -//![2] - -//![3] - MouseArea { - anchors.fill: parent - onClicked: container.clicked(container.cellColor) - } -//![3] -} -//![0] diff --git a/examples/qml/tutorials/helloworld/tutorial1.qml b/examples/qml/tutorials/helloworld/tutorial1.qml deleted file mode 100644 index f0eb42d696..0000000000 --- a/examples/qml/tutorials/helloworld/tutorial1.qml +++ /dev/null @@ -1,63 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor -** the names of its contributors may be used to endorse or promote -** products derived from this software without specific prior written -** permission. -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -//![0] -//![3] -import QtQuick 2.0 -//![3] - -//![1] -Rectangle { - id: page - width: 500; height: 200 - color: "lightgray" -//![1] - -//![2] - Text { - id: helloText - text: "Hello world!" - y: 30 - anchors.horizontalCenter: page.horizontalCenter - font.pointSize: 24; font.bold: true - } -//![2] -} -//![0] diff --git a/examples/qml/tutorials/helloworld/tutorial2.qml b/examples/qml/tutorials/helloworld/tutorial2.qml deleted file mode 100644 index c5c045aace..0000000000 --- a/examples/qml/tutorials/helloworld/tutorial2.qml +++ /dev/null @@ -1,72 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor -** the names of its contributors may be used to endorse or promote -** products derived from this software without specific prior written -** permission. -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -//![0] -import QtQuick 2.0 - -Rectangle { - id: page - width: 500; height: 200 - color: "lightgray" - - Text { - id: helloText - text: "Hello world!" - y: 30 - anchors.horizontalCenter: page.horizontalCenter - font.pointSize: 24; font.bold: true - } - - Grid { - id: colorPicker - x: 4; anchors.bottom: page.bottom; anchors.bottomMargin: 4 - rows: 2; columns: 3; spacing: 3 - -//![1] - Cell { cellColor: "red"; onClicked: helloText.color = cellColor } -//![1] - Cell { cellColor: "green"; onClicked: helloText.color = cellColor } - Cell { cellColor: "blue"; onClicked: helloText.color = cellColor } - Cell { cellColor: "yellow"; onClicked: helloText.color = cellColor } - Cell { cellColor: "steelblue"; onClicked: helloText.color = cellColor } - Cell { cellColor: "black"; onClicked: helloText.color = cellColor } - } -} -//![0] diff --git a/examples/qml/tutorials/helloworld/tutorial3.qml b/examples/qml/tutorials/helloworld/tutorial3.qml deleted file mode 100644 index c804bfca1d..0000000000 --- a/examples/qml/tutorials/helloworld/tutorial3.qml +++ /dev/null @@ -1,91 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor -** the names of its contributors may be used to endorse or promote -** products derived from this software without specific prior written -** permission. -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -//![0] -import QtQuick 2.0 - -Rectangle { - id: page - width: 500; height: 200 - color: "lightgray" - - Text { - id: helloText - text: "Hello world!" - y: 30 - anchors.horizontalCenter: page.horizontalCenter - font.pointSize: 24; font.bold: true - -//![1] - MouseArea { id: mouseArea; anchors.fill: parent } -//![1] - -//![2] - states: State { - name: "down"; when: mouseArea.pressed == true - PropertyChanges { target: helloText; y: 160; rotation: 180; color: "red" } - } -//![2] - -//![3] - transitions: Transition { - from: ""; to: "down"; reversible: true - ParallelAnimation { - NumberAnimation { properties: "y,rotation"; duration: 500; easing.type: Easing.InOutQuad } - ColorAnimation { duration: 500 } - } - } -//![3] - } - - Grid { - id: colorPicker - x: 4; anchors.bottom: page.bottom; anchors.bottomMargin: 4 - rows: 2; columns: 3; spacing: 3 - - Cell { cellColor: "red"; onClicked: helloText.color = cellColor } - Cell { cellColor: "green"; onClicked: helloText.color = cellColor } - Cell { cellColor: "blue"; onClicked: helloText.color = cellColor } - Cell { cellColor: "yellow"; onClicked: helloText.color = cellColor } - Cell { cellColor: "steelblue"; onClicked: helloText.color = cellColor } - Cell { cellColor: "black"; onClicked: helloText.color = cellColor } - } -} -//![0] diff --git a/examples/qml/tutorials/samegame/samegame1/Block.qml b/examples/qml/tutorials/samegame/samegame1/Block.qml deleted file mode 100644 index 32ef8c2bba..0000000000 --- a/examples/qml/tutorials/samegame/samegame1/Block.qml +++ /dev/null @@ -1,53 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor -** the names of its contributors may be used to endorse or promote -** products derived from this software without specific prior written -** permission. -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -//![0] -import QtQuick 2.0 - -Item { - id: block - - Image { - id: img - anchors.fill: parent - source: "../shared/pics/redStone.png" - } -} -//![0] diff --git a/examples/qml/tutorials/samegame/samegame1/Button.qml b/examples/qml/tutorials/samegame/samegame1/Button.qml deleted file mode 100644 index 6d1d1268de..0000000000 --- a/examples/qml/tutorials/samegame/samegame1/Button.qml +++ /dev/null @@ -1,83 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor -** the names of its contributors may be used to endorse or promote -** products derived from this software without specific prior written -** permission. -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -//![0] -import QtQuick 2.0 - -Rectangle { - id: container - - property string text: "Button" - - signal clicked - - width: buttonLabel.width + 20; height: buttonLabel.height + 5 - border { width: 1; color: Qt.darker(activePalette.button) } - smooth: true - radius: 8 - - // color the button with a gradient - gradient: Gradient { - GradientStop { - position: 0.0 - color: { - if (mouseArea.pressed) - return activePalette.dark - else - return activePalette.light - } - } - GradientStop { position: 1.0; color: activePalette.button } - } - - MouseArea { - id: mouseArea - anchors.fill: parent - onClicked: container.clicked(); - } - - Text { - id: buttonLabel - anchors.centerIn: container - color: activePalette.buttonText - text: container.text - } -} -//![0] diff --git a/examples/qml/tutorials/samegame/samegame1/samegame.qml b/examples/qml/tutorials/samegame/samegame1/samegame.qml deleted file mode 100644 index 73e2cc31fd..0000000000 --- a/examples/qml/tutorials/samegame/samegame1/samegame.qml +++ /dev/null @@ -1,82 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor -** the names of its contributors may be used to endorse or promote -** products derived from this software without specific prior written -** permission. -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -//![0] -import QtQuick 2.0 - -Rectangle { - id: screen - - width: 490; height: 720 - - SystemPalette { id: activePalette } - - Item { - width: parent.width - anchors { top: parent.top; bottom: toolBar.top } - - Image { - id: background - anchors.fill: parent - source: "../shared/pics/background.jpg" - fillMode: Image.PreserveAspectCrop - } - } - - Rectangle { - id: toolBar - width: parent.width; height: 30 - color: activePalette.window - anchors.bottom: screen.bottom - - Button { - anchors { left: parent.left; verticalCenter: parent.verticalCenter } - text: "New Game" - onClicked: console.log("This doesn't do anything yet...") - } - - Text { - id: score - anchors { right: parent.right; verticalCenter: parent.verticalCenter } - text: "Score: Who knows?" - } - } -} -//![0] diff --git a/examples/qml/tutorials/samegame/samegame1/samegame1.qmlproject b/examples/qml/tutorials/samegame/samegame1/samegame1.qmlproject deleted file mode 100644 index 42ffacf4f8..0000000000 --- a/examples/qml/tutorials/samegame/samegame1/samegame1.qmlproject +++ /dev/null @@ -1,16 +0,0 @@ -import QmlProject 1.1 - -Project { - mainFile: "samegame.qml" - - /* Include .qml, .js, and image files from current directory and subdirectories */ - QmlFiles { - directory: "." - } - JavaScriptFiles { - directory: "." - } - ImageFiles { - directory: "." - } -} diff --git a/examples/qml/tutorials/samegame/samegame2/Block.qml b/examples/qml/tutorials/samegame/samegame2/Block.qml deleted file mode 100644 index 8056b39480..0000000000 --- a/examples/qml/tutorials/samegame/samegame2/Block.qml +++ /dev/null @@ -1,51 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor -** the names of its contributors may be used to endorse or promote -** products derived from this software without specific prior written -** permission. -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.0 - -Item { - id: block - - Image { - id: img - anchors.fill: parent - source: "../shared/pics/redStone.png" - } -} diff --git a/examples/qml/tutorials/samegame/samegame2/Button.qml b/examples/qml/tutorials/samegame/samegame2/Button.qml deleted file mode 100644 index 248c20cf0f..0000000000 --- a/examples/qml/tutorials/samegame/samegame2/Button.qml +++ /dev/null @@ -1,81 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor -** the names of its contributors may be used to endorse or promote -** products derived from this software without specific prior written -** permission. -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.0 - -Rectangle { - id: container - - property string text: "Button" - - signal clicked - - width: buttonLabel.width + 20; height: buttonLabel.height + 5 - border { width: 1; color: Qt.darker(activePalette.button) } - smooth: true - radius: 8 - - // color the button with a gradient - gradient: Gradient { - GradientStop { - position: 0.0 - color: { - if (mouseArea.pressed) - return activePalette.dark - else - return activePalette.light - } - } - GradientStop { position: 1.0; color: activePalette.button } - } - - MouseArea { - id: mouseArea - anchors.fill: parent - onClicked: container.clicked(); - } - - Text { - id: buttonLabel - anchors.centerIn: container - color: activePalette.buttonText - text: container.text - } -} diff --git a/examples/qml/tutorials/samegame/samegame2/samegame.js b/examples/qml/tutorials/samegame/samegame2/samegame.js deleted file mode 100644 index c749dc17b1..0000000000 --- a/examples/qml/tutorials/samegame/samegame2/samegame.js +++ /dev/null @@ -1,63 +0,0 @@ -//![0] -var blockSize = 40; -var maxColumn = 10; -var maxRow = 15; -var maxIndex = maxColumn * maxRow; -var board = new Array(maxIndex); -var component; - -//Index function used instead of a 2D array -function index(column, row) { - return column + (row * maxColumn); -} - -function startNewGame() { - //Delete blocks from previous game - for (var i = 0; i < maxIndex; i++) { - if (board[i] != null) - board[i].destroy(); - } - - //Calculate board size - maxColumn = Math.floor(background.width / blockSize); - maxRow = Math.floor(background.height / blockSize); - maxIndex = maxRow * maxColumn; - - //Initialize Board - board = new Array(maxIndex); - for (var column = 0; column < maxColumn; column++) { - for (var row = 0; row < maxRow; row++) { - board[index(column, row)] = null; - createBlock(column, row); - } - } -} - -function createBlock(column, row) { - if (component == null) - component = Qt.createComponent("Block.qml"); - - // Note that if Block.qml was not a local file, component.status would be - // Loading and we should wait for the component's statusChanged() signal to - // know when the file is downloaded and ready before calling createObject(). - if (component.status == Component.Ready) { - var dynamicObject = component.createObject(background); - if (dynamicObject == null) { - console.log("error creating block"); - console.log(component.errorString()); - return false; - } - dynamicObject.x = column * blockSize; - dynamicObject.y = row * blockSize; - dynamicObject.width = blockSize; - dynamicObject.height = blockSize; - board[index(column, row)] = dynamicObject; - } else { - console.log("error loading block component"); - console.log(component.errorString()); - return false; - } - return true; -} -//![0] - diff --git a/examples/qml/tutorials/samegame/samegame2/samegame.qml b/examples/qml/tutorials/samegame/samegame2/samegame.qml deleted file mode 100644 index c50010e97d..0000000000 --- a/examples/qml/tutorials/samegame/samegame2/samegame.qml +++ /dev/null @@ -1,85 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor -** the names of its contributors may be used to endorse or promote -** products derived from this software without specific prior written -** permission. -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.0 -//![2] -import "samegame.js" as SameGame -//![2] - -Rectangle { - id: screen - - width: 490; height: 720 - - SystemPalette { id: activePalette } - - Item { - width: parent.width - anchors { top: parent.top; bottom: toolBar.top } - - Image { - id: background - anchors.fill: parent - source: "../shared/pics/background.jpg" - fillMode: Image.PreserveAspectCrop - } - } - - Rectangle { - id: toolBar - width: parent.width; height: 32 - color: activePalette.window - anchors.bottom: screen.bottom - -//![1] - Button { - anchors { left: parent.left; verticalCenter: parent.verticalCenter } - text: "New Game" - onClicked: SameGame.startNewGame() - } -//![1] - - Text { - id: score - anchors { right: parent.right; verticalCenter: parent.verticalCenter } - text: "Score: Who knows?" - } - } -} diff --git a/examples/qml/tutorials/samegame/samegame2/samegame2.qmlproject b/examples/qml/tutorials/samegame/samegame2/samegame2.qmlproject deleted file mode 100644 index 42ffacf4f8..0000000000 --- a/examples/qml/tutorials/samegame/samegame2/samegame2.qmlproject +++ /dev/null @@ -1,16 +0,0 @@ -import QmlProject 1.1 - -Project { - mainFile: "samegame.qml" - - /* Include .qml, .js, and image files from current directory and subdirectories */ - QmlFiles { - directory: "." - } - JavaScriptFiles { - directory: "." - } - ImageFiles { - directory: "." - } -} diff --git a/examples/qml/tutorials/samegame/samegame3/Block.qml b/examples/qml/tutorials/samegame/samegame3/Block.qml deleted file mode 100644 index 9c41048fcb..0000000000 --- a/examples/qml/tutorials/samegame/samegame3/Block.qml +++ /dev/null @@ -1,63 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor -** the names of its contributors may be used to endorse or promote -** products derived from this software without specific prior written -** permission. -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -//![0] -import QtQuick 2.0 - -Item { - id: block - - property int type: 0 - - Image { - id: img - - anchors.fill: parent - source: { - if (type == 0) - return "../shared/pics/redStone.png"; - else if (type == 1) - return "../shared/pics/blueStone.png"; - else - return "../shared/pics/greenStone.png"; - } - } -} -//![0] diff --git a/examples/qml/tutorials/samegame/samegame3/Button.qml b/examples/qml/tutorials/samegame/samegame3/Button.qml deleted file mode 100644 index 248c20cf0f..0000000000 --- a/examples/qml/tutorials/samegame/samegame3/Button.qml +++ /dev/null @@ -1,81 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor -** the names of its contributors may be used to endorse or promote -** products derived from this software without specific prior written -** permission. -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.0 - -Rectangle { - id: container - - property string text: "Button" - - signal clicked - - width: buttonLabel.width + 20; height: buttonLabel.height + 5 - border { width: 1; color: Qt.darker(activePalette.button) } - smooth: true - radius: 8 - - // color the button with a gradient - gradient: Gradient { - GradientStop { - position: 0.0 - color: { - if (mouseArea.pressed) - return activePalette.dark - else - return activePalette.light - } - } - GradientStop { position: 1.0; color: activePalette.button } - } - - MouseArea { - id: mouseArea - anchors.fill: parent - onClicked: container.clicked(); - } - - Text { - id: buttonLabel - anchors.centerIn: container - color: activePalette.buttonText - text: container.text - } -} diff --git a/examples/qml/tutorials/samegame/samegame3/Dialog.qml b/examples/qml/tutorials/samegame/samegame3/Dialog.qml deleted file mode 100644 index df1fa37d6a..0000000000 --- a/examples/qml/tutorials/samegame/samegame3/Dialog.qml +++ /dev/null @@ -1,71 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor -** the names of its contributors may be used to endorse or promote -** products derived from this software without specific prior written -** permission. -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -//![0] -import QtQuick 2.0 - -Rectangle { - id: container - - function show(text) { - dialogText.text = text; - container.opacity = 1; - } - - function hide() { - container.opacity = 0; - } - - width: dialogText.width + 20 - height: dialogText.height + 20 - opacity: 0 - - Text { - id: dialogText - anchors.centerIn: parent - text: "" - } - - MouseArea { - anchors.fill: parent - onClicked: hide(); - } -} -//![0] diff --git a/examples/qml/tutorials/samegame/samegame3/samegame.js b/examples/qml/tutorials/samegame/samegame3/samegame.js deleted file mode 100644 index df5bdfb049..0000000000 --- a/examples/qml/tutorials/samegame/samegame3/samegame.js +++ /dev/null @@ -1,174 +0,0 @@ -/* This script file handles the game logic */ -var maxColumn = 10; -var maxRow = 15; -var maxIndex = maxColumn * maxRow; -var board = new Array(maxIndex); -var component; - -//Index function used instead of a 2D array -function index(column, row) { - return column + (row * maxColumn); -} - -function startNewGame() { - //Calculate board size - maxColumn = Math.floor(gameCanvas.width / gameCanvas.blockSize); - maxRow = Math.floor(gameCanvas.height / gameCanvas.blockSize); - maxIndex = maxRow * maxColumn; - - //Close dialogs - dialog.hide(); - - //Initialize Board - board = new Array(maxIndex); - gameCanvas.score = 0; - for (var column = 0; column < maxColumn; column++) { - for (var row = 0; row < maxRow; row++) { - board[index(column, row)] = null; - createBlock(column, row); - } - } -} - -function createBlock(column, row) { - if (component == null) - component = Qt.createComponent("Block.qml"); - - // Note that if Block.qml was not a local file, component.status would be - // Loading and we should wait for the component's statusChanged() signal to - // know when the file is downloaded and ready before calling createObject(). - if (component.status == Component.Ready) { - var dynamicObject = component.createObject(gameCanvas); - if (dynamicObject == null) { - console.log("error creating block"); - console.log(component.errorString()); - return false; - } - dynamicObject.type = Math.floor(Math.random() * 3); - dynamicObject.x = column * gameCanvas.blockSize; - dynamicObject.y = row * gameCanvas.blockSize; - dynamicObject.width = gameCanvas.blockSize; - dynamicObject.height = gameCanvas.blockSize; - board[index(column, row)] = dynamicObject; - } else { - console.log("error loading block component"); - console.log(component.errorString()); - return false; - } - return true; -} - -var fillFound; //Set after a floodFill call to the number of blocks found -var floodBoard; //Set to 1 if the floodFill reaches off that node - -//![1] -function handleClick(xPos, yPos) { - var column = Math.floor(xPos / gameCanvas.blockSize); - var row = Math.floor(yPos / gameCanvas.blockSize); - if (column >= maxColumn || column < 0 || row >= maxRow || row < 0) - return; - if (board[index(column, row)] == null) - return; - //If it's a valid block, remove it and all connected (does nothing if it's not connected) - floodFill(column, row, -1); - if (fillFound <= 0) - return; - gameCanvas.score += (fillFound - 1) * (fillFound - 1); - shuffleDown(); - victoryCheck(); -} -//![1] - -function floodFill(column, row, type) { - if (board[index(column, row)] == null) - return; - var first = false; - if (type == -1) { - first = true; - type = board[index(column, row)].type; - - //Flood fill initialization - fillFound = 0; - floodBoard = new Array(maxIndex); - } - if (column >= maxColumn || column < 0 || row >= maxRow || row < 0) - return; - if (floodBoard[index(column, row)] == 1 || (!first && type != board[index(column, row)].type)) - return; - floodBoard[index(column, row)] = 1; - floodFill(column + 1, row, type); - floodFill(column - 1, row, type); - floodFill(column, row + 1, type); - floodFill(column, row - 1, type); - if (first == true && fillFound == 0) - return; //Can't remove single blocks - board[index(column, row)].opacity = 0; - board[index(column, row)] = null; - fillFound += 1; -} - -function shuffleDown() { - //Fall down - for (var column = 0; column < maxColumn; column++) { - var fallDist = 0; - for (var row = maxRow - 1; row >= 0; row--) { - if (board[index(column, row)] == null) { - fallDist += 1; - } else { - if (fallDist > 0) { - var obj = board[index(column, row)]; - obj.y += fallDist * gameCanvas.blockSize; - board[index(column, row + fallDist)] = obj; - board[index(column, row)] = null; - } - } - } - } - //Fall to the left - var fallDist = 0; - for (var column = 0; column < maxColumn; column++) { - if (board[index(column, maxRow - 1)] == null) { - fallDist += 1; - } else { - if (fallDist > 0) { - for (var row = 0; row < maxRow; row++) { - var obj = board[index(column, row)]; - if (obj == null) - continue; - obj.x -= fallDist * gameCanvas.blockSize; - board[index(column - fallDist, row)] = obj; - board[index(column, row)] = null; - } - } - } - } -} - -//![2] -function victoryCheck() { - //Award bonus points if no blocks left - var deservesBonus = true; - for (var column = maxColumn - 1; column >= 0; column--) - if (board[index(column, maxRow - 1)] != null) - deservesBonus = false; - if (deservesBonus) - gameCanvas.score += 500; - - //Check whether game has finished - if (deservesBonus || !(floodMoveCheck(0, maxRow - 1, -1))) - dialog.show("Game Over. Your score is " + gameCanvas.score); -} -//![2] - -//only floods up and right, to see if it can find adjacent same-typed blocks -function floodMoveCheck(column, row, type) { - if (column >= maxColumn || column < 0 || row >= maxRow || row < 0) - return false; - if (board[index(column, row)] == null) - return false; - var myType = board[index(column, row)].type; - if (type == myType) - return true; - return floodMoveCheck(column + 1, row, myType) || floodMoveCheck(column, row - 1, board[index(column, row)].type); -} - diff --git a/examples/qml/tutorials/samegame/samegame3/samegame.qml b/examples/qml/tutorials/samegame/samegame3/samegame.qml deleted file mode 100644 index f14829ef63..0000000000 --- a/examples/qml/tutorials/samegame/samegame3/samegame.qml +++ /dev/null @@ -1,109 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor -** the names of its contributors may be used to endorse or promote -** products derived from this software without specific prior written -** permission. -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -//![0] -import QtQuick 2.0 -import "samegame.js" as SameGame - -Rectangle { - id: screen - - width: 490; height: 720 - - SystemPalette { id: activePalette } - - Item { - width: parent.width - anchors { top: parent.top; bottom: toolBar.top } - - Image { - id: background - anchors.fill: parent - source: "../shared/pics/background.jpg" - fillMode: Image.PreserveAspectCrop - } - -//![1] - Item { - id: gameCanvas - - property int score: 0 - property int blockSize: 40 - - width: parent.width - (parent.width % blockSize) - height: parent.height - (parent.height % blockSize) - anchors.centerIn: parent - - MouseArea { - anchors.fill: parent - onClicked: SameGame.handleClick(mouse.x, mouse.y) - } - } -//![1] - } - -//![2] - Dialog { - id: dialog - anchors.centerIn: parent - z: 100 - } -//![2] - - Rectangle { - id: toolBar - width: parent.width; height: 30 - color: activePalette.window - anchors.bottom: screen.bottom - - Button { - anchors { left: parent.left; verticalCenter: parent.verticalCenter } - text: "New Game" - onClicked: SameGame.startNewGame() - } - - Text { - id: score - anchors { right: parent.right; verticalCenter: parent.verticalCenter } - text: "Score: Who knows?" - } - } -} -//![0] diff --git a/examples/qml/tutorials/samegame/samegame3/samegame3.qmlproject b/examples/qml/tutorials/samegame/samegame3/samegame3.qmlproject deleted file mode 100644 index 42ffacf4f8..0000000000 --- a/examples/qml/tutorials/samegame/samegame3/samegame3.qmlproject +++ /dev/null @@ -1,16 +0,0 @@ -import QmlProject 1.1 - -Project { - mainFile: "samegame.qml" - - /* Include .qml, .js, and image files from current directory and subdirectories */ - QmlFiles { - directory: "." - } - JavaScriptFiles { - directory: "." - } - ImageFiles { - directory: "." - } -} diff --git a/examples/qml/tutorials/samegame/samegame4/content/BoomBlock.qml b/examples/qml/tutorials/samegame/samegame4/content/BoomBlock.qml deleted file mode 100644 index 3786b9c0d1..0000000000 --- a/examples/qml/tutorials/samegame/samegame4/content/BoomBlock.qml +++ /dev/null @@ -1,122 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor -** the names of its contributors may be used to endorse or promote -** products derived from this software without specific prior written -** permission. -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.0 -import Qt.labs.particles 1.0 - -Item { - id: block - - property int type: 0 - property bool dying: false - - //![1] - property bool spawned: false - - Behavior on x { - enabled: spawned; - SpringAnimation{ spring: 2; damping: 0.2 } - } - Behavior on y { - SpringAnimation{ spring: 2; damping: 0.2 } - } - //![1] - - //![2] - Image { - id: img - - anchors.fill: parent - source: { - if (type == 0) - return "../../shared/pics/redStone.png"; - else if (type == 1) - return "../../shared/pics/blueStone.png"; - else - return "../../shared/pics/greenStone.png"; - } - opacity: 0 - - Behavior on opacity { - NumberAnimation { properties:"opacity"; duration: 200 } - } - } - //![2] - - //![3] - Particles { - id: particles - - width: 1; height: 1 - anchors.centerIn: parent - - emissionRate: 0 - lifeSpan: 700; lifeSpanDeviation: 600 - angle: 0; angleDeviation: 360; - velocity: 100; velocityDeviation: 30 - source: { - if (type == 0) - return "../../shared/pics/redStar.png"; - else if (type == 1) - return "../../shared/pics/blueStar.png"; - else - return "../../shared/pics/greenStar.png"; - } - } - //![3] - - //![4] - states: [ - State { - name: "AliveState" - when: spawned == true && dying == false - PropertyChanges { target: img; opacity: 1 } - }, - - State { - name: "DeathState" - when: dying == true - StateChangeScript { script: particles.burst(50); } - PropertyChanges { target: img; opacity: 0 } - StateChangeScript { script: block.destroy(1000); } - } - ] - //![4] -} diff --git a/examples/qml/tutorials/samegame/samegame4/content/Button.qml b/examples/qml/tutorials/samegame/samegame4/content/Button.qml deleted file mode 100644 index 248c20cf0f..0000000000 --- a/examples/qml/tutorials/samegame/samegame4/content/Button.qml +++ /dev/null @@ -1,81 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor -** the names of its contributors may be used to endorse or promote -** products derived from this software without specific prior written -** permission. -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.0 - -Rectangle { - id: container - - property string text: "Button" - - signal clicked - - width: buttonLabel.width + 20; height: buttonLabel.height + 5 - border { width: 1; color: Qt.darker(activePalette.button) } - smooth: true - radius: 8 - - // color the button with a gradient - gradient: Gradient { - GradientStop { - position: 0.0 - color: { - if (mouseArea.pressed) - return activePalette.dark - else - return activePalette.light - } - } - GradientStop { position: 1.0; color: activePalette.button } - } - - MouseArea { - id: mouseArea - anchors.fill: parent - onClicked: container.clicked(); - } - - Text { - id: buttonLabel - anchors.centerIn: container - color: activePalette.buttonText - text: container.text - } -} diff --git a/examples/qml/tutorials/samegame/samegame4/content/Dialog.qml b/examples/qml/tutorials/samegame/samegame4/content/Dialog.qml deleted file mode 100644 index 984b3ddb6a..0000000000 --- a/examples/qml/tutorials/samegame/samegame4/content/Dialog.qml +++ /dev/null @@ -1,107 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor -** the names of its contributors may be used to endorse or promote -** products derived from this software without specific prior written -** permission. -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.0 - -//![0] -Rectangle { - id: container -//![0] - -//![1] - property string inputText: textInput.text - signal closed - - function show(text) { - dialogText.text = text; - container.opacity = 1; - textInput.opacity = 0; - } - - function showWithInput(text) { - show(text); - textInput.opacity = 1; - textInput.focus = true; - textInput.text = "" - } - - function hide() { - textInput.focus = false; - container.opacity = 0; - container.closed(); - } -//![1] - - width: dialogText.width + textInput.width + 20 - height: dialogText.height + 20 - opacity: 0 - visible: opacity > 0 - - Text { - id: dialogText - anchors { verticalCenter: parent.verticalCenter; left: parent.left; leftMargin: 10 } - text: "" - } - -//![2] - TextInput { - id: textInput - anchors { verticalCenter: parent.verticalCenter; left: dialogText.right } - width: 80 - text: "" - - onAccepted: container.hide() // close dialog when Enter is pressed - } -//![2] - - MouseArea { - anchors.fill: parent - - onClicked: { - if (textInput.text == "" && textInput.opacity > 0) - textInput.openSoftwareInputPanel(); - else - hide(); - } - } - -//![3] -} -//![3] diff --git a/examples/qml/tutorials/samegame/samegame4/content/samegame.js b/examples/qml/tutorials/samegame/samegame4/content/samegame.js deleted file mode 100755 index 7bb7243914..0000000000 --- a/examples/qml/tutorials/samegame/samegame4/content/samegame.js +++ /dev/null @@ -1,226 +0,0 @@ -/* This script file handles the game logic */ -.import QtQuick.LocalStorage 2.0 as Sql - -var maxColumn = 10; -var maxRow = 15; -var maxIndex = maxColumn * maxRow; -var board = new Array(maxIndex); -var component; -var scoresURL = ""; -var gameDuration; - -//Index function used instead of a 2D array -function index(column, row) { - return column + (row * maxColumn); -} - -function startNewGame() { - //Delete blocks from previous game - for (var i = 0; i < maxIndex; i++) { - if (board[i] != null) - board[i].destroy(); - } - - //Calculate board size - maxColumn = Math.floor(gameCanvas.width / gameCanvas.blockSize); - maxRow = Math.floor(gameCanvas.height / gameCanvas.blockSize); - maxIndex = maxRow * maxColumn; - - //Close dialogs - nameInputDialog.hide(); - dialog.hide(); - - //Initialize Board - board = new Array(maxIndex); - gameCanvas.score = 0; - for (var column = 0; column < maxColumn; column++) { - for (var row = 0; row < maxRow; row++) { - board[index(column, row)] = null; - createBlock(column, row); - } - } - - gameDuration = new Date(); -} - -function createBlock(column, row) { - if (component == null) - component = Qt.createComponent("content/BoomBlock.qml"); - - // Note that if Block.qml was not a local file, component.status would be - // Loading and we should wait for the component's statusChanged() signal to - // know when the file is downloaded and ready before calling createObject(). - if (component.status == Component.Ready) { - var dynamicObject = component.createObject(gameCanvas); - if (dynamicObject == null) { - console.log("error creating block"); - console.log(component.errorString()); - return false; - } - dynamicObject.type = Math.floor(Math.random() * 3); - dynamicObject.x = column * gameCanvas.blockSize; - dynamicObject.y = row * gameCanvas.blockSize; - dynamicObject.width = gameCanvas.blockSize; - dynamicObject.height = gameCanvas.blockSize; - dynamicObject.spawned = true; - board[index(column, row)] = dynamicObject; - } else { - console.log("error loading block component"); - console.log(component.errorString()); - return false; - } - return true; -} - -var fillFound; //Set after a floodFill call to the number of blocks found -var floodBoard; //Set to 1 if the floodFill reaches off that node - -function handleClick(xPos, yPos) { - var column = Math.floor(xPos / gameCanvas.blockSize); - var row = Math.floor(yPos / gameCanvas.blockSize); - if (column >= maxColumn || column < 0 || row >= maxRow || row < 0) - return; - if (board[index(column, row)] == null) - return; - //If it's a valid block, remove it and all connected (does nothing if it's not connected) - floodFill(column, row, -1); - if (fillFound <= 0) - return; - gameCanvas.score += (fillFound - 1) * (fillFound - 1); - shuffleDown(); - victoryCheck(); -} - -function floodFill(column, row, type) { - if (board[index(column, row)] == null) - return; - var first = false; - if (type == -1) { - first = true; - type = board[index(column, row)].type; - - //Flood fill initialization - fillFound = 0; - floodBoard = new Array(maxIndex); - } - if (column >= maxColumn || column < 0 || row >= maxRow || row < 0) - return; - if (floodBoard[index(column, row)] == 1 || (!first && type != board[index(column, row)].type)) - return; - floodBoard[index(column, row)] = 1; - floodFill(column + 1, row, type); - floodFill(column - 1, row, type); - floodFill(column, row + 1, type); - floodFill(column, row - 1, type); - if (first == true && fillFound == 0) - return; //Can't remove single blocks - board[index(column, row)].dying = true; - board[index(column, row)] = null; - fillFound += 1; -} - -function shuffleDown() { - //Fall down - for (var column = 0; column < maxColumn; column++) { - var fallDist = 0; - for (var row = maxRow - 1; row >= 0; row--) { - if (board[index(column, row)] == null) { - fallDist += 1; - } else { - if (fallDist > 0) { - var obj = board[index(column, row)]; - obj.y = (row + fallDist) * gameCanvas.blockSize; - board[index(column, row + fallDist)] = obj; - board[index(column, row)] = null; - } - } - } - } - //Fall to the left - fallDist = 0; - for (column = 0; column < maxColumn; column++) { - if (board[index(column, maxRow - 1)] == null) { - fallDist += 1; - } else { - if (fallDist > 0) { - for (row = 0; row < maxRow; row++) { - obj = board[index(column, row)]; - if (obj == null) - continue; - obj.x = (column - fallDist) * gameCanvas.blockSize; - board[index(column - fallDist, row)] = obj; - board[index(column, row)] = null; - } - } - } - } -} - -//![3] -function victoryCheck() { -//![3] - //Award bonus points if no blocks left - var deservesBonus = true; - for (var column = maxColumn - 1; column >= 0; column--) - if (board[index(column, maxRow - 1)] != null) - deservesBonus = false; - if (deservesBonus) - gameCanvas.score += 500; - -//![4] - //Check whether game has finished - if (deservesBonus || !(floodMoveCheck(0, maxRow - 1, -1))) { - gameDuration = new Date() - gameDuration; - nameInputDialog.showWithInput("You won! Please enter your name: "); - } -} -//![4] - -//only floods up and right, to see if it can find adjacent same-typed blocks -function floodMoveCheck(column, row, type) { - if (column >= maxColumn || column < 0 || row >= maxRow || row < 0) - return false; - if (board[index(column, row)] == null) - return false; - var myType = board[index(column, row)].type; - if (type == myType) - return true; - return floodMoveCheck(column + 1, row, myType) || floodMoveCheck(column, row - 1, board[index(column, row)].type); -} - -//![2] -function saveHighScore(name) { - if (scoresURL != "") - sendHighScore(name); - - var db = Sql.openDatabaseSync("SameGameScores", "1.0", "Local SameGame High Scores", 100); - var dataStr = "INSERT INTO Scores VALUES(?, ?, ?, ?)"; - var data = [name, gameCanvas.score, maxColumn + "x" + maxRow, Math.floor(gameDuration / 1000)]; - db.transaction(function(tx) { - tx.executeSql('CREATE TABLE IF NOT EXISTS Scores(name TEXT, score NUMBER, gridSize TEXT, time NUMBER)'); - tx.executeSql(dataStr, data); - - var rs = tx.executeSql('SELECT * FROM Scores WHERE gridSize = "12x17" ORDER BY score desc LIMIT 10'); - var r = "\nHIGH SCORES for a standard sized grid\n\n" - for (var i = 0; i < rs.rows.length; i++) { - r += (i + 1) + ". " + rs.rows.item(i).name + ' got ' + rs.rows.item(i).score + ' points in ' + rs.rows.item(i).time + ' seconds.\n'; - } - dialog.show(r); - }); -} -//![2] - -//![1] -function sendHighScore(name) { - var postman = new XMLHttpRequest() - var postData = "name=" + name + "&score=" + gameCanvas.score + "&gridSize=" + maxColumn + "x" + maxRow + "&time=" + Math.floor(gameDuration / 1000); - postman.open("POST", scoresURL, true); - postman.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); - postman.onreadystatechange = function() { - if (postman.readyState == postman.DONE) { - dialog.show("Your score has been uploaded."); - } - } - postman.send(postData); -} -//![1] diff --git a/examples/qml/tutorials/samegame/samegame4/highscores/README b/examples/qml/tutorials/samegame/samegame4/highscores/README deleted file mode 100644 index eaa00fae37..0000000000 --- a/examples/qml/tutorials/samegame/samegame4/highscores/README +++ /dev/null @@ -1 +0,0 @@ -The SameGame example can interface with a simple PHP script to store XML high score data on a remote server. We do not have a publically accessible server available for this use, but if you have access to a PHP capable webserver you can copy the files (score_data.xml, score.php, score_style.xsl) to it and alter the highscore_server variable at the top of the samegame.js file to point to it. diff --git a/examples/qml/tutorials/samegame/samegame4/highscores/score_data.xml b/examples/qml/tutorials/samegame/samegame4/highscores/score_data.xml deleted file mode 100755 index c3fd90d9cf..0000000000 --- a/examples/qml/tutorials/samegame/samegame4/highscores/score_data.xml +++ /dev/null @@ -1,2 +0,0 @@ -1000000Alan the Tester0x00 -6213Alan12x1751 diff --git a/examples/qml/tutorials/samegame/samegame4/highscores/score_style.xsl b/examples/qml/tutorials/samegame/samegame4/highscores/score_style.xsl deleted file mode 100755 index 670354c965..0000000000 --- a/examples/qml/tutorials/samegame/samegame4/highscores/score_style.xsl +++ /dev/null @@ -1,28 +0,0 @@ - - - - - SameGame High Scores - -

SameGame High Scores

- - - - - - - - - - - - - - - - -
NameScoreGrid SizeTime, s
- - -
-
diff --git a/examples/qml/tutorials/samegame/samegame4/highscores/scores.php b/examples/qml/tutorials/samegame/samegame4/highscores/scores.php deleted file mode 100755 index daf480e21b..0000000000 --- a/examples/qml/tutorials/samegame/samegame4/highscores/scores.php +++ /dev/null @@ -1,31 +0,0 @@ -"; - echo "SameGame High Scores"; - if($score > 0){#Sending in a new high score - $name = $_POST["name"]; - $grid = $_POST["gridSize"]; - $time = $_POST["time"]; - if($name == "") - $name = "Anonymous"; - $file = fopen("score_data.xml", "a"); - $ret = fwrite($file, "". $score . "" - . $name . "" . $grid . "" - . $time . "\n"); - echo "Your score has been recorded. Thanks for playing!"; - if($ret == False) - echo "
There was an error though, so don't expect to see that score again."; - }else{#Read high score list - #Now uses XSLT to display. So just print the file. With XML cruft added. - #Note that firefox at least won't apply the XSLT on a php file. So redirecting - $file = fopen("scores.xml", "w"); - $ret = fwrite($file, '' . "\n" - . '' . "\n" - . "\n" . file_get_contents("score_data.xml") . "\n"); - if($ret == False) - echo "There was an internal error. Sorry."; - else - echo ''; - } - echo ""; -?> diff --git a/examples/qml/tutorials/samegame/samegame4/samegame.qml b/examples/qml/tutorials/samegame/samegame4/samegame.qml deleted file mode 100644 index c21b8de8bd..0000000000 --- a/examples/qml/tutorials/samegame/samegame4/samegame.qml +++ /dev/null @@ -1,115 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor -** the names of its contributors may be used to endorse or promote -** products derived from this software without specific prior written -** permission. -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.0 -import "content" -import "content/samegame.js" as SameGame - -Rectangle { - id: screen - - width: 490; height: 720 - - SystemPalette { id: activePalette } - - Item { - width: parent.width - anchors { top: parent.top; bottom: toolBar.top } - - Image { - id: background - anchors.fill: parent - source: "../shared/pics/background.jpg" - fillMode: Image.PreserveAspectCrop - } - - Item { - id: gameCanvas - property int score: 0 - property int blockSize: 40 - - anchors.centerIn: parent - width: parent.width - (parent.width % blockSize); - height: parent.height - (parent.height % blockSize); - - MouseArea { - anchors.fill: parent; onClicked: SameGame.handleClick(mouse.x,mouse.y); - } - } - } - - Dialog { - id: dialog - anchors.centerIn: parent - z: 100 - } - - //![0] - Dialog { - id: nameInputDialog - anchors.centerIn: parent - z: 100 - - onClosed: { - if (nameInputDialog.inputText != "") - SameGame.saveHighScore(nameInputDialog.inputText); - } - } - //![0] - - Rectangle { - id: toolBar - width: parent.width; height: 30 - color: activePalette.window - anchors.bottom: screen.bottom - - Button { - anchors { left: parent.left; verticalCenter: parent.verticalCenter } - text: "New Game" - onClicked: SameGame.startNewGame() - } - - Text { - id: score - anchors { right: parent.right; verticalCenter: parent.verticalCenter } - text: "Score: " + gameCanvas.score - } - } -} diff --git a/examples/qml/tutorials/samegame/samegame4/samegame4.qmlproject b/examples/qml/tutorials/samegame/samegame4/samegame4.qmlproject deleted file mode 100644 index 42ffacf4f8..0000000000 --- a/examples/qml/tutorials/samegame/samegame4/samegame4.qmlproject +++ /dev/null @@ -1,16 +0,0 @@ -import QmlProject 1.1 - -Project { - mainFile: "samegame.qml" - - /* Include .qml, .js, and image files from current directory and subdirectories */ - QmlFiles { - directory: "." - } - JavaScriptFiles { - directory: "." - } - ImageFiles { - directory: "." - } -} diff --git a/examples/qml/tutorials/samegame/shared/pics/background.jpg b/examples/qml/tutorials/samegame/shared/pics/background.jpg deleted file mode 100644 index 903d395c8d..0000000000 Binary files a/examples/qml/tutorials/samegame/shared/pics/background.jpg and /dev/null differ diff --git a/examples/qml/tutorials/samegame/shared/pics/blueStar.png b/examples/qml/tutorials/samegame/shared/pics/blueStar.png deleted file mode 100644 index ff9588f80a..0000000000 Binary files a/examples/qml/tutorials/samegame/shared/pics/blueStar.png and /dev/null differ diff --git a/examples/qml/tutorials/samegame/shared/pics/blueStone.png b/examples/qml/tutorials/samegame/shared/pics/blueStone.png deleted file mode 100644 index 20e43c75b6..0000000000 Binary files a/examples/qml/tutorials/samegame/shared/pics/blueStone.png and /dev/null differ diff --git a/examples/qml/tutorials/samegame/shared/pics/greenStar.png b/examples/qml/tutorials/samegame/shared/pics/greenStar.png deleted file mode 100644 index cd06854719..0000000000 Binary files a/examples/qml/tutorials/samegame/shared/pics/greenStar.png and /dev/null differ diff --git a/examples/qml/tutorials/samegame/shared/pics/greenStone.png b/examples/qml/tutorials/samegame/shared/pics/greenStone.png deleted file mode 100644 index b568a1900c..0000000000 Binary files a/examples/qml/tutorials/samegame/shared/pics/greenStone.png and /dev/null differ diff --git a/examples/qml/tutorials/samegame/shared/pics/redStar.png b/examples/qml/tutorials/samegame/shared/pics/redStar.png deleted file mode 100644 index 0a4dffe583..0000000000 Binary files a/examples/qml/tutorials/samegame/shared/pics/redStar.png and /dev/null differ diff --git a/examples/qml/tutorials/samegame/shared/pics/redStone.png b/examples/qml/tutorials/samegame/shared/pics/redStone.png deleted file mode 100644 index 36b09a2686..0000000000 Binary files a/examples/qml/tutorials/samegame/shared/pics/redStone.png and /dev/null differ diff --git a/examples/qml/tutorials/samegame/shared/pics/star.png b/examples/qml/tutorials/samegame/shared/pics/star.png deleted file mode 100644 index defbde53ca..0000000000 Binary files a/examples/qml/tutorials/samegame/shared/pics/star.png and /dev/null differ diff --git a/examples/qml/tutorials/samegame/shared/pics/yellowStone.png b/examples/qml/tutorials/samegame/shared/pics/yellowStone.png deleted file mode 100644 index b1ce76212c..0000000000 Binary files a/examples/qml/tutorials/samegame/shared/pics/yellowStone.png and /dev/null differ diff --git a/examples/qml/tutorials/tutorials.pro b/examples/qml/tutorials/tutorials.pro deleted file mode 100644 index 0a82c1e704..0000000000 --- a/examples/qml/tutorials/tutorials.pro +++ /dev/null @@ -1,5 +0,0 @@ -TEMPLATE = subdirs - -SUBDIRS += \ - extending - diff --git a/examples/qml/tutorials/tutorials.qmlproject b/examples/qml/tutorials/tutorials.qmlproject deleted file mode 100644 index 2bb4016996..0000000000 --- a/examples/qml/tutorials/tutorials.qmlproject +++ /dev/null @@ -1,14 +0,0 @@ -import QmlProject 1.0 - -Project { - /* Include .qml, .js, and image files from current directory and subdirectories */ - QmlFiles { - directory: "." - } - JavaScriptFiles { - directory: "." - } - ImageFiles { - directory: "." - } -} -- cgit v1.2.3