From d1813c1341608ec3c087e6cfd7da433f05799747 Mon Sep 17 00:00:00 2001 From: Bea Lam Date: Fri, 18 Jun 2010 13:06:32 +1000 Subject: Spelling fix --- examples/declarative/i18n/i18n.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/declarative/i18n/i18n.qml b/examples/declarative/i18n/i18n.qml index 7bbb19c..5c2702c 100644 --- a/examples/declarative/i18n/i18n.qml +++ b/examples/declarative/i18n/i18n.qml @@ -65,7 +65,7 @@ Rectangle { anchors.fill: parent; spacing: 20 Text { - text: "If a translation is available for the system language (eg. French) then the string below will translated (eg. 'Bonjour'). Otherwise is will show 'Hello'." + text: "If a translation is available for the system language (eg. French) then the string below will translated (eg. 'Bonjour'). Otherwise it will show 'Hello'." width: parent.width; wrapMode: Text.WordWrap } -- cgit v0.12 From e3fd533e7c53106166f081122d8d3d71bb201ba9 Mon Sep 17 00:00:00 2001 From: Bea Lam Date: Fri, 18 Jun 2010 13:30:28 +1000 Subject: Rename example image file --- doc/src/declarative/pics/ListViewSections.png | Bin 5491 -> 0 bytes doc/src/images/qml-listview-sections-example.png | Bin 0 -> 5491 bytes src/declarative/graphicsitems/qdeclarativelistview.cpp | 2 +- 3 files changed, 1 insertion(+), 1 deletion(-) delete mode 100644 doc/src/declarative/pics/ListViewSections.png create mode 100644 doc/src/images/qml-listview-sections-example.png diff --git a/doc/src/declarative/pics/ListViewSections.png b/doc/src/declarative/pics/ListViewSections.png deleted file mode 100644 index 4e8f076..0000000 Binary files a/doc/src/declarative/pics/ListViewSections.png and /dev/null differ diff --git a/doc/src/images/qml-listview-sections-example.png b/doc/src/images/qml-listview-sections-example.png new file mode 100644 index 0000000..4e8f076 Binary files /dev/null and b/doc/src/images/qml-listview-sections-example.png differ diff --git a/src/declarative/graphicsitems/qdeclarativelistview.cpp b/src/declarative/graphicsitems/qdeclarativelistview.cpp index b0728c1..06a3239 100644 --- a/src/declarative/graphicsitems/qdeclarativelistview.cpp +++ b/src/declarative/graphicsitems/qdeclarativelistview.cpp @@ -1972,7 +1972,7 @@ void QDeclarativeListView::setCacheBuffer(int b) \snippet examples/declarative/modelviews/listview/sections.qml 0 - \image ListViewSections.png + \image qml-listview-sections-example.png \sa {declarative/modelviews/listview}{ListView examples} */ -- cgit v0.12 From d9e49c4399e506c878ce5125d4edcf384b867b26 Mon Sep 17 00:00:00 2001 From: Bea Lam Date: Fri, 18 Jun 2010 14:41:31 +1000 Subject: Rename example and add minor improvements --- .../touchinteraction/mousearea/mouse.qml | 87 ------------------ .../mousearea/mousearea-example.qml | 102 +++++++++++++++++++++ 2 files changed, 102 insertions(+), 87 deletions(-) delete mode 100644 examples/declarative/touchinteraction/mousearea/mouse.qml create mode 100644 examples/declarative/touchinteraction/mousearea/mousearea-example.qml diff --git a/examples/declarative/touchinteraction/mousearea/mouse.qml b/examples/declarative/touchinteraction/mousearea/mouse.qml deleted file mode 100644 index 9d2ace3..0000000 --- a/examples/declarative/touchinteraction/mousearea/mouse.qml +++ /dev/null @@ -1,87 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module 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 Qt 4.7 - -Rectangle { - width: 200; height: 200 - - Rectangle { - width: 50; height: 50 - color: "red" - - Text { text: "Click"; anchors.centerIn: parent } - - MouseArea { - anchors.fill: parent - hoverEnabled: true - acceptedButtons: Qt.LeftButton | Qt.RightButton - - onPressed: console.log('press (x: ' + mouse.x + ' y: ' + mouse.y + ' button: ' + (mouse.button == Qt.RightButton ? 'right' : 'left') + ' Shift: ' + (mouse.modifiers & Qt.ShiftModifier ? 'true' : 'false') + ')') - onReleased: console.log('release (x: ' + mouse.x + ' y: ' + mouse.y + ' isClick: ' + mouse.isClick + ' wasHeld: ' + mouse.wasHeld + ')') - onClicked: console.log('click (x: ' + mouse.x + ' y: ' + mouse.y + ' wasHeld: ' + mouse.wasHeld + ')') - onDoubleClicked: console.log('double click (x: ' + mouse.x + ' y: ' + mouse.y + ')') - onPressAndHold: console.log('press and hold') - onEntered: console.log('entered ' + pressed) - onExited: console.log('exited ' + pressed) - } - } - - Rectangle { - y: 100; width: 50; height: 50 - color: "blue" - - Text { text: "Drag"; anchors.centerIn: parent } - - MouseArea { - anchors.fill: parent - drag.target: parent - drag.axis: Drag.XAxis - drag.minimumX: 0 - drag.maximumX: 150 - - onPressed: console.log('press') - onReleased: console.log('release (isClick: ' + mouse.isClick + ') (wasHeld: ' + mouse.wasHeld + ')') - onClicked: console.log('click' + '(wasHeld: ' + mouse.wasHeld + ')') - onDoubleClicked: console.log('double click') - onPressAndHold: console.log('press and hold') - } - } -} diff --git a/examples/declarative/touchinteraction/mousearea/mousearea-example.qml b/examples/declarative/touchinteraction/mousearea/mousearea-example.qml new file mode 100644 index 0000000..64f72a9 --- /dev/null +++ b/examples/declarative/touchinteraction/mousearea/mousearea-example.qml @@ -0,0 +1,102 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module 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 Qt 4.7 + +Rectangle { + id: box + width: 350; height: 250 + + function showInfo(text) { + statusText.text = text + } + + Rectangle { + width: 80; height: 80 + color: "red" + + Text { text: "Click"; font.pixelSize: 16; anchors.centerIn: parent } + + MouseArea { + anchors.fill: parent + hoverEnabled: true + acceptedButtons: Qt.LeftButton | Qt.RightButton + + onPressed: box.showInfo('Pressed (x=' + mouse.x + ' y=' + mouse.y + ' button=' + + (mouse.button == Qt.RightButton ? 'right' : 'left') + + ' Shift=' + (mouse.modifiers & Qt.ShiftModifier ? 'true' : 'false') + ')') + onReleased: box.showInfo('Released (x=' + mouse.x + ' y=' + mouse.y + + ' isClick=' + mouse.isClick + ' wasHeld=' + mouse.wasHeld + ')') + onClicked: box.showInfo('Clicked (x=' + mouse.x + ' y=' + mouse.y + ' wasHeld=' + mouse.wasHeld + ')') + onDoubleClicked: box.showInfo('Double clicked (x=' + mouse.x + ' y=' + mouse.y + ')') + onPressAndHold: box.showInfo('Press and hold') + onEntered: box.showInfo('Entered (pressed=' + pressed + ')') + onExited: box.showInfo('Exited (pressed=' + pressed + ')') + } + } + + Rectangle { + width: 80; height: 80; anchors.right: parent.right + color: "blue" + + Text { text: "Drag"; font.pixelSize: 16; color: "white"; anchors.centerIn: parent } + + MouseArea { + anchors.fill: parent + drag.target: parent + drag.axis: Drag.XAxis + drag.minimumX: 0 + drag.maximumX: 150 + + onPressed: box.showInfo('Pressed') + onReleased: box.showInfo('Released (isClick=' + mouse.isClick + ' wasHeld=' + mouse.wasHeld + ')') + onClicked: box.showInfo('Clicked' + ' (wasHeld=' + mouse.wasHeld + ')') + onDoubleClicked: box.showInfo('Double clicked') + onPressAndHold: box.showInfo('Press and hold') + } + } + + Text { + id: statusText + anchors.bottom: parent.bottom; anchors.horizontalCenter: parent.horizontalCenter; anchors.margins: 30 + + onTextChanged: console.log(text) + } +} -- cgit v0.12 From c8968fd143e079d4d2b79c88132caaffbefedd7d Mon Sep 17 00:00:00 2001 From: Bea Lam Date: Mon, 21 Jun 2010 15:37:41 +1000 Subject: Clean up some examples --- .../animation/basics/property-animation.qml | 6 +- .../animation/behaviors/behavior-example.qml | 7 +- .../declarative/modelviews/listview/PetsModel.qml | 98 ----------- .../modelviews/listview/RecipesModel.qml | 129 -------------- .../modelviews/listview/content/PetsModel.qml | 98 +++++++++++ .../modelviews/listview/content/RecipesModel.qml | 129 ++++++++++++++ .../listview/content/pics/archive-insert.png | Bin 896 -> 0 bytes .../listview/content/pics/archive-remove.png | Bin 1074 -> 0 bytes .../listview/content/pics/arrow-down.png | Bin 0 -> 892 bytes .../modelviews/listview/content/pics/arrow-up.png | Bin 0 -> 929 bytes .../listview/content/pics/button-pressed.png | Bin 571 -> 0 bytes .../modelviews/listview/content/pics/button.png | Bin 564 -> 0 bytes .../modelviews/listview/content/pics/go-down.png | Bin 892 -> 0 bytes .../modelviews/listview/content/pics/go-up.png | Bin 929 -> 0 bytes .../modelviews/listview/content/pics/list-add.png | Bin 907 -> 0 bytes .../listview/content/pics/list-delete.png | Bin 0 -> 1074 bytes .../listview/content/pics/list-remove.png | Bin 498 -> 0 bytes .../listview/content/pics/minus-sign.png | Bin 0 -> 498 bytes .../modelviews/listview/content/pics/plus-sign.png | Bin 0 -> 907 bytes .../modelviews/listview/dynamiclist.qml | 14 +- .../declarative/modelviews/listview/highlight.qml | 1 + .../modelviews/listview/highlightranges.qml | 1 + .../declarative/modelviews/parallax/parallax.qml | 6 +- .../modelviews/parallax/qml/ParallaxView.qml | 30 ++-- .../declarative/modelviews/parallax/qml/Smiley.qml | 18 +- examples/declarative/modelviews/webview/alerts.qml | 15 +- .../declarative/modelviews/webview/autosize.qml | 14 +- .../modelviews/webview/content/FieldText.qml | 195 --------------------- .../modelviews/webview/content/Mapping/Map.qml | 11 +- .../modelviews/webview/content/SpinSquare.qml | 65 ------- .../declarative/modelviews/webview/googleMaps.qml | 83 --------- .../declarative/modelviews/webview/googlemaps.qml | 83 +++++++++ .../declarative/modelviews/webview/inline-html.qml | 55 ------ .../declarative/modelviews/webview/inlinehtml.qml | 55 ++++++ examples/declarative/text/edit/edit.qml | 71 ++++++-- .../ui-components/flipable/content/Card.qml | 4 +- .../ui-components/scrollbar/ScrollBar.qml | 1 + .../declarative/ui-components/scrollbar/main.qml | 1 - .../ui-components/searchbox/SearchBox.qml | 7 +- .../ui-components/searchbox/images/clear.png | Bin 0 -> 429 bytes .../images/edit-clear-locationbar-rtl.png | Bin 429 -> 0 bytes .../ui-components/slideswitch/content/Switch.qml | 7 +- .../ui-components/spinner/content/Spinner.qml | 5 + .../declarative/ui-components/spinner/main.qml | 3 + .../ui-components/tabwidget/TabWidget.qml | 8 +- examples/declarative/xml/xmlhttprequest/data.xml | 5 + examples/declarative/xml/xmlhttprequest/test.qml | 76 -------- examples/declarative/xml/xmlhttprequest/test.xml | 5 - .../xml/xmlhttprequest/xmlhttprequest-example.qml | 95 ++++++++++ 49 files changed, 611 insertions(+), 790 deletions(-) delete mode 100644 examples/declarative/modelviews/listview/PetsModel.qml delete mode 100644 examples/declarative/modelviews/listview/RecipesModel.qml create mode 100644 examples/declarative/modelviews/listview/content/PetsModel.qml create mode 100644 examples/declarative/modelviews/listview/content/RecipesModel.qml delete mode 100644 examples/declarative/modelviews/listview/content/pics/archive-insert.png delete mode 100644 examples/declarative/modelviews/listview/content/pics/archive-remove.png create mode 100644 examples/declarative/modelviews/listview/content/pics/arrow-down.png create mode 100644 examples/declarative/modelviews/listview/content/pics/arrow-up.png delete mode 100644 examples/declarative/modelviews/listview/content/pics/button-pressed.png delete mode 100644 examples/declarative/modelviews/listview/content/pics/button.png delete mode 100644 examples/declarative/modelviews/listview/content/pics/go-down.png delete mode 100644 examples/declarative/modelviews/listview/content/pics/go-up.png delete mode 100644 examples/declarative/modelviews/listview/content/pics/list-add.png create mode 100644 examples/declarative/modelviews/listview/content/pics/list-delete.png delete mode 100644 examples/declarative/modelviews/listview/content/pics/list-remove.png create mode 100644 examples/declarative/modelviews/listview/content/pics/minus-sign.png create mode 100644 examples/declarative/modelviews/listview/content/pics/plus-sign.png delete mode 100644 examples/declarative/modelviews/webview/content/FieldText.qml delete mode 100644 examples/declarative/modelviews/webview/content/SpinSquare.qml delete mode 100644 examples/declarative/modelviews/webview/googleMaps.qml create mode 100644 examples/declarative/modelviews/webview/googlemaps.qml delete mode 100644 examples/declarative/modelviews/webview/inline-html.qml create mode 100644 examples/declarative/modelviews/webview/inlinehtml.qml create mode 100644 examples/declarative/ui-components/searchbox/images/clear.png delete mode 100644 examples/declarative/ui-components/searchbox/images/edit-clear-locationbar-rtl.png create mode 100644 examples/declarative/xml/xmlhttprequest/data.xml delete mode 100644 examples/declarative/xml/xmlhttprequest/test.qml delete mode 100644 examples/declarative/xml/xmlhttprequest/test.xml create mode 100644 examples/declarative/xml/xmlhttprequest/xmlhttprequest-example.qml diff --git a/examples/declarative/animation/basics/property-animation.qml b/examples/declarative/animation/basics/property-animation.qml index 0fb253a..69d166a 100644 --- a/examples/declarative/animation/basics/property-animation.qml +++ b/examples/declarative/animation/basics/property-animation.qml @@ -65,7 +65,8 @@ Item { // The shadow for the smiley face Image { anchors.horizontalCenter: parent.horizontalCenter - source: "images/shadow.png"; y: smiley.minHeight + 58 + y: smiley.minHeight + 58 + source: "images/shadow.png" // The scale property depends on the y position of the smiley face. scale: smiley.y * 0.5 / (smiley.minHeight - smiley.maxHeight) @@ -77,7 +78,8 @@ Item { property int minHeight: 2 * window.height / 3 anchors.horizontalCenter: parent.horizontalCenter - source: "images/face-smile.png"; y: minHeight + y: minHeight + source: "images/face-smile.png" // Animate the y property. Setting loops to Animation.Infinite makes the // animation repeat indefinitely, otherwise it would only run once. diff --git a/examples/declarative/animation/behaviors/behavior-example.qml b/examples/declarative/animation/behaviors/behavior-example.qml index 91845fc..d187fbf 100644 --- a/examples/declarative/animation/behaviors/behavior-example.qml +++ b/examples/declarative/animation/behaviors/behavior-example.qml @@ -87,12 +87,12 @@ Rectangle { border.width: 4; border.color: "white" color: "firebrick" - // Setting an 'elastic' behavior on the focusRect's x property. + // Set an 'elastic' behavior on the focusRect's x property. Behavior on x { NumberAnimation { easing.type: Easing.OutElastic; easing.amplitude: 3.0; easing.period: 2.0; duration: 300 } } - // Setting an 'elastic' behavior on the focusRect's y property. + // Set an 'elastic' behavior on the focusRect's y property. Behavior on y { NumberAnimation { easing.type: Easing.OutElastic; easing.amplitude: 3.0; easing.period: 2.0; duration: 300 } } @@ -104,12 +104,11 @@ Rectangle { color: "white" font.pixelSize: 16; font.bold: true - // Setting a behavior on the focusText's x property: + // Set a behavior on the focusText's x property: // Set the opacity to 0, set the new text value, then set the opacity back to 1. Behavior on text { SequentialAnimation { NumberAnimation { target: focusText; property: "opacity"; to: 0; duration: 150 } - PropertyAction { } NumberAnimation { target: focusText; property: "opacity"; to: 1; duration: 150 } } } diff --git a/examples/declarative/modelviews/listview/PetsModel.qml b/examples/declarative/modelviews/listview/PetsModel.qml deleted file mode 100644 index b77557d..0000000 --- a/examples/declarative/modelviews/listview/PetsModel.qml +++ /dev/null @@ -1,98 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module 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 Qt 4.7 - -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/declarative/modelviews/listview/RecipesModel.qml b/examples/declarative/modelviews/listview/RecipesModel.qml deleted file mode 100644 index e6d829f..0000000 --- a/examples/declarative/modelviews/listview/RecipesModel.qml +++ /dev/null @@ -1,129 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module 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 Qt 4.7 - -ListModel { - ListElement { - title: "Pancakes" - picture: "content/pics/pancakes.jpg" - ingredients: " -
    -
  • 1 cup (150g) self-raising flour -
  • 1 tbs caster sugar -
  • 3/4 cup (185ml) milk -
  • 1 egg -
- " - method: " -
    -
  1. Sift flour and sugar together into a bowl. Add a pinch of salt. -
  2. Beat milk and egg together, then add to dry ingredients. Beat until smooth. -
  3. Pour mixture into a pan on medium heat and cook until bubbles appear on the surface. -
  4. Turn over and cook other side until golden. -
- " - } - ListElement { - title: "Fruit Salad" - picture: "content/pics/fruit-salad.jpg" - ingredients: "* Seasonal Fruit" - method: "* Chop fruit and place in a bowl." - } - ListElement { - title: "Vegetable Soup" - picture: "content/pics/vegetable-soup.jpg" - ingredients: " -
    -
  • 1 onion -
  • 1 turnip -
  • 1 potato -
  • 1 carrot -
  • 1 head of celery -
  • 1 1/2 litres of water -
- " - method: " -
    -
  1. Chop vegetables. -
  2. Boil in water until vegetables soften. -
  3. Season with salt and pepper to taste. -
- " - } - ListElement { - title: "Hamburger" - picture: "content/pics/hamburger.jpg" - ingredients: " -
    -
  • 500g minced beef -
  • Seasoning -
  • lettuce, tomato, onion, cheese -
  • 1 hamburger bun for each burger -
- " - method: " -
    -
  1. Mix the beef, together with seasoning, in a food processor. -
  2. Shape the beef into burgers. -
  3. Grill the burgers for about 5 mins on each side (until cooked through) -
  4. Serve each burger on a bun with ketchup, cheese, lettuce, tomato and onion. -
- " - } - ListElement { - title: "Lemonade" - picture: "content/pics/lemonade.jpg" - ingredients: " -
    -
  • 1 cup Lemon Juice -
  • 1 cup Sugar -
  • 6 Cups of Water (2 cups warm water, 4 cups cold water) -
- " - method: " -
    -
  1. Pour 2 cups of warm water into a pitcher and stir in sugar until it dissolves. -
  2. Pour in lemon juice, stir again, and add 4 cups of cold water. -
  3. Chill or serve over ice cubes. -
- " - } -} diff --git a/examples/declarative/modelviews/listview/content/PetsModel.qml b/examples/declarative/modelviews/listview/content/PetsModel.qml new file mode 100644 index 0000000..b77557d --- /dev/null +++ b/examples/declarative/modelviews/listview/content/PetsModel.qml @@ -0,0 +1,98 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module 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 Qt 4.7 + +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/declarative/modelviews/listview/content/RecipesModel.qml b/examples/declarative/modelviews/listview/content/RecipesModel.qml new file mode 100644 index 0000000..e6d829f --- /dev/null +++ b/examples/declarative/modelviews/listview/content/RecipesModel.qml @@ -0,0 +1,129 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module 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 Qt 4.7 + +ListModel { + ListElement { + title: "Pancakes" + picture: "content/pics/pancakes.jpg" + ingredients: " +
    +
  • 1 cup (150g) self-raising flour +
  • 1 tbs caster sugar +
  • 3/4 cup (185ml) milk +
  • 1 egg +
+ " + method: " +
    +
  1. Sift flour and sugar together into a bowl. Add a pinch of salt. +
  2. Beat milk and egg together, then add to dry ingredients. Beat until smooth. +
  3. Pour mixture into a pan on medium heat and cook until bubbles appear on the surface. +
  4. Turn over and cook other side until golden. +
+ " + } + ListElement { + title: "Fruit Salad" + picture: "content/pics/fruit-salad.jpg" + ingredients: "* Seasonal Fruit" + method: "* Chop fruit and place in a bowl." + } + ListElement { + title: "Vegetable Soup" + picture: "content/pics/vegetable-soup.jpg" + ingredients: " +
    +
  • 1 onion +
  • 1 turnip +
  • 1 potato +
  • 1 carrot +
  • 1 head of celery +
  • 1 1/2 litres of water +
+ " + method: " +
    +
  1. Chop vegetables. +
  2. Boil in water until vegetables soften. +
  3. Season with salt and pepper to taste. +
+ " + } + ListElement { + title: "Hamburger" + picture: "content/pics/hamburger.jpg" + ingredients: " +
    +
  • 500g minced beef +
  • Seasoning +
  • lettuce, tomato, onion, cheese +
  • 1 hamburger bun for each burger +
+ " + method: " +
    +
  1. Mix the beef, together with seasoning, in a food processor. +
  2. Shape the beef into burgers. +
  3. Grill the burgers for about 5 mins on each side (until cooked through) +
  4. Serve each burger on a bun with ketchup, cheese, lettuce, tomato and onion. +
+ " + } + ListElement { + title: "Lemonade" + picture: "content/pics/lemonade.jpg" + ingredients: " +
    +
  • 1 cup Lemon Juice +
  • 1 cup Sugar +
  • 6 Cups of Water (2 cups warm water, 4 cups cold water) +
+ " + method: " +
    +
  1. Pour 2 cups of warm water into a pitcher and stir in sugar until it dissolves. +
  2. Pour in lemon juice, stir again, and add 4 cups of cold water. +
  3. Chill or serve over ice cubes. +
+ " + } +} diff --git a/examples/declarative/modelviews/listview/content/pics/archive-insert.png b/examples/declarative/modelviews/listview/content/pics/archive-insert.png deleted file mode 100644 index b706248..0000000 Binary files a/examples/declarative/modelviews/listview/content/pics/archive-insert.png and /dev/null differ diff --git a/examples/declarative/modelviews/listview/content/pics/archive-remove.png b/examples/declarative/modelviews/listview/content/pics/archive-remove.png deleted file mode 100644 index 9640f6b..0000000 Binary files a/examples/declarative/modelviews/listview/content/pics/archive-remove.png and /dev/null differ diff --git a/examples/declarative/modelviews/listview/content/pics/arrow-down.png b/examples/declarative/modelviews/listview/content/pics/arrow-down.png new file mode 100644 index 0000000..63331a5 Binary files /dev/null and b/examples/declarative/modelviews/listview/content/pics/arrow-down.png differ diff --git a/examples/declarative/modelviews/listview/content/pics/arrow-up.png b/examples/declarative/modelviews/listview/content/pics/arrow-up.png new file mode 100644 index 0000000..4459024 Binary files /dev/null and b/examples/declarative/modelviews/listview/content/pics/arrow-up.png differ diff --git a/examples/declarative/modelviews/listview/content/pics/button-pressed.png b/examples/declarative/modelviews/listview/content/pics/button-pressed.png deleted file mode 100644 index e434d32..0000000 Binary files a/examples/declarative/modelviews/listview/content/pics/button-pressed.png and /dev/null differ diff --git a/examples/declarative/modelviews/listview/content/pics/button.png b/examples/declarative/modelviews/listview/content/pics/button.png deleted file mode 100644 index 56a63ce..0000000 Binary files a/examples/declarative/modelviews/listview/content/pics/button.png and /dev/null differ diff --git a/examples/declarative/modelviews/listview/content/pics/go-down.png b/examples/declarative/modelviews/listview/content/pics/go-down.png deleted file mode 100644 index 63331a5..0000000 Binary files a/examples/declarative/modelviews/listview/content/pics/go-down.png and /dev/null differ diff --git a/examples/declarative/modelviews/listview/content/pics/go-up.png b/examples/declarative/modelviews/listview/content/pics/go-up.png deleted file mode 100644 index 4459024..0000000 Binary files a/examples/declarative/modelviews/listview/content/pics/go-up.png and /dev/null differ diff --git a/examples/declarative/modelviews/listview/content/pics/list-add.png b/examples/declarative/modelviews/listview/content/pics/list-add.png deleted file mode 100644 index e029787..0000000 Binary files a/examples/declarative/modelviews/listview/content/pics/list-add.png and /dev/null differ diff --git a/examples/declarative/modelviews/listview/content/pics/list-delete.png b/examples/declarative/modelviews/listview/content/pics/list-delete.png new file mode 100644 index 0000000..9640f6b Binary files /dev/null and b/examples/declarative/modelviews/listview/content/pics/list-delete.png differ diff --git a/examples/declarative/modelviews/listview/content/pics/list-remove.png b/examples/declarative/modelviews/listview/content/pics/list-remove.png deleted file mode 100644 index 2bb1a59..0000000 Binary files a/examples/declarative/modelviews/listview/content/pics/list-remove.png and /dev/null differ diff --git a/examples/declarative/modelviews/listview/content/pics/minus-sign.png b/examples/declarative/modelviews/listview/content/pics/minus-sign.png new file mode 100644 index 0000000..2bb1a59 Binary files /dev/null and b/examples/declarative/modelviews/listview/content/pics/minus-sign.png differ diff --git a/examples/declarative/modelviews/listview/content/pics/plus-sign.png b/examples/declarative/modelviews/listview/content/pics/plus-sign.png new file mode 100644 index 0000000..e029787 Binary files /dev/null and b/examples/declarative/modelviews/listview/content/pics/plus-sign.png differ diff --git a/examples/declarative/modelviews/listview/dynamiclist.qml b/examples/declarative/modelviews/listview/dynamiclist.qml index 12c331b..3c1af37 100644 --- a/examples/declarative/modelviews/listview/dynamiclist.qml +++ b/examples/declarative/modelviews/listview/dynamiclist.qml @@ -96,11 +96,11 @@ Rectangle { Column { Image { - source: "content/pics/go-up.png" - MouseArea { anchors.fill: parent; onClicked: fruitModel.move(index,index-1,1) } + source: "content/pics/arrow-up.png" + MouseArea { anchors.fill: parent; onClicked: fruitModel.move(index, index-1, 1) } } - Image { source: "content/pics/go-down.png" - MouseArea { anchors.fill: parent; onClicked: fruitModel.move(index,index+1,1) } + Image { source: "content/pics/arrow-down.png" + MouseArea { anchors.fill: parent; onClicked: fruitModel.move(index, index+1, 1) } } } @@ -129,7 +129,7 @@ Rectangle { PressAndHoldButton { anchors.verticalCenter: parent.verticalCenter - source: "content/pics/list-add.png" + source: "content/pics/plus-sign.png" onClicked: fruitModel.setProperty(index, "cost", cost + 0.25) } @@ -144,12 +144,12 @@ Rectangle { PressAndHoldButton { anchors.verticalCenter: parent.verticalCenter - source: "content/pics/list-remove.png" + source: "content/pics/minus-sign.png" onClicked: fruitModel.setProperty(index, "cost", Math.max(0,cost-0.25)) } Image { - source: "content/pics/archive-remove.png" + source: "content/pics/list-delete.png" MouseArea { anchors.fill:parent; onClicked: fruitModel.remove(index) } } } diff --git a/examples/declarative/modelviews/listview/highlight.qml b/examples/declarative/modelviews/listview/highlight.qml index 9f43409..4c14f2a 100644 --- a/examples/declarative/modelviews/listview/highlight.qml +++ b/examples/declarative/modelviews/listview/highlight.qml @@ -43,6 +43,7 @@ // highlight bar is moved between items. import Qt 4.7 +import "content" Rectangle { width: 200; height: 300 diff --git a/examples/declarative/modelviews/listview/highlightranges.qml b/examples/declarative/modelviews/listview/highlightranges.qml index f0d7f75..30976f4 100644 --- a/examples/declarative/modelviews/listview/highlightranges.qml +++ b/examples/declarative/modelviews/listview/highlightranges.qml @@ -39,6 +39,7 @@ ****************************************************************************/ import Qt 4.7 +import "content" Rectangle { width: 600; height: 300 diff --git a/examples/declarative/modelviews/parallax/parallax.qml b/examples/declarative/modelviews/parallax/parallax.qml index 3b5c70a..19eadd0 100644 --- a/examples/declarative/modelviews/parallax/parallax.qml +++ b/examples/declarative/modelviews/parallax/parallax.qml @@ -39,12 +39,10 @@ ****************************************************************************/ import Qt 4.7 -import "../../toys/clocks/content" +import "../../toys/clocks/content" // for loading the Clock element import "qml" Rectangle { - id: root - width: 320; height: 480 ParallaxView { @@ -76,7 +74,5 @@ Rectangle { Component.onCompleted: item.inAnotherDemo = true; } } - - currentIndex: root.currentIndex } } diff --git a/examples/declarative/modelviews/parallax/qml/ParallaxView.qml b/examples/declarative/modelviews/parallax/qml/ParallaxView.qml index adf0885..ac479f4 100644 --- a/examples/declarative/modelviews/parallax/qml/ParallaxView.qml +++ b/examples/declarative/modelviews/parallax/qml/ParallaxView.qml @@ -44,8 +44,8 @@ Item { id: root property alias background: background.source - default property alias content: visualModel.children property int currentIndex: 0 + default property alias content: visualModel.children Image { id: background @@ -56,13 +56,13 @@ Item { ListView { id: list + anchors.fill: parent currentIndex: root.currentIndex onCurrentIndexChanged: root.currentIndex = currentIndex orientation: Qt.Horizontal boundsBehavior: Flickable.DragOverBounds - anchors.fill: parent model: VisualItemModel { id: visualModel } highlightRangeMode: ListView.StrictlyEnforceRange @@ -72,14 +72,6 @@ Item { ListView { id: selector - Rectangle { - color: "#60FFFFFF" - x: -10; y: -10; radius: 10; z: -1 - width: parent.width + 20; height: parent.height + 20 - } - currentIndex: root.currentIndex - onCurrentIndexChanged: root.currentIndex = currentIndex - height: 50 anchors.bottom: parent.bottom anchors.horizontalCenter: parent.horizontalCenter @@ -87,6 +79,10 @@ Item { interactive: width == parent.width - 20 orientation: Qt.Horizontal + currentIndex: root.currentIndex + onCurrentIndexChanged: root.currentIndex = currentIndex + + model: visualModel.children delegate: Item { width: 50; height: 50 id: delegateRoot @@ -113,11 +109,15 @@ Item { } } transitions: Transition { - NumberAnimation { - properties: "scale,y" - } - } + NumberAnimation { properties: "scale,y" } + } + } + + Rectangle { + color: "#60FFFFFF" + x: -10; y: -10; z: -1 + width: parent.width + 20; height: parent.height + 20 + radius: 10 } - model: visualModel.children } } diff --git a/examples/declarative/modelviews/parallax/qml/Smiley.qml b/examples/declarative/modelviews/parallax/qml/Smiley.qml index 8399664..3ca672a 100644 --- a/examples/declarative/modelviews/parallax/qml/Smiley.qml +++ b/examples/declarative/modelviews/parallax/qml/Smiley.qml @@ -40,16 +40,18 @@ import Qt 4.7 +// This is taken from the declarative animation/basics/property-animation.qml +// example + Item { id: window width: 320; height: 480 - // The shadow for the smiley face Image { anchors.horizontalCenter: parent.horizontalCenter - source: "../pics/shadow.png"; y: smiley.minHeight + 58 + y: smiley.minHeight + 58 + source: "../pics/shadow.png" - // The scale property depends on the y position of the smiley face. scale: smiley.y * 0.5 / (smiley.minHeight - smiley.maxHeight) } @@ -59,26 +61,22 @@ Item { property int minHeight: 2 * window.height / 3 anchors.horizontalCenter: parent.horizontalCenter - source: "../pics/face-smile.png"; y: minHeight + y: minHeight + source: "../pics/face-smile.png" - // Animate the y property. Setting repeat to true makes the - // animation repeat indefinitely, otherwise it would only run once. - SequentialAnimation on y { + SequentialAnimation on y { loops: Animation.Infinite - // Move from minHeight to maxHeight in 300ms, using the OutExpo easing function NumberAnimation { from: smiley.minHeight; to: smiley.maxHeight easing.type: Easing.OutExpo; duration: 300 } - // Then move back to minHeight in 1 second, using the OutBounce easing function NumberAnimation { from: smiley.maxHeight; to: smiley.minHeight easing.type: Easing.OutBounce; duration: 1000 } - // Then pause for 500ms PauseAnimation { duration: 500 } } } diff --git a/examples/declarative/modelviews/webview/alerts.qml b/examples/declarative/modelviews/webview/alerts.qml index 7303450..1537411 100644 --- a/examples/declarative/modelviews/webview/alerts.qml +++ b/examples/declarative/modelviews/webview/alerts.qml @@ -43,7 +43,7 @@ import org.webkit 1.0 WebView { id: webView - width: 120 + width: 200 height: 150 url: "alerts.html" @@ -58,13 +58,13 @@ WebView { y: parent.height // off "screen" anchors.horizontalCenter: parent.horizontalCenter - width: label.width+5 - height: label.height+5 + width: label.width + 5 + height: label.height + 5 opacity: 0 - function show(t) { - label.text = t + function show(text) { + label.text = text popup.state = "visible" timer.start() } @@ -82,17 +82,20 @@ WebView { Timer { id: timer interval: 1000 + onTriggered: popup.state = "" } Text { id: label anchors.centerIn: parent + width: webView.width *0.75 + color: "white" font.pixelSize: 20 - width: webView.width*0.75 wrapMode: Text.WordWrap horizontalAlignment: Text.AlignHCenter + smooth: true } } } diff --git a/examples/declarative/modelviews/webview/autosize.qml b/examples/declarative/modelviews/webview/autosize.qml index 556b429..64e3ff1 100644 --- a/examples/declarative/modelviews/webview/autosize.qml +++ b/examples/declarative/modelviews/webview/autosize.qml @@ -51,6 +51,7 @@ Rectangle { Column { id: layout spacing: 2 + WebView { html: "No width defined." Rectangle { @@ -58,6 +59,7 @@ Rectangle { anchors.fill: parent } } + WebView { width: rect.width html: "The width is full." @@ -66,6 +68,7 @@ Rectangle { anchors.fill: parent } } + WebView { width: rect.width/2 html: "The width is half." @@ -75,24 +78,25 @@ Rectangle { } } WebView { - preferredWidth: rect.width/2 - html: "The preferredWidth is half." + width: rect.width/2 + html: "The_width_is_half." // not wrapped Rectangle { color: "#10000000" anchors.fill: parent } } + WebView { preferredWidth: rect.width/2 - html: "The_preferredWidth_is_half." + html: "The preferredWidth is half." Rectangle { color: "#10000000" anchors.fill: parent } } WebView { - width: rect.width/2 - html: "The_width_is_half." + preferredWidth: rect.width/2 + html: "The_preferredWidth_is_half." // not wrapped Rectangle { color: "#10000000" anchors.fill: parent diff --git a/examples/declarative/modelviews/webview/content/FieldText.qml b/examples/declarative/modelviews/webview/content/FieldText.qml deleted file mode 100644 index 17fa4cd..0000000 --- a/examples/declarative/modelviews/webview/content/FieldText.qml +++ /dev/null @@ -1,195 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module 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 Qt 4.7 - -Item { - id: fieldText - height: 30 - property string text: "" - property string label: "" - property bool mouseGrabbed: false - signal confirmed - signal cancelled - signal startEdit - - function edit() { - if (!mouseGrabbed) { - fieldText.startEdit(); - fieldText.state='editing'; - mouseGrabbed=true; - } - } - - function confirm() { - fieldText.state=''; - fieldText.text = textEdit.text; - mouseGrabbed=false; - fieldText.confirmed(); - } - - function reset() { - textEdit.text = fieldText.text; - fieldText.state=''; - mouseGrabbed=false; - fieldText.cancelled(); - } - - Image { - id: cancelIcon - width: 22 - height: 22 - anchors.right: parent.right - anchors.rightMargin: 4 - anchors.verticalCenter: parent.verticalCenter - source: "pics/cancel.png" - opacity: 0 - } - - Image { - id: confirmIcon - width: 22 - height: 22 - anchors.left: parent.left - anchors.leftMargin: 4 - anchors.verticalCenter: parent.verticalCenter - source: "pics/ok.png" - opacity: 0 - } - - TextInput { - id: textEdit - text: fieldText.text - focus: false - anchors.left: parent.left - anchors.leftMargin: 0 - anchors.right: parent.right - anchors.rightMargin: 0 - anchors.verticalCenter: parent.verticalCenter - color: "black" - font.bold: true - readOnly: true - onAccepted: confirm() - Keys.onEscapePressed: reset() - } - - Text { - id: textLabel - x: 5 - width: parent.width-10 - anchors.verticalCenter: parent.verticalCenter - horizontalAlignment: Text.AlignHCenter - color: fieldText.state == "editing" ? "#505050" : "#AAAAAA" - font.italic: true - font.bold: true - text: label - opacity: textEdit.text == '' ? 1 : 0 - Behavior on opacity { - NumberAnimation { - property: "opacity" - duration: 250 - } - } - } - - MouseArea { - anchors.fill: cancelIcon - onClicked: { reset() } - } - - MouseArea { - anchors.fill: confirmIcon - onClicked: { confirm() } - } - - MouseArea { - id: editRegion - anchors.fill: textEdit - onClicked: { edit() } - } - - states: [ - State { - name: "editing" - PropertyChanges { - target: confirmIcon - opacity: 1 - } - PropertyChanges { - target: cancelIcon - opacity: 1 - } - PropertyChanges { - target: textEdit - color: "black" - readOnly: false - focus: true - } - PropertyChanges { - target: editRegion - opacity: 0 - } - PropertyChanges { - target: textEdit.anchors - leftMargin: 34 - } - PropertyChanges { - target: textEdit.anchors - rightMargin: 34 - } - } - ] - - transitions: [ - Transition { - from: "" - to: "*" - reversible: true - NumberAnimation { - properties: "opacity,leftMargin,rightMargin" - duration: 200 - } - ColorAnimation { - property: "color" - duration: 150 - } - } - ] -} diff --git a/examples/declarative/modelviews/webview/content/Mapping/Map.qml b/examples/declarative/modelviews/webview/content/Mapping/Map.qml index be708ee..99f8479 100644 --- a/examples/declarative/modelviews/webview/content/Mapping/Map.qml +++ b/examples/declarative/modelviews/webview/content/Mapping/Map.qml @@ -43,14 +43,17 @@ import org.webkit 1.0 Item { id: page + property real latitude: -34.397 property real longitude: 150.644 property string address: "" property alias status: js.status + WebView { id: map anchors.fill: parent url: "map.html" + pressGrabTime: 0 javaScriptWindowObjects: QtObject { id: js WebView.windowObjectName: "qml" @@ -58,9 +61,13 @@ Item { property real lng: page.longitude property string address: page.address property string status: "Loading" - onAddressChanged: { if (map.url != "" && map.progress==1) map.evaluateJavaScript("goToAddress()") } + + onAddressChanged: { + if (map.url != "" && map.progress == 1) + map.evaluateJavaScript("goToAddress()") + } } - pressGrabTime: 0 + onLoadFinished: { evaluateJavaScript("goToAddress()"); } } } diff --git a/examples/declarative/modelviews/webview/content/SpinSquare.qml b/examples/declarative/modelviews/webview/content/SpinSquare.qml deleted file mode 100644 index ec83056..0000000 --- a/examples/declarative/modelviews/webview/content/SpinSquare.qml +++ /dev/null @@ -1,65 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module 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 Qt 4.7 - -Item { - property variant period : 250 - property variant color : "black" - id: root - - Item { - x: root.width/2 - y: root.height/2 - Rectangle { - color: root.color - x: -width/2 - y: -height/2 - width: root.width - height: width - } - NumberAnimation on rotation { - from: 0 - to: 360 - loops: Animation.Infinite - duration: root.period - } - } -} diff --git a/examples/declarative/modelviews/webview/googleMaps.qml b/examples/declarative/modelviews/webview/googleMaps.qml deleted file mode 100644 index 1c99940..0000000 --- a/examples/declarative/modelviews/webview/googleMaps.qml +++ /dev/null @@ -1,83 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module 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$ -** -****************************************************************************/ - -// This example demonstrates how Web services such as Google Maps can be -// abstracted as QML types. Here we have a "Mapping" module with a "Map" -// type. The Map type has an address property. Setting that property moves -// the map. The underlying implementation uses WebView and the Google Maps -// API, but users from QML don't need to understand the implementation in -// order to create a Map. - -import Qt 4.7 -import org.webkit 1.0 -import "content/Mapping" - -Map { - id: map - width: 300 - height: 300 - address: "Paris" - - Rectangle { - x: 70 - width: input.width + 20 - height: input.height + 4 - anchors.bottom: parent.bottom; anchors.bottomMargin: 5 - radius: 5 - opacity: map.status == "Ready" ? 1 : 0 - - TextInput { - id: input - text: map.address - anchors.centerIn: parent - Keys.onReturnPressed: map.address = input.text - } - } - - Text { - id: loading - anchors.centerIn: parent - text: map.status == "Error" ? "Error" : "Loading" - opacity: map.status == "Ready" ? 0 : 1 - font.pixelSize: 30 - - Behavior on opacity { NumberAnimation{} } - } -} diff --git a/examples/declarative/modelviews/webview/googlemaps.qml b/examples/declarative/modelviews/webview/googlemaps.qml new file mode 100644 index 0000000..1c99940 --- /dev/null +++ b/examples/declarative/modelviews/webview/googlemaps.qml @@ -0,0 +1,83 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module 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$ +** +****************************************************************************/ + +// This example demonstrates how Web services such as Google Maps can be +// abstracted as QML types. Here we have a "Mapping" module with a "Map" +// type. The Map type has an address property. Setting that property moves +// the map. The underlying implementation uses WebView and the Google Maps +// API, but users from QML don't need to understand the implementation in +// order to create a Map. + +import Qt 4.7 +import org.webkit 1.0 +import "content/Mapping" + +Map { + id: map + width: 300 + height: 300 + address: "Paris" + + Rectangle { + x: 70 + width: input.width + 20 + height: input.height + 4 + anchors.bottom: parent.bottom; anchors.bottomMargin: 5 + radius: 5 + opacity: map.status == "Ready" ? 1 : 0 + + TextInput { + id: input + text: map.address + anchors.centerIn: parent + Keys.onReturnPressed: map.address = input.text + } + } + + Text { + id: loading + anchors.centerIn: parent + text: map.status == "Error" ? "Error" : "Loading" + opacity: map.status == "Ready" ? 0 : 1 + font.pixelSize: 30 + + Behavior on opacity { NumberAnimation{} } + } +} diff --git a/examples/declarative/modelviews/webview/inline-html.qml b/examples/declarative/modelviews/webview/inline-html.qml deleted file mode 100644 index 875c903..0000000 --- a/examples/declarative/modelviews/webview/inline-html.qml +++ /dev/null @@ -1,55 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module 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 Qt 4.7 -import org.webkit 1.0 - -// Inline HTML with loose formatting can be -// set on the html property. -WebView { - html:"\ - \ - \ -
OneTwoThree\ -
1X1X\ -
20X0\ -
3X1X\ -
" -} diff --git a/examples/declarative/modelviews/webview/inlinehtml.qml b/examples/declarative/modelviews/webview/inlinehtml.qml new file mode 100644 index 0000000..237bd8f --- /dev/null +++ b/examples/declarative/modelviews/webview/inlinehtml.qml @@ -0,0 +1,55 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module 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 Qt 4.7 +import org.webkit 1.0 + +// Inline HTML with loose formatting can be +// set on the html property. +WebView { + html:"\ + + +
OneTwoThree +
1X1X +
20X0 +
3X1X +
" +} diff --git a/examples/declarative/text/edit/edit.qml b/examples/declarative/text/edit/edit.qml index 4668ab2..1ba3e18 100644 --- a/examples/declarative/text/edit/edit.qml +++ b/examples/declarative/text/edit/edit.qml @@ -55,8 +55,8 @@ Rectangle { source: "pics/startHandle.sci" opacity: 0.0 width: 10 - x: edit.positionToRectangle(edit.selectionStart).x-flick.contentX-width - y: edit.positionToRectangle(edit.selectionStart).y-flick.contentY + x: edit.positionToRectangle(edit.selectionStart).x - flick.contentX-width + y: edit.positionToRectangle(edit.selectionStart).y - flick.contentY height: edit.positionToRectangle(edit.selectionStart).height } @@ -65,8 +65,8 @@ Rectangle { source: "pics/endHandle.sci" opacity: 0.0 width: 10 - x: edit.positionToRectangle(edit.selectionEnd).x-flick.contentX - y: edit.positionToRectangle(edit.selectionEnd).y-flick.contentY + x: edit.positionToRectangle(edit.selectionEnd).x - flick.contentX + y: edit.positionToRectangle(edit.selectionEnd).y - flick.contentY height: edit.positionToRectangle(edit.selectionEnd).height } @@ -79,8 +79,7 @@ Rectangle { interactive: true clip: true - function ensureVisible(r) - { + function ensureVisible(r) { if (contentX >= r.x) contentX = r.x; else if (contentX+width <= r.x+r.width) @@ -97,20 +96,25 @@ Rectangle { height: flick.height focus: true wrapMode: TextEdit.Wrap + onCursorRectangleChanged: flick.ensureVisible(cursorRectangle) + text: "

Text Selection

" +"

This example is a whacky text selection mechanisms, showing how these can be implemented in the TextEdit element, to cater for whatever style is appropriate for the target platform." +"

Press-and-hold to select a word, then drag the selection handles." +"

Drag outside the selection to scroll the text." +"

Click inside the selection to cut/copy/paste/cancel selection." +"

It's too whacky to let you paste if there is no current selection." + MouseArea { + property string drag: "" + property int pressPos + x: -startHandle.width y: 0 width: parent.width+startHandle.width+endHandle.width height: parent.height - property string drag: ""; - property int pressPos; + onPressAndHold: { if (editor.state == "") { edit.cursorPosition = edit.positionAt(mouse.x+x,mouse.y+y); @@ -118,6 +122,7 @@ Rectangle { editor.state = "selection" } } + onClicked: { if (editor.state == "") { edit.cursorPosition = edit.positionAt(mouse.x+x,mouse.y+y); @@ -126,7 +131,11 @@ Rectangle { edit.openSoftwareInputPanel(); } } - function hitHandle(h,x,y) { return x>=h.x+flick.contentX && x=h.y+flick.contentY && y=h.x+flick.contentX && x=h.y+flick.contentY && y + + + + diff --git a/examples/declarative/xml/xmlhttprequest/test.qml b/examples/declarative/xml/xmlhttprequest/test.qml deleted file mode 100644 index e5f0875..0000000 --- a/examples/declarative/xml/xmlhttprequest/test.qml +++ /dev/null @@ -1,76 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module 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 Qt 4.7 - -Rectangle { - width: 800; height: 600 - - MouseArea { - anchors.fill: parent - - onClicked: { - var doc = new XMLHttpRequest(); - doc.onreadystatechange = function() { - if (doc.readyState == XMLHttpRequest.HEADERS_RECEIVED) { - console.log("Headers -->"); - console.log(doc.getAllResponseHeaders ()); - console.log("Last modified -->"); - console.log(doc.getResponseHeader ("Last-Modified")); - } - else if (doc.readyState == XMLHttpRequest.DONE) { - - var a = doc.responseXML.documentElement; - for (var ii = 0; ii < a.childNodes.length; ++ii) { - console.log(a.childNodes[ii].nodeName); - } - console.log("Headers -->"); - console.log(doc.getAllResponseHeaders ()); - console.log("Last modified -->"); - console.log(doc.getResponseHeader ("Last-Modified")); - - } - } - - doc.open("GET", "test.xml"); - doc.send(); - } - } -} diff --git a/examples/declarative/xml/xmlhttprequest/test.xml b/examples/declarative/xml/xmlhttprequest/test.xml deleted file mode 100644 index 8b7f1e1..0000000 --- a/examples/declarative/xml/xmlhttprequest/test.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/examples/declarative/xml/xmlhttprequest/xmlhttprequest-example.qml b/examples/declarative/xml/xmlhttprequest/xmlhttprequest-example.qml new file mode 100644 index 0000000..b302729 --- /dev/null +++ b/examples/declarative/xml/xmlhttprequest/xmlhttprequest-example.qml @@ -0,0 +1,95 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module 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 Qt 4.7 + +Rectangle { + width: 350; height: 400 + + function showRequestInfo(text) { + log.text = log.text + "\n" + text + console.log(text) + } + + Text { id: log; anchors.fill: parent; anchors.margins: 10 } + + Rectangle { + id: button + anchors.horizontalCenter: parent.horizontalCenter; anchors.bottom: parent.bottom; anchors.margins: 10 + width: buttonText.width + 10; height: buttonText.height + 10 + border.width: mouseArea.pressed ? 2 : 1 + radius : 5; smooth: true + + Text { id: buttonText; anchors.centerIn: parent; text: "Request data.xml" } + + MouseArea { + id: mouseArea + anchors.fill: parent + onClicked: { + log.text = "" + console.log("\n") + + var doc = new XMLHttpRequest(); + doc.onreadystatechange = function() { + if (doc.readyState == XMLHttpRequest.HEADERS_RECEIVED) { + showRequestInfo("Headers -->"); + showRequestInfo(doc.getAllResponseHeaders ()); + showRequestInfo("Last modified -->"); + showRequestInfo(doc.getResponseHeader ("Last-Modified")); + + } else if (doc.readyState == XMLHttpRequest.DONE) { + var a = doc.responseXML.documentElement; + for (var ii = 0; ii < a.childNodes.length; ++ii) { + showRequestInfo(a.childNodes[ii].nodeName); + } + showRequestInfo("Headers -->"); + showRequestInfo(doc.getAllResponseHeaders ()); + showRequestInfo("Last modified -->"); + showRequestInfo(doc.getResponseHeader ("Last-Modified")); + } + } + + doc.open("GET", "data.xml"); + doc.send(); + } + } + } +} + -- cgit v0.12 From 38ca1b7e65dfeb154a913c493199bfbdf0561526 Mon Sep 17 00:00:00 2001 From: Bea Lam Date: Mon, 21 Jun 2010 15:41:32 +1000 Subject: Rename example: edit -> textselection --- examples/declarative/text/edit/edit.qml | 290 --------------------- examples/declarative/text/edit/pics/endHandle.png | Bin 185 -> 0 bytes examples/declarative/text/edit/pics/endHandle.sci | 5 - .../declarative/text/edit/pics/startHandle.png | Bin 178 -> 0 bytes .../declarative/text/edit/pics/startHandle.sci | 5 - .../text/textselection/pics/endHandle.png | Bin 0 -> 185 bytes .../text/textselection/pics/endHandle.sci | 5 + .../text/textselection/pics/startHandle.png | Bin 0 -> 178 bytes .../text/textselection/pics/startHandle.sci | 5 + .../text/textselection/textselection.qml | 290 +++++++++++++++++++++ .../text/textselection/textselection.qmlproject | 16 ++ 11 files changed, 316 insertions(+), 300 deletions(-) delete mode 100644 examples/declarative/text/edit/edit.qml delete mode 100644 examples/declarative/text/edit/pics/endHandle.png delete mode 100644 examples/declarative/text/edit/pics/endHandle.sci delete mode 100644 examples/declarative/text/edit/pics/startHandle.png delete mode 100644 examples/declarative/text/edit/pics/startHandle.sci create mode 100644 examples/declarative/text/textselection/pics/endHandle.png create mode 100644 examples/declarative/text/textselection/pics/endHandle.sci create mode 100644 examples/declarative/text/textselection/pics/startHandle.png create mode 100644 examples/declarative/text/textselection/pics/startHandle.sci create mode 100644 examples/declarative/text/textselection/textselection.qml create mode 100644 examples/declarative/text/textselection/textselection.qmlproject diff --git a/examples/declarative/text/edit/edit.qml b/examples/declarative/text/edit/edit.qml deleted file mode 100644 index 1ba3e18..0000000 --- a/examples/declarative/text/edit/edit.qml +++ /dev/null @@ -1,290 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -import Qt 4.7 - -Rectangle { - id: editor - color: "lightGrey" - width: 640; height: 480 - - Rectangle { - color: "white" - anchors.fill: parent - anchors.margins: 20 - - BorderImage { - id: startHandle - source: "pics/startHandle.sci" - opacity: 0.0 - width: 10 - x: edit.positionToRectangle(edit.selectionStart).x - flick.contentX-width - y: edit.positionToRectangle(edit.selectionStart).y - flick.contentY - height: edit.positionToRectangle(edit.selectionStart).height - } - - BorderImage { - id: endHandle - source: "pics/endHandle.sci" - opacity: 0.0 - width: 10 - x: edit.positionToRectangle(edit.selectionEnd).x - flick.contentX - y: edit.positionToRectangle(edit.selectionEnd).y - flick.contentY - height: edit.positionToRectangle(edit.selectionEnd).height - } - - Flickable { - id: flick - - anchors.fill: parent - contentWidth: edit.paintedWidth - contentHeight: edit.paintedHeight - interactive: true - clip: true - - function ensureVisible(r) { - if (contentX >= r.x) - contentX = r.x; - else if (contentX+width <= r.x+r.width) - contentX = r.x+r.width-width; - if (contentY >= r.y) - contentY = r.y; - else if (contentY+height <= r.y+r.height) - contentY = r.y+r.height-height; - } - - TextEdit { - id: edit - width: flick.width - height: flick.height - focus: true - wrapMode: TextEdit.Wrap - - onCursorRectangleChanged: flick.ensureVisible(cursorRectangle) - - text: "

Text Selection

" - +"

This example is a whacky text selection mechanisms, showing how these can be implemented in the TextEdit element, to cater for whatever style is appropriate for the target platform." - +"

Press-and-hold to select a word, then drag the selection handles." - +"

Drag outside the selection to scroll the text." - +"

Click inside the selection to cut/copy/paste/cancel selection." - +"

It's too whacky to let you paste if there is no current selection." - - MouseArea { - property string drag: "" - property int pressPos - - x: -startHandle.width - y: 0 - width: parent.width+startHandle.width+endHandle.width - height: parent.height - - onPressAndHold: { - if (editor.state == "") { - edit.cursorPosition = edit.positionAt(mouse.x+x,mouse.y+y); - edit.selectWord(); - editor.state = "selection" - } - } - - onClicked: { - if (editor.state == "") { - edit.cursorPosition = edit.positionAt(mouse.x+x,mouse.y+y); - if (!edit.focus) - edit.focus = true; - edit.openSoftwareInputPanel(); - } - } - - function hitHandle(h,x,y) { - return x>=h.x+flick.contentX && x=h.y+flick.contentY && y= edit.selectionStart && pos <= edit.selectionEnd) { - drag = "selection" - flick.interactive = false - } else { - drag = "" - flick.interactive = true - } - } - } - } - - onReleased: { - if (editor.state == "selection") { - if (drag == "selection") { - editor.state = "menu" - } - drag = "" - } - flick.interactive = true - } - - onPositionChanged: { - if (editor.state == "selection" && drag != "") { - if (drag == "start") { - var pos = edit.positionAt(mouse.x+x+startHandle.width/2,mouse.y+y); - var e = edit.selectionEnd; - if (e < pos) - e = pos; - edit.select(pos,e); - } else if (drag == "end") { - var pos = edit.positionAt(mouse.x+x-endHandle.width/2,mouse.y+y); - var s = edit.selectionStart; - if (s > pos) - s = pos; - edit.select(s,pos); - } - } - } - } - } - } - - Item { - id: menu - opacity: 0.0 - width: 100 - height: 120 - anchors.centerIn: parent - - Rectangle { - border.width: 1 - border.color: "darkBlue" - radius: 15 - color: "#806080FF" - anchors.fill: parent - } - - Column { - anchors.centerIn: parent - spacing: 8 - - Rectangle { - border.width: 1 - border.color: "darkBlue" - color: "#ff7090FF" - width: 60 - height: 16 - - Text { anchors.centerIn: parent; text: "Cut" } - - MouseArea { - anchors.fill: parent - onClicked: { edit.cut(); editor.state = "" } - } - } - - Rectangle { - border.width: 1 - border.color: "darkBlue" - color: "#ff7090FF" - width: 60 - height: 16 - - Text { anchors.centerIn: parent; text: "Copy" } - - MouseArea { - anchors.fill: parent - onClicked: { edit.copy(); editor.state = "selection" } - } - } - - Rectangle { - border.width: 1 - border.color: "darkBlue" - color: "#ff7090FF" - width: 60 - height: 16 - - Text { anchors.centerIn: parent; text: "Paste" } - - MouseArea { - anchors.fill: parent - onClicked: { edit.paste(); edit.cursorPosition = edit.selectionEnd; editor.state = "" } - } - } - - Rectangle { - border.width: 1 - border.color: "darkBlue" - color: "#ff7090FF" - width: 60 - height: 16 - - Text { anchors.centerIn: parent; text: "Deselect" } - - MouseArea { - anchors.fill: parent - onClicked: { - edit.cursorPosition = edit.selectionEnd; - edit.select(edit.cursorPosition, edit.cursorPosition); - editor.state = "" - } - } - } - } - } - } - - states: [ - State { - name: "selection" - PropertyChanges { target: startHandle; opacity: 1.0 } - PropertyChanges { target: endHandle; opacity: 1.0 } - }, - State { - name: "menu" - PropertyChanges { target: startHandle; opacity: 0.5 } - PropertyChanges { target: endHandle; opacity: 0.5 } - PropertyChanges { target: menu; opacity: 1.0 } - } - ] -} diff --git a/examples/declarative/text/edit/pics/endHandle.png b/examples/declarative/text/edit/pics/endHandle.png deleted file mode 100644 index 1a4bc5d..0000000 Binary files a/examples/declarative/text/edit/pics/endHandle.png and /dev/null differ diff --git a/examples/declarative/text/edit/pics/endHandle.sci b/examples/declarative/text/edit/pics/endHandle.sci deleted file mode 100644 index 4f51f24..0000000 --- a/examples/declarative/text/edit/pics/endHandle.sci +++ /dev/null @@ -1,5 +0,0 @@ -border.left: 0 -border.top: 6 -border.bottom: 6 -border.right: 6 -source: endHandle.png diff --git a/examples/declarative/text/edit/pics/startHandle.png b/examples/declarative/text/edit/pics/startHandle.png deleted file mode 100644 index deedcd5..0000000 Binary files a/examples/declarative/text/edit/pics/startHandle.png and /dev/null differ diff --git a/examples/declarative/text/edit/pics/startHandle.sci b/examples/declarative/text/edit/pics/startHandle.sci deleted file mode 100644 index f9eae20..0000000 --- a/examples/declarative/text/edit/pics/startHandle.sci +++ /dev/null @@ -1,5 +0,0 @@ -border.left: 6 -border.top: 6 -border.bottom: 6 -border.right: 0 -source: startHandle.png diff --git a/examples/declarative/text/textselection/pics/endHandle.png b/examples/declarative/text/textselection/pics/endHandle.png new file mode 100644 index 0000000..1a4bc5d Binary files /dev/null and b/examples/declarative/text/textselection/pics/endHandle.png differ diff --git a/examples/declarative/text/textselection/pics/endHandle.sci b/examples/declarative/text/textselection/pics/endHandle.sci new file mode 100644 index 0000000..4f51f24 --- /dev/null +++ b/examples/declarative/text/textselection/pics/endHandle.sci @@ -0,0 +1,5 @@ +border.left: 0 +border.top: 6 +border.bottom: 6 +border.right: 6 +source: endHandle.png diff --git a/examples/declarative/text/textselection/pics/startHandle.png b/examples/declarative/text/textselection/pics/startHandle.png new file mode 100644 index 0000000..deedcd5 Binary files /dev/null and b/examples/declarative/text/textselection/pics/startHandle.png differ diff --git a/examples/declarative/text/textselection/pics/startHandle.sci b/examples/declarative/text/textselection/pics/startHandle.sci new file mode 100644 index 0000000..f9eae20 --- /dev/null +++ b/examples/declarative/text/textselection/pics/startHandle.sci @@ -0,0 +1,5 @@ +border.left: 6 +border.top: 6 +border.bottom: 6 +border.right: 0 +source: startHandle.png diff --git a/examples/declarative/text/textselection/textselection.qml b/examples/declarative/text/textselection/textselection.qml new file mode 100644 index 0000000..1ba3e18 --- /dev/null +++ b/examples/declarative/text/textselection/textselection.qml @@ -0,0 +1,290 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +import Qt 4.7 + +Rectangle { + id: editor + color: "lightGrey" + width: 640; height: 480 + + Rectangle { + color: "white" + anchors.fill: parent + anchors.margins: 20 + + BorderImage { + id: startHandle + source: "pics/startHandle.sci" + opacity: 0.0 + width: 10 + x: edit.positionToRectangle(edit.selectionStart).x - flick.contentX-width + y: edit.positionToRectangle(edit.selectionStart).y - flick.contentY + height: edit.positionToRectangle(edit.selectionStart).height + } + + BorderImage { + id: endHandle + source: "pics/endHandle.sci" + opacity: 0.0 + width: 10 + x: edit.positionToRectangle(edit.selectionEnd).x - flick.contentX + y: edit.positionToRectangle(edit.selectionEnd).y - flick.contentY + height: edit.positionToRectangle(edit.selectionEnd).height + } + + Flickable { + id: flick + + anchors.fill: parent + contentWidth: edit.paintedWidth + contentHeight: edit.paintedHeight + interactive: true + clip: true + + function ensureVisible(r) { + if (contentX >= r.x) + contentX = r.x; + else if (contentX+width <= r.x+r.width) + contentX = r.x+r.width-width; + if (contentY >= r.y) + contentY = r.y; + else if (contentY+height <= r.y+r.height) + contentY = r.y+r.height-height; + } + + TextEdit { + id: edit + width: flick.width + height: flick.height + focus: true + wrapMode: TextEdit.Wrap + + onCursorRectangleChanged: flick.ensureVisible(cursorRectangle) + + text: "

Text Selection

" + +"

This example is a whacky text selection mechanisms, showing how these can be implemented in the TextEdit element, to cater for whatever style is appropriate for the target platform." + +"

Press-and-hold to select a word, then drag the selection handles." + +"

Drag outside the selection to scroll the text." + +"

Click inside the selection to cut/copy/paste/cancel selection." + +"

It's too whacky to let you paste if there is no current selection." + + MouseArea { + property string drag: "" + property int pressPos + + x: -startHandle.width + y: 0 + width: parent.width+startHandle.width+endHandle.width + height: parent.height + + onPressAndHold: { + if (editor.state == "") { + edit.cursorPosition = edit.positionAt(mouse.x+x,mouse.y+y); + edit.selectWord(); + editor.state = "selection" + } + } + + onClicked: { + if (editor.state == "") { + edit.cursorPosition = edit.positionAt(mouse.x+x,mouse.y+y); + if (!edit.focus) + edit.focus = true; + edit.openSoftwareInputPanel(); + } + } + + function hitHandle(h,x,y) { + return x>=h.x+flick.contentX && x=h.y+flick.contentY && y= edit.selectionStart && pos <= edit.selectionEnd) { + drag = "selection" + flick.interactive = false + } else { + drag = "" + flick.interactive = true + } + } + } + } + + onReleased: { + if (editor.state == "selection") { + if (drag == "selection") { + editor.state = "menu" + } + drag = "" + } + flick.interactive = true + } + + onPositionChanged: { + if (editor.state == "selection" && drag != "") { + if (drag == "start") { + var pos = edit.positionAt(mouse.x+x+startHandle.width/2,mouse.y+y); + var e = edit.selectionEnd; + if (e < pos) + e = pos; + edit.select(pos,e); + } else if (drag == "end") { + var pos = edit.positionAt(mouse.x+x-endHandle.width/2,mouse.y+y); + var s = edit.selectionStart; + if (s > pos) + s = pos; + edit.select(s,pos); + } + } + } + } + } + } + + Item { + id: menu + opacity: 0.0 + width: 100 + height: 120 + anchors.centerIn: parent + + Rectangle { + border.width: 1 + border.color: "darkBlue" + radius: 15 + color: "#806080FF" + anchors.fill: parent + } + + Column { + anchors.centerIn: parent + spacing: 8 + + Rectangle { + border.width: 1 + border.color: "darkBlue" + color: "#ff7090FF" + width: 60 + height: 16 + + Text { anchors.centerIn: parent; text: "Cut" } + + MouseArea { + anchors.fill: parent + onClicked: { edit.cut(); editor.state = "" } + } + } + + Rectangle { + border.width: 1 + border.color: "darkBlue" + color: "#ff7090FF" + width: 60 + height: 16 + + Text { anchors.centerIn: parent; text: "Copy" } + + MouseArea { + anchors.fill: parent + onClicked: { edit.copy(); editor.state = "selection" } + } + } + + Rectangle { + border.width: 1 + border.color: "darkBlue" + color: "#ff7090FF" + width: 60 + height: 16 + + Text { anchors.centerIn: parent; text: "Paste" } + + MouseArea { + anchors.fill: parent + onClicked: { edit.paste(); edit.cursorPosition = edit.selectionEnd; editor.state = "" } + } + } + + Rectangle { + border.width: 1 + border.color: "darkBlue" + color: "#ff7090FF" + width: 60 + height: 16 + + Text { anchors.centerIn: parent; text: "Deselect" } + + MouseArea { + anchors.fill: parent + onClicked: { + edit.cursorPosition = edit.selectionEnd; + edit.select(edit.cursorPosition, edit.cursorPosition); + editor.state = "" + } + } + } + } + } + } + + states: [ + State { + name: "selection" + PropertyChanges { target: startHandle; opacity: 1.0 } + PropertyChanges { target: endHandle; opacity: 1.0 } + }, + State { + name: "menu" + PropertyChanges { target: startHandle; opacity: 0.5 } + PropertyChanges { target: endHandle; opacity: 0.5 } + PropertyChanges { target: menu; opacity: 1.0 } + } + ] +} diff --git a/examples/declarative/text/textselection/textselection.qmlproject b/examples/declarative/text/textselection/textselection.qmlproject new file mode 100644 index 0000000..d4909f8 --- /dev/null +++ b/examples/declarative/text/textselection/textselection.qmlproject @@ -0,0 +1,16 @@ +import QmlProject 1.0 + +Project { + /* Include .qml, .js, and image files from current directory and subdirectories */ + QmlFiles { + directory: "." + } + JavaScriptFiles { + directory: "." + } + ImageFiles { + directory: "." + } + /* List of plugin directories passed to QML runtime */ + // importPaths: [ " ../exampleplugin " ] +} -- cgit v0.12 From 2e0b872ed3f15db3f54fcf0cff7f2e412ba56e46 Mon Sep 17 00:00:00 2001 From: Bea Lam Date: Tue, 22 Jun 2010 11:21:45 +1000 Subject: Add screenshots for most examples and demos --- doc/src/declarative/examples.qdoc | 28 ++- doc/src/examples/qml-examples.qdoc | 236 +++++++++++++++++++-- doc/src/examples/qml-webbrowser.qdoc | 52 +++++ doc/src/images/declarative-folderlistmodel.png | Bin 17764 -> 14963 bytes doc/src/images/qml-behaviors-example.png | Bin 0 -> 6367 bytes doc/src/images/qml-borderimage-example.png | Bin 0 -> 25204 bytes doc/src/images/qml-borderimage-shadows-example.png | Bin 0 -> 2606 bytes doc/src/images/qml-calculator-example.png | Bin 33956 -> 33892 bytes doc/src/images/qml-coloranim-example.png | Bin 0 -> 6184 bytes doc/src/images/qml-dynamicscene-example.png | Bin 65247 -> 71620 bytes doc/src/images/qml-easing-example.png | Bin 0 -> 29397 bytes doc/src/images/qml-focus-example.png | Bin 26833 -> 43921 bytes .../images/qml-fonts-availableFonts-example.png | Bin 0 -> 33674 bytes doc/src/images/qml-fonts-banner-example.png | Bin 0 -> 8502 bytes doc/src/images/qml-fonts-fonts-example.png | Bin 0 -> 41568 bytes doc/src/images/qml-fonts-hello-example.png | Bin 0 -> 3213 bytes doc/src/images/qml-gridview-example.png | Bin 0 -> 24321 bytes doc/src/images/qml-i18n-example.png | Bin 0 -> 7683 bytes doc/src/images/qml-layoutitem-example.png | Bin 0 -> 3817 bytes .../images/qml-listview-dynamiclist-example.png | Bin 0 -> 33091 bytes .../qml-listview-expandingdelegates-example.png | Bin 0 -> 46012 bytes doc/src/images/qml-listview-highlight-example.png | Bin 0 -> 14216 bytes .../qml-listview-highlightranges-example.png | Bin 0 -> 44290 bytes doc/src/images/qml-mousearea-example.png | Bin 0 -> 5527 bytes doc/src/images/qml-objectlistmodel-example.png | Bin 0 -> 1618 bytes doc/src/images/qml-package-example.png | Bin 0 -> 4597 bytes doc/src/images/qml-parallax-example.png | Bin 0 -> 145854 bytes doc/src/images/qml-plugins-example.png | Bin 0 -> 15773 bytes doc/src/images/qml-positioners-example.png | Bin 0 -> 26813 bytes doc/src/images/qml-propertyanim-example.png | Bin 0 -> 5028 bytes doc/src/images/qml-qgraphicsgridlayout-example.png | Bin 0 -> 34384 bytes .../images/qml-qgraphicslinearlayout-example.png | Bin 0 -> 21677 bytes doc/src/images/qml-qwidgets-example.png | Bin 0 -> 13394 bytes doc/src/images/qml-rssnews-demo.png | Bin 143314 -> 128307 bytes doc/src/images/qml-samegame-demo.png | Bin 285415 -> 213137 bytes doc/src/images/qml-scrollbar-example.png | Bin 0 -> 266986 bytes doc/src/images/qml-states-example.png | Bin 0 -> 4344 bytes doc/src/images/qml-stringlistmodel-example.png | Bin 0 -> 1612 bytes doc/src/images/qml-tabwidget-example.png | Bin 6487 -> 5298 bytes doc/src/images/qml-textselection-example.png | Bin 0 -> 21889 bytes doc/src/images/qml-transitions-example.png | Bin 0 -> 4377 bytes doc/src/images/qml-tvtennis-example.png | Bin 2070 -> 1385 bytes doc/src/images/qml-visualitemmodel-example.png | Bin 0 -> 2166 bytes doc/src/images/qml-webbrowser-demo.png | Bin 0 -> 85107 bytes doc/src/images/qml-webview-alert-example.png | Bin 0 -> 5417 bytes doc/src/images/qml-webview-autosize-example.png | Bin 0 -> 11370 bytes doc/src/images/qml-webview-googlemaps-example.png | Bin 0 -> 133411 bytes doc/src/images/qml-webview-inlinehtml-example.png | Bin 0 -> 3877 bytes doc/src/images/qml-webview-newwindows-example.png | Bin 0 -> 6152 bytes doc/src/images/qml-xmlhttprequest-example.png | Bin 0 -> 21311 bytes 50 files changed, 283 insertions(+), 33 deletions(-) create mode 100644 doc/src/examples/qml-webbrowser.qdoc create mode 100644 doc/src/images/qml-behaviors-example.png create mode 100644 doc/src/images/qml-borderimage-example.png create mode 100644 doc/src/images/qml-borderimage-shadows-example.png create mode 100644 doc/src/images/qml-coloranim-example.png create mode 100644 doc/src/images/qml-easing-example.png create mode 100644 doc/src/images/qml-fonts-availableFonts-example.png create mode 100644 doc/src/images/qml-fonts-banner-example.png create mode 100644 doc/src/images/qml-fonts-fonts-example.png create mode 100644 doc/src/images/qml-fonts-hello-example.png create mode 100644 doc/src/images/qml-gridview-example.png create mode 100644 doc/src/images/qml-i18n-example.png create mode 100644 doc/src/images/qml-layoutitem-example.png create mode 100644 doc/src/images/qml-listview-dynamiclist-example.png create mode 100644 doc/src/images/qml-listview-expandingdelegates-example.png create mode 100644 doc/src/images/qml-listview-highlight-example.png create mode 100644 doc/src/images/qml-listview-highlightranges-example.png create mode 100644 doc/src/images/qml-mousearea-example.png create mode 100644 doc/src/images/qml-objectlistmodel-example.png create mode 100644 doc/src/images/qml-package-example.png create mode 100644 doc/src/images/qml-parallax-example.png create mode 100644 doc/src/images/qml-plugins-example.png create mode 100644 doc/src/images/qml-positioners-example.png create mode 100644 doc/src/images/qml-propertyanim-example.png create mode 100644 doc/src/images/qml-qgraphicsgridlayout-example.png create mode 100644 doc/src/images/qml-qgraphicslinearlayout-example.png create mode 100644 doc/src/images/qml-qwidgets-example.png create mode 100644 doc/src/images/qml-scrollbar-example.png create mode 100644 doc/src/images/qml-states-example.png create mode 100644 doc/src/images/qml-stringlistmodel-example.png create mode 100644 doc/src/images/qml-textselection-example.png create mode 100644 doc/src/images/qml-transitions-example.png create mode 100644 doc/src/images/qml-visualitemmodel-example.png create mode 100644 doc/src/images/qml-webbrowser-demo.png create mode 100644 doc/src/images/qml-webview-alert-example.png create mode 100644 doc/src/images/qml-webview-autosize-example.png create mode 100644 doc/src/images/qml-webview-googlemaps-example.png create mode 100644 doc/src/images/qml-webview-inlinehtml-example.png create mode 100644 doc/src/images/qml-webview-newwindows-example.png create mode 100644 doc/src/images/qml-xmlhttprequest-example.png diff --git a/doc/src/declarative/examples.qdoc b/doc/src/declarative/examples.qdoc index ad8c10c..dcd0362 100644 --- a/doc/src/declarative/examples.qdoc +++ b/doc/src/declarative/examples.qdoc @@ -72,7 +72,7 @@ For example, from your build directory, run: \list \o \l{declarative/animation/basics}{Basics} \o \l{declarative/animation/behaviors}{Behaviors} -\o \l{declarative/animation/easing}{Easing types} +\o \l{declarative/animation/easing}{Easing} \o \l{declarative/animation/states}{States} \endlist @@ -82,6 +82,12 @@ For example, from your build directory, run: \o \l{declarative/imageelements/image}{Image} \endlist +\section2 Text +\list +\o \l{declarative/text/fonts}{Fonts} +\o \l{declarative/text/textselection}{Text Selection} +\endlist + \section2 Positioners \list \o \l{declarative/positioners}{Example} @@ -122,6 +128,15 @@ For example, from your build directory, run: \o \l{declarative/modelviews/webview}{WebView} \endlist +\section2 Toys +\list +\o \l{declarative/toys/clocks}{Clocks} +\o \l{declarative/toys/corkboards}{Corkboards} +\o \l{declarative/toys/dynamicscene}{Dynamic Scene} +\o \l{declarative/toys/tic-tac-toe}{Tic Tac Toe} +\o \l{declarative/toys/tvtennis}{TV Tennis} +\endlist + \section2 XML \list \o \l{declarative/xml/xmlhttprequest}{XmlHttpRequest} @@ -153,15 +168,6 @@ For example, from your build directory, run: \o \l{declarative/cppextensions/networkaccessmanagerfactory}{Network access manager factory} \endlist -\section2 Toys -\list -\o \l{declarative/toys/clocks}{Clocks} -\o \l{declarative/toys/corkboards}{Corkboards} -\o \l{declarative/toys/dynamicscene}{Dynamic Scene} -\o \l{declarative/toys/tic-tac-toe}{Tic Tac Toe} -\o \l{declarative/toys/tvtennis}{TV Tennis} -\endlist - \section1 Demos @@ -173,6 +179,8 @@ For example, from your build directory, run: \o \l{demos/declarative/rssnews}{RSS News Reader} \o \l{demos/declarative/samegame}{Same Game} \o \l{demos/declarative/snake}{Snake} +\o \l{demos/declarative/twitter}{Twitter} +\o \l{demos/declarative/webbrowser}{Web Browser} \endlist \section1 Labs diff --git a/doc/src/examples/qml-examples.qdoc b/doc/src/examples/qml-examples.qdoc index ee708a8..1c0680d 100644 --- a/doc/src/examples/qml-examples.qdoc +++ b/doc/src/examples/qml-examples.qdoc @@ -43,7 +43,21 @@ \title Animation: Basics \example declarative/animation/basics - This example shows how to create \l{QML Animation}{animations} in QML. + This example shows how to create and combine \l{QML Animation}{animations} in QML. + + \table + \row + \o \image qml-coloranim-example.png + \row + \o color-animation.qml + \endtable + + \table + \row + \o \image qml-propertyanim-example.png + \row + \o property-animation.qml + \endtable */ /*! @@ -51,34 +65,69 @@ \example declarative/animation/behaviors This example shows how to use QML behaviors. + + \image qml-behaviors-example.png */ /*! - \title Animation: Easing types + \title Animation: Easing \example declarative/animation/easing This example shows the different easing modes available for \l{QML Animation}{animations}. + + \image qml-easing-example.png */ /*! \title Animation: States \example declarative/animation/states - This example shows how to use \l{States}{states} and \l{Transitions}{transitions}. + These examples show how to use \l{States}{states} and \l{Transitions}{transitions}. + + The \c states.qml example shows how an item can change between states, and \c transitions.qml + shows how these state changes can be animated. + + \table + \row + \o \image qml-states-example.png + \row + \o states.qml + \endtable + + \table + \row + \o \image qml-transitions-example.png + \row + \o transitions.qml + \endtable */ /*! \title Image Elements: Border Image \example declarative/imageelements/borderimage - This example shows how to use the BorderImage element. + These examples show how to use the BorderImage element. + + \table + \row + \o \image qml-borderimage-example.png + \row + \o borderimage.qml + \endtable + + \table + \row + \o \image qml-borderimage-shadows-example.png + \row + \o shadows.qml + \endtable */ /*! \title Image Elements: Image \example declarative/imageelements/image - This example shows how to use the Image element and its \l{Image::fillMode}{fillModes}. + This example shows how to use the \l Image element and its \l{Image::fillMode}{fillModes}. \image qml-image-example.png */ @@ -116,6 +165,8 @@ \example declarative/cppextensions/plugins This example shows how to create a C++ plugin extension by subclassing QDeclarativeExtensionPlugin. + + \image qml-plugins-example.png */ /*! @@ -124,6 +175,8 @@ This example show how to use the LayoutItem element to integrate QML items into an existing \l{Graphics View Framework}{Graphics View}-based application. + + \image qml-layoutitem-example.png */ /*! \title QGraphicsGridLayout @@ -132,6 +185,8 @@ This example shows how to use QGraphicsGridLayout to lay out QML items. This is useful if you need to integrate Qt \l{Graphics View Framework}{Graphics View} layouts with QML. + + \image qml-qgraphicsgridlayout-example.png */ /*! \title QGraphicsLinearLayout @@ -140,6 +195,8 @@ This example shows how to use QGraphicsLinearLayout to lay out QML items. This is useful if you need to integrate Qt \l{Graphics View Framework}{Graphics View} layouts with QML. + + \image qml-qgraphicslinearlayout-example.png */ /*! \page declarative-cppextensions-qgraphicslayouts.html @@ -160,6 +217,8 @@ \example declarative/cppextensions/qwidgets This example shows how to embed QWidget-based objects into QML using QGraphicsProxyWidget. + + \image qml-qwidgets-example.png */ /*! @@ -171,7 +230,7 @@ */ /*! - \title C++ Extensions: Network access manager + \title C++ Extensions: Network access manager factory \example declarative/cppextensions/networkaccessmanagerfactory This example shows how to use QDeclarativeNetworkAccessManagerFactory to create a QNetworkAccessManager @@ -183,21 +242,25 @@ \example declarative/i18n This example shows how to enable text translation in QML. + + \image qml-i18n-example.png */ /*! \title Positioners \example declarative/positioners - This example shows how to use positioner elements such as Row, Column, - Grid and Flow. + This example shows how to use positioner elements such as \l Row, \l Column, + \l Grid and \l Flow. + + \image qml-positioners-example.png */ /*! \title Key Interaction: Focus \example declarative/keyinteraction/focus - This example shows how to handle keys and focus in QML. + This example shows how to handle keyboard input and focus in QML. \image qml-focus-example.png */ @@ -207,6 +270,8 @@ \example declarative/modelviews/gridview This example shows how to use the GridView element. + + \image qml-gridview-example.png */ /*! @@ -214,6 +279,41 @@ \example declarative/modelviews/listview These examples show how to use the ListView element. + + \table + \row + \o \image qml-listview-dynamiclist-example.png + \row + \o dynamiclist.qml + \endtable + + \table + \row + \o \image qml-listview-expandingdelegates-example.png + \row + \o expandingdelegates.qml + \endtable + + \table + \row + \o \image qml-listview-highlight-example.png + \row + \o highlight.qml + \endtable + + \table + \row + \o \image qml-listview-highlightranges-example.png + \row + \o highlightranges.qml + \endtable + + \table + \row + \o \image qml-listview-sections-example.png + \row + \o sections.qml + \endtable */ /*! @@ -222,13 +322,17 @@ This example shows how to create a C++ extension that exposes a QList as a model in QML. + + \image qml-objectlistmodel-example.png */ /*! \title Models and Views: Package \example declarative/modelviews/package - This example shows how to use the Package element. + This example shows how to use the \l Package element. + + \image qml-package-example.png */ /*! @@ -236,6 +340,8 @@ \example declarative/modelviews/parallax This example shows how to combine and switch between views. + + \image qml-parallax-example.png */ /*! @@ -244,6 +350,8 @@ This example shows how to create a C++ extension that exposes a QStringList as a model in QML. + + \image qml-stringlistmodel-example.png */ /*! @@ -251,13 +359,50 @@ \example declarative/modelviews/visualitemmodel This example shows how to use the VisualItemModel element. + + \image qml-visualitemmodel-example.png */ /*! \title Models and Views: WebView \example declarative/modelviews/webview - This example shows how to use the WebView element. + These examples shows how to use the WebView element. + + \table + \row + \o \image qml-webview-alert-example.png + \row + \o alert.qml + \endtable + + \table + \row + \o \image qml-webview-autosize-example.png + \row + \o autosize.qml + \endtable + + \table + \row + \o \image qml-webview-googlemaps-example.png + \row + \o googlemaps.qml + \endtable + + \table + \row + \o \image qml-webview-inlinehtml-example.png + \row + \o inlinehtml.qml + \endtable + + \table + \row + \o \image qml-webview-newwindows-example.png + \row + \o newwindows.qml + \endtable */ /*! @@ -271,8 +416,46 @@ \title Text: Fonts \example declarative/text/fonts - This example shows how to discover available fonts from QML and use - fonts in different ways. + These examples show how to discover available fonts from QML and manipulate + text in various ways. + + \table + \row + \o \image qml-fonts-availableFonts-example.png + \row + \o availableFonts.qml + \endtable + + \table + \row + \o \image qml-fonts-banner-example.png + \row + \o banner.qml + \endtable + + \table + \row + \o \image qml-fonts-fonts-example.png + \row + \o fonts.qml + \endtable + + \table + \row + \o \image qml-fonts-hello-example.png + \row + \o hello.qml + \endtable +*/ + +/*! + \title Text: Text Selection + \example declarative/text/textselection + + This example shows how text selection, copy and paste operations + can be implemented on top of the TextEdit element. + + \image qml-textselection-example.png */ /*! @@ -350,18 +533,22 @@ */ /*! - \title Touch Interaction: Mouse Area + \title Touch Interaction: MouseArea \example declarative/touchinteraction/mousearea - This example shows how to use the MouseArea element. + This example shows how to use the MouseArea element to access information + about mouse input. + + \image qml-mousearea-example.png */ /*! \title UI Components: Dial \example declarative/ui-components/dialcontrol - This example presents an interactive speedometer-type dial by combining - \l Image elements with \l Rotation transforms and \l SpringFollow animations. + This example shows how to create a dial-type control. It combines + \l Image elements with \l Rotation transforms and \l SpringFollow animations + to produce an interactive speedometer-type dial. \image qml-dialcontrol-example.png */ @@ -371,7 +558,7 @@ \title UI Components: Flipable \example declarative/ui-components/flipable - This example shows how to use the Flipable element. + This example shows how to use the \l Flipable element. \image qml-flipable-example.png */ @@ -389,7 +576,7 @@ \title UI Components: Scroll Bar \example declarative/ui-components/scrollbar - This example shows how to create scroll bars for a Flickable element + This example shows how to create scroll bars for a \l Flickable element using the \l {Flickable::visibleArea.xPosition}{Flickable::visibleArea} properties. @@ -400,7 +587,8 @@ \title UI Components: Search Box \example declarative/ui-components/searchbox - This example shows how to create a search box. + This example shows how to combine TextInput, FocusScope and BorderImage + elements to display multiple text input fields. \image qml-searchbox-example.png */ @@ -409,7 +597,7 @@ \title UI Components: Slide Switch \example declarative/ui-components/slideswitch - This example shows how to create a slide switch. + This example shows how to create a slide switch control. \image qml-slideswitch-example.png */ @@ -418,7 +606,7 @@ \title UI Components: Spinner \example declarative/ui-components/spinner - This example shows how to create a spinner-type component. + This example shows how to create a spinner-type component using the PathView element. \image qml-spinner-example.png */ @@ -436,5 +624,7 @@ \title XML: XMLHttpRequest \example declarative/xml/xmlhttprequest - This example shows how to use \l XmlHttpRequest in QML. + This example shows how to use the \l XmlHttpRequest API in QML. + + \image qml-xmlhttprequest-example.png */ diff --git a/doc/src/examples/qml-webbrowser.qdoc b/doc/src/examples/qml-webbrowser.qdoc new file mode 100644 index 0000000..da6f600 --- /dev/null +++ b/doc/src/examples/qml-webbrowser.qdoc @@ -0,0 +1,52 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! + \title Web Browser + \example demos/declarative/webbrowser + + This demo shows how to write a simple web browser in QML by combining the + WebView element with other components including scroll bars, + \l Flickable views and TextInput fields. + + \image qml-webbrowser-demo.png +*/ + diff --git a/doc/src/images/declarative-folderlistmodel.png b/doc/src/images/declarative-folderlistmodel.png index a469f96..fbed4f8 100644 Binary files a/doc/src/images/declarative-folderlistmodel.png and b/doc/src/images/declarative-folderlistmodel.png differ diff --git a/doc/src/images/qml-behaviors-example.png b/doc/src/images/qml-behaviors-example.png new file mode 100644 index 0000000..aee5c2b Binary files /dev/null and b/doc/src/images/qml-behaviors-example.png differ diff --git a/doc/src/images/qml-borderimage-example.png b/doc/src/images/qml-borderimage-example.png new file mode 100644 index 0000000..7e488f2 Binary files /dev/null and b/doc/src/images/qml-borderimage-example.png differ diff --git a/doc/src/images/qml-borderimage-shadows-example.png b/doc/src/images/qml-borderimage-shadows-example.png new file mode 100644 index 0000000..4700868 Binary files /dev/null and b/doc/src/images/qml-borderimage-shadows-example.png differ diff --git a/doc/src/images/qml-calculator-example.png b/doc/src/images/qml-calculator-example.png index 19ce1b6..0f9ced8 100644 Binary files a/doc/src/images/qml-calculator-example.png and b/doc/src/images/qml-calculator-example.png differ diff --git a/doc/src/images/qml-coloranim-example.png b/doc/src/images/qml-coloranim-example.png new file mode 100644 index 0000000..12edc99 Binary files /dev/null and b/doc/src/images/qml-coloranim-example.png differ diff --git a/doc/src/images/qml-dynamicscene-example.png b/doc/src/images/qml-dynamicscene-example.png index 1f725d1..4179ebe 100644 Binary files a/doc/src/images/qml-dynamicscene-example.png and b/doc/src/images/qml-dynamicscene-example.png differ diff --git a/doc/src/images/qml-easing-example.png b/doc/src/images/qml-easing-example.png new file mode 100644 index 0000000..fef5b70 Binary files /dev/null and b/doc/src/images/qml-easing-example.png differ diff --git a/doc/src/images/qml-focus-example.png b/doc/src/images/qml-focus-example.png index 5a114a0..0ec2bff 100644 Binary files a/doc/src/images/qml-focus-example.png and b/doc/src/images/qml-focus-example.png differ diff --git a/doc/src/images/qml-fonts-availableFonts-example.png b/doc/src/images/qml-fonts-availableFonts-example.png new file mode 100644 index 0000000..4d8440c Binary files /dev/null and b/doc/src/images/qml-fonts-availableFonts-example.png differ diff --git a/doc/src/images/qml-fonts-banner-example.png b/doc/src/images/qml-fonts-banner-example.png new file mode 100644 index 0000000..b415161 Binary files /dev/null and b/doc/src/images/qml-fonts-banner-example.png differ diff --git a/doc/src/images/qml-fonts-fonts-example.png b/doc/src/images/qml-fonts-fonts-example.png new file mode 100644 index 0000000..4481397 Binary files /dev/null and b/doc/src/images/qml-fonts-fonts-example.png differ diff --git a/doc/src/images/qml-fonts-hello-example.png b/doc/src/images/qml-fonts-hello-example.png new file mode 100644 index 0000000..18da867 Binary files /dev/null and b/doc/src/images/qml-fonts-hello-example.png differ diff --git a/doc/src/images/qml-gridview-example.png b/doc/src/images/qml-gridview-example.png new file mode 100644 index 0000000..8a092b5 Binary files /dev/null and b/doc/src/images/qml-gridview-example.png differ diff --git a/doc/src/images/qml-i18n-example.png b/doc/src/images/qml-i18n-example.png new file mode 100644 index 0000000..8e734ea Binary files /dev/null and b/doc/src/images/qml-i18n-example.png differ diff --git a/doc/src/images/qml-layoutitem-example.png b/doc/src/images/qml-layoutitem-example.png new file mode 100644 index 0000000..b3c778a Binary files /dev/null and b/doc/src/images/qml-layoutitem-example.png differ diff --git a/doc/src/images/qml-listview-dynamiclist-example.png b/doc/src/images/qml-listview-dynamiclist-example.png new file mode 100644 index 0000000..6acc3d9 Binary files /dev/null and b/doc/src/images/qml-listview-dynamiclist-example.png differ diff --git a/doc/src/images/qml-listview-expandingdelegates-example.png b/doc/src/images/qml-listview-expandingdelegates-example.png new file mode 100644 index 0000000..e7ffc33 Binary files /dev/null and b/doc/src/images/qml-listview-expandingdelegates-example.png differ diff --git a/doc/src/images/qml-listview-highlight-example.png b/doc/src/images/qml-listview-highlight-example.png new file mode 100644 index 0000000..4f95c13 Binary files /dev/null and b/doc/src/images/qml-listview-highlight-example.png differ diff --git a/doc/src/images/qml-listview-highlightranges-example.png b/doc/src/images/qml-listview-highlightranges-example.png new file mode 100644 index 0000000..f499caa Binary files /dev/null and b/doc/src/images/qml-listview-highlightranges-example.png differ diff --git a/doc/src/images/qml-mousearea-example.png b/doc/src/images/qml-mousearea-example.png new file mode 100644 index 0000000..c6e52d6 Binary files /dev/null and b/doc/src/images/qml-mousearea-example.png differ diff --git a/doc/src/images/qml-objectlistmodel-example.png b/doc/src/images/qml-objectlistmodel-example.png new file mode 100644 index 0000000..c0fc490 Binary files /dev/null and b/doc/src/images/qml-objectlistmodel-example.png differ diff --git a/doc/src/images/qml-package-example.png b/doc/src/images/qml-package-example.png new file mode 100644 index 0000000..f7749aa Binary files /dev/null and b/doc/src/images/qml-package-example.png differ diff --git a/doc/src/images/qml-parallax-example.png b/doc/src/images/qml-parallax-example.png new file mode 100644 index 0000000..2df52ed Binary files /dev/null and b/doc/src/images/qml-parallax-example.png differ diff --git a/doc/src/images/qml-plugins-example.png b/doc/src/images/qml-plugins-example.png new file mode 100644 index 0000000..c2d4886 Binary files /dev/null and b/doc/src/images/qml-plugins-example.png differ diff --git a/doc/src/images/qml-positioners-example.png b/doc/src/images/qml-positioners-example.png new file mode 100644 index 0000000..721c1b3 Binary files /dev/null and b/doc/src/images/qml-positioners-example.png differ diff --git a/doc/src/images/qml-propertyanim-example.png b/doc/src/images/qml-propertyanim-example.png new file mode 100644 index 0000000..46efc64 Binary files /dev/null and b/doc/src/images/qml-propertyanim-example.png differ diff --git a/doc/src/images/qml-qgraphicsgridlayout-example.png b/doc/src/images/qml-qgraphicsgridlayout-example.png new file mode 100644 index 0000000..1a3bd47 Binary files /dev/null and b/doc/src/images/qml-qgraphicsgridlayout-example.png differ diff --git a/doc/src/images/qml-qgraphicslinearlayout-example.png b/doc/src/images/qml-qgraphicslinearlayout-example.png new file mode 100644 index 0000000..3964f5b Binary files /dev/null and b/doc/src/images/qml-qgraphicslinearlayout-example.png differ diff --git a/doc/src/images/qml-qwidgets-example.png b/doc/src/images/qml-qwidgets-example.png new file mode 100644 index 0000000..262b3df Binary files /dev/null and b/doc/src/images/qml-qwidgets-example.png differ diff --git a/doc/src/images/qml-rssnews-demo.png b/doc/src/images/qml-rssnews-demo.png index 948ef4d..b4143b4 100644 Binary files a/doc/src/images/qml-rssnews-demo.png and b/doc/src/images/qml-rssnews-demo.png differ diff --git a/doc/src/images/qml-samegame-demo.png b/doc/src/images/qml-samegame-demo.png index c17b4e0..945f2b9 100644 Binary files a/doc/src/images/qml-samegame-demo.png and b/doc/src/images/qml-samegame-demo.png differ diff --git a/doc/src/images/qml-scrollbar-example.png b/doc/src/images/qml-scrollbar-example.png new file mode 100644 index 0000000..4cf7c2c Binary files /dev/null and b/doc/src/images/qml-scrollbar-example.png differ diff --git a/doc/src/images/qml-states-example.png b/doc/src/images/qml-states-example.png new file mode 100644 index 0000000..30514ec Binary files /dev/null and b/doc/src/images/qml-states-example.png differ diff --git a/doc/src/images/qml-stringlistmodel-example.png b/doc/src/images/qml-stringlistmodel-example.png new file mode 100644 index 0000000..c8c888b Binary files /dev/null and b/doc/src/images/qml-stringlistmodel-example.png differ diff --git a/doc/src/images/qml-tabwidget-example.png b/doc/src/images/qml-tabwidget-example.png index 05887f3..847052d 100644 Binary files a/doc/src/images/qml-tabwidget-example.png and b/doc/src/images/qml-tabwidget-example.png differ diff --git a/doc/src/images/qml-textselection-example.png b/doc/src/images/qml-textselection-example.png new file mode 100644 index 0000000..284ef53 Binary files /dev/null and b/doc/src/images/qml-textselection-example.png differ diff --git a/doc/src/images/qml-transitions-example.png b/doc/src/images/qml-transitions-example.png new file mode 100644 index 0000000..8656bfe Binary files /dev/null and b/doc/src/images/qml-transitions-example.png differ diff --git a/doc/src/images/qml-tvtennis-example.png b/doc/src/images/qml-tvtennis-example.png index ac2b527..1a38034 100644 Binary files a/doc/src/images/qml-tvtennis-example.png and b/doc/src/images/qml-tvtennis-example.png differ diff --git a/doc/src/images/qml-visualitemmodel-example.png b/doc/src/images/qml-visualitemmodel-example.png new file mode 100644 index 0000000..c716a59 Binary files /dev/null and b/doc/src/images/qml-visualitemmodel-example.png differ diff --git a/doc/src/images/qml-webbrowser-demo.png b/doc/src/images/qml-webbrowser-demo.png new file mode 100644 index 0000000..9ff471e Binary files /dev/null and b/doc/src/images/qml-webbrowser-demo.png differ diff --git a/doc/src/images/qml-webview-alert-example.png b/doc/src/images/qml-webview-alert-example.png new file mode 100644 index 0000000..c1cddce Binary files /dev/null and b/doc/src/images/qml-webview-alert-example.png differ diff --git a/doc/src/images/qml-webview-autosize-example.png b/doc/src/images/qml-webview-autosize-example.png new file mode 100644 index 0000000..5cec614 Binary files /dev/null and b/doc/src/images/qml-webview-autosize-example.png differ diff --git a/doc/src/images/qml-webview-googlemaps-example.png b/doc/src/images/qml-webview-googlemaps-example.png new file mode 100644 index 0000000..d6c77a1 Binary files /dev/null and b/doc/src/images/qml-webview-googlemaps-example.png differ diff --git a/doc/src/images/qml-webview-inlinehtml-example.png b/doc/src/images/qml-webview-inlinehtml-example.png new file mode 100644 index 0000000..426cf8a Binary files /dev/null and b/doc/src/images/qml-webview-inlinehtml-example.png differ diff --git a/doc/src/images/qml-webview-newwindows-example.png b/doc/src/images/qml-webview-newwindows-example.png new file mode 100644 index 0000000..bd98b57 Binary files /dev/null and b/doc/src/images/qml-webview-newwindows-example.png differ diff --git a/doc/src/images/qml-xmlhttprequest-example.png b/doc/src/images/qml-xmlhttprequest-example.png new file mode 100644 index 0000000..68e7d27 Binary files /dev/null and b/doc/src/images/qml-xmlhttprequest-example.png differ -- cgit v0.12