diff options
author | Olivier Goffart <olivier.goffart@nokia.com> | 2011-03-31 13:54:58 (GMT) |
---|---|---|
committer | Olivier Goffart <olivier.goffart@nokia.com> | 2011-03-31 13:54:58 (GMT) |
commit | 37feac98c573a099502fddfb5703c2359711b4c4 (patch) | |
tree | 33d74f9650065de4564bc0d749ca50bd65b13a2c /doc/src/snippets/declarative | |
parent | 7b18baf23b1e8c663872b2b25b1323798b1d09df (diff) | |
parent | b764d3e6cb114988394e7500236ba087a3385a50 (diff) | |
download | Qt-37feac98c573a099502fddfb5703c2359711b4c4.zip Qt-37feac98c573a099502fddfb5703c2359711b4c4.tar.gz Qt-37feac98c573a099502fddfb5703c2359711b4c4.tar.bz2 |
Merge remote-tracking branch 'origin/4.7' into qt-master-from-4.7
Conflicts:
doc/src/declarative/example-slideswitch.qdoc
doc/src/development/qmake-manual.qdoc
doc/src/snippets/code/doc_src_qmake-manual.pro
doc/src/snippets/code/doc_src_qtscript.qdoc
src/corelib/animation/qabstractanimation.cpp
src/s60installs/bwins/QtOpenGLu.def
src/s60installs/eabi/QtOpenGLu.def
src/s60installs/eabi/QtOpenVGu.def
tests/auto/qdir/qdir.pro
tests/auto/qsslsocket/tst_qsslsocket.cpp
tools/qdoc3/doc/qdoc-manual.qdocconf
Diffstat (limited to 'doc/src/snippets/declarative')
48 files changed, 1444 insertions, 1114 deletions
diff --git a/doc/src/snippets/declarative/qml-intro/anchors2.qml b/doc/src/snippets/declarative/Button.qml index 2c4ce11..214dfea 100644 --- a/doc/src/snippets/declarative/qml-intro/anchors2.qml +++ b/doc/src/snippets/declarative/Button.qml @@ -41,18 +41,27 @@ //! [document] import QtQuick 1.0 +//! [parent begin] Rectangle { - id: myWin - width: 500 - height: 400 - - Image { - id: image1 - source: "images/qt-logo.svg" - width: 150; height: 150 - anchors.bottom: myWin.bottom - anchors.horizontalCenter: myWin.horizontalCenter - anchors.bottomMargin: 10 - } +//! [parent begin] + +//! [property alias] +property alias buttonLabel: label.text +Text { + id: label + text: "empty label" +} + //! [property alias] + +//! [id alias] + property alias buttonImage: image + + Image {id: image} +//! [id alias] +//! [parent end] } +//! [parent end] + //! [document] + + diff --git a/doc/src/snippets/declarative/animation-easing.qml b/doc/src/snippets/declarative/animation-easing.qml deleted file mode 100644 index 64ba44c..0000000 --- a/doc/src/snippets/declarative/animation-easing.qml +++ /dev/null @@ -1,51 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 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:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor -** the names of its contributors may be used to endorse or promote -** products derived from this software without specific prior written -** permission. -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** $QT_END_LICENSE$ -** -****************************************************************************/ -//![0] -import QtQuick 1.0 - -Rectangle { - width: 100; height: 100 - color: "red" - - PropertyAnimation on x { to: 50; duration: 1000; easing.type: Easing.OutBounce } - PropertyAnimation on y { to: 50; duration: 1000; easing.type: Easing.OutBounce } -} -//![0] - diff --git a/doc/src/snippets/declarative/animation-elements.qml b/doc/src/snippets/declarative/animation-elements.qml deleted file mode 100644 index d9bfc28..0000000 --- a/doc/src/snippets/declarative/animation-elements.qml +++ /dev/null @@ -1,66 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 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:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor -** the names of its contributors may be used to endorse or promote -** products derived from this software without specific prior written -** permission. -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** $QT_END_LICENSE$ -** -****************************************************************************/ -//![0] -import QtQuick 1.0 - -Row { - -//![color] -Rectangle { - width: 100; height: 100 - - ColorAnimation on color { from: "red"; to: "yellow"; duration: 1000 } -} -//![color] - -//![rotation] -Item { - width: 300; height: 300 - - Rectangle { - width: 100; height: 100; anchors.centerIn: parent - color: "red" - - RotationAnimation on rotation { to: 90; direction: RotationAnimation.Clockwise } - } -} -//![rotation] - -} diff --git a/doc/src/snippets/declarative/animation-groups.qml b/doc/src/snippets/declarative/animation-groups.qml deleted file mode 100644 index f29ea48..0000000 --- a/doc/src/snippets/declarative/animation-groups.qml +++ /dev/null @@ -1,104 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 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:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor -** the names of its contributors may be used to endorse or promote -** products derived from this software without specific prior written -** permission. -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** $QT_END_LICENSE$ -** -****************************************************************************/ -import QtQuick 1.0 - -Row { - -//![0] -Rectangle { - id: rect - width: 120; height: 200 - - Image { - id: img - source: "pics/qt.png" - anchors.horizontalCenter: parent.horizontalCenter - y: 0 - - SequentialAnimation on y { - loops: Animation.Infinite - NumberAnimation { to: rect.height - img.height; easing.type: Easing.OutBounce; duration: 2000 } - PauseAnimation { duration: 1000 } - NumberAnimation { to: 0; easing.type: Easing.OutQuad; duration: 1000 } - } - } -} -//![0] - -//![1] -Rectangle { - id: redRect - width: 100; height: 100 - color: "red" - - MouseArea { id: mouseArea; anchors.fill: parent } - - states: State { - name: "pressed"; when: mouseArea.pressed - PropertyChanges { target: redRect; color: "blue"; y: mouseArea.mouseY; width: mouseArea.mouseX } - } - - transitions: Transition { - - SequentialAnimation { - ColorAnimation { duration: 200 } - PauseAnimation { duration: 100 } - - ParallelAnimation { - NumberAnimation { - duration: 500 - easing.type: Easing.OutBounce - targets: redRect - properties: "y" - } - - NumberAnimation { - duration: 800 - easing.type: Easing.InOutQuad - targets: redRect - properties: "width" - } - } - } - } -} -//![1] - -} diff --git a/doc/src/snippets/declarative/animation-propertyvaluesource.qml b/doc/src/snippets/declarative/animation-propertyvaluesource.qml deleted file mode 100644 index 6f93967..0000000 --- a/doc/src/snippets/declarative/animation-propertyvaluesource.qml +++ /dev/null @@ -1,51 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 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:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor -** the names of its contributors may be used to endorse or promote -** products derived from this software without specific prior written -** permission. -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** $QT_END_LICENSE$ -** -****************************************************************************/ -//![0] -import QtQuick 1.0 - -Rectangle { - width: 100; height: 100 - color: "red" - - PropertyAnimation on x { to: 50; duration: 1000; loops: Animation.Infinite } - PropertyAnimation on y { to: 50; duration: 1000; loops: Animation.Infinite } -} -//![0] - diff --git a/doc/src/snippets/declarative/animation.qml b/doc/src/snippets/declarative/animation.qml new file mode 100644 index 0000000..ae6142d --- /dev/null +++ b/doc/src/snippets/declarative/animation.qml @@ -0,0 +1,226 @@ +/**************************************************************************** +** +** Copyright (C) 2011 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: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$ +** +****************************************************************************/ +//! [document] +import QtQuick 1.0 + + +//! [parent begin] +Rectangle { +//! [parent begin] + width: 200; height: 600 + id: screen + +Column { + spacing: 12 +//! [direct property change] +Rectangle { + id: blob + width: 75; height: 75 + color: "blue" + + MouseArea { + anchors.fill: parent + onClicked: blob.color = "green" + } +} +//! [direct property change] + +//! [property animation] +Rectangle { + id: flashingblob + width: 75; height: 75 + color: "blue" + opacity: 1.0 + + MouseArea { + anchors.fill: parent + onClicked: { + animateColor.start() + animateOpacity.start() + } + } + + PropertyAnimation {id: animateColor; target: flashingblob; properties: "color"; to: "green"; duration: 100} + + NumberAnimation { + id: animateOpacity + target: flashingblob + properties: "opacity" + from: 0.99 + to: 1.0 + loops: Animation.Infinite + easing {type: Easing.OutBack; overshoot: 500} + } +} +//! [property animation] + +//! [transition animation] +Rectangle { + width: 75; height: 75 + id: button + state: "RELEASED" + + MouseArea { + anchors.fill: parent + onPressed: button.state = "PRESSED" + onReleased: button.state = "RELEASED" + } + + states: [ + State { + name: "PRESSED" + PropertyChanges { target: button; color: "lightblue"} + }, + State { + name: "RELEASED" + PropertyChanges { target: button; color: "lightsteelblue"} + } + ] + + transitions: [ + Transition { + from: "PRESSED" + to: "RELEASED" + ColorAnimation { target: button; duration: 100} + }, + Transition { + from: "RELEASED" + to: "PRESSED" + ColorAnimation { target: button; duration: 100} + } + ] +} +//! [transition animation] + +Rectangle { + width: 75; height: 75 + id: wildcard + color: "green" +//! [wildcard animation] + transitions: + Transition { + to: "*" + ColorAnimation { target: button; duration: 100} + } +//! [wildcard animation] + + MouseArea { + anchors.fill: parent + onPressed: { + ball.x = 10 + ball.color = "red" + } + onReleased: { + ball.x = screen.width / 2 + ball.color = "salmon" + } + } +} + +//! [behavior animation] +Rectangle { + width: 75; height: 75; radius: width + id: ball + color: "salmon" + + Behavior on x { + NumberAnimation { + id: bouncebehavior + easing { + type: Easing.OutElastic + amplitude: 1.0 + period: 0.5 + } + } + } + Behavior on y { + animation: bouncebehavior + } + Behavior { + ColorAnimation { target: ball; duration: 100 } + } +} +//! [behavior animation] + +//! [sequential animation] +Rectangle { + id: banner + width: 150; height: 100; border.color: "black" + + Column { + anchors.centerIn: parent + Text { + id: code + text: "Code less." + opacity: 0.01 + } + Text { + id: create + text: "Create more." + opacity: 0.01 + } + Text { + id: deploy + text: "Deploy everywhere." + opacity: 0.01 + } + } + + MouseArea { + anchors.fill: parent + onPressed: playbanner.start() + } + + SequentialAnimation { + id: playbanner + running: false + NumberAnimation { target: code; property: "opacity"; to: 1.0; duration: 200} + NumberAnimation { target: create; property: "opacity"; to: 1.0; duration: 200} + NumberAnimation { target: deploy; property: "opacity"; to: 1.0; duration: 200} + } +} +//! [sequential animation] + +}//end of col +//! [parent end] +} +//! [parent end] + +//! [document] diff --git a/doc/src/snippets/declarative/animation-signalhandler.qml b/doc/src/snippets/declarative/bestpractices/group.qml index 416417f..8a2b398 100644 --- a/doc/src/snippets/declarative/animation-signalhandler.qml +++ b/doc/src/snippets/declarative/bestpractices/group.qml @@ -37,19 +37,40 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ -//![0] + + +//! [document] import QtQuick 1.0 +//! [parent begin] Rectangle { - id: rect - width: 100; height: 100 - color: "red" +//! [parent begin] + width: 175; height: 175; color: "white" - MouseArea { - anchors.fill: parent - onClicked: PropertyAnimation { target: rect; properties: "x,y"; to: 50; duration: 1000 } - } +Rectangle{ +width: 170; height: 170 +//! [not grouped] +border.width: 1 +border.color: "red" +anchors.bottom: parent.bottom +anchors.left: parent.left +//! [not grouped] } +Rectangle { + width: 100; height: 100 -//![0] - +//! [grouped] +border { + width: 1; + color: "red" +} +anchors { + bottom: parent.bottom; + left: parent.left +} +//! [grouped] +} +//! [parent end] +} +//! [parent end] +//! [document] diff --git a/doc/src/snippets/declarative/events.qml b/doc/src/snippets/declarative/events.qml new file mode 100644 index 0000000..3dc44f2 --- /dev/null +++ b/doc/src/snippets/declarative/events.qml @@ -0,0 +1,141 @@ +/**************************************************************************** +** +** Copyright (C) 2011 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: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$ +** +****************************************************************************/ +//![document] +import QtQuick 1.0 + +//![parent begin] +Rectangle { +//![parent begin] + + id: screen + width: 400; height: 500 + +//! [signal declaration] + signal trigger + signal send (string notice) + signal perform (string task, variant object) +//! [signal declaration] + +//! [signal handler declaration] +onTrigger: console.log("trigger signal emitted") + +onSend: { + console.log("send signal emitted with notice: " + notice) +} + +onPerform: console.log("perform signal emitted") +//! [signal handler declaration] + +//! [automatic signals] +Rectangle { + id: sprite + width: 25; height: 25 + x: 50; y: 15 + + onXChanged: console.log("x property changed, emitted xChanged signal") + onYChanged: console.log("y property changed, emitted yChanged signal") +} +//! [automatic signals] + +//! [signal emit] +Rectangle { + id: messenger + + signal send( string person, string notice) + + onSend: { + console.log("For " + person + ", the notice is: " + notice) + } + + Component.onCompleted: messenger.send("Tom", "the door is ajar.") +} +//! [signal emit] + +//! [connect method] +Rectangle { + id: relay + + signal send( string person, string notice) + onSend: console.log("Send signal to: " + person + ", " + notice) + + Component.onCompleted: { + relay.send.connect(sendToPost) + relay.send.connect(sendToTelegraph) + relay.send.connect(sendToEmail) + relay.send("Tom", "Happy Birthday") + } + + function sendToPost(person, notice) { + console.log("Sending to post: " + person + ", " + notice) + } + function sendToTelegraph(person, notice) { + console.log("Sending to telegraph: " + person + ", " + notice) + } + function sendToEmail(person, notice) { + console.log("Sending to email: " + person + ", " + notice) + } +} +//! [connect method] + +//! [forward signal] +Rectangle { + id: forwarder + width: 100; height: 100 + + signal send() + onSend: console.log("Send clicked") + + MouseArea { + id: mousearea + anchors.fill: parent + onClicked: console.log("MouseArea clicked") + } + Component.onCompleted: { + mousearea.clicked.connect(send) + } +} +//! [forward signal] + +//! [connect method] +//![parent end] +} +//![parent end] + +//![document] diff --git a/doc/src/snippets/declarative/focus/advancedFocus.qml b/doc/src/snippets/declarative/focus/advancedFocus.qml index fda37c1..409663b 100644 --- a/doc/src/snippets/declarative/focus/advancedFocus.qml +++ b/doc/src/snippets/declarative/focus/advancedFocus.qml @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the FOO module of the Qt Toolkit. +** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:BSD$ ** You may use this file under the terms of the BSD license as follows: diff --git a/doc/src/snippets/declarative/focus/basicwidget.qml b/doc/src/snippets/declarative/focus/basicwidget.qml index b74c1cd..bf834b4 100644 --- a/doc/src/snippets/declarative/focus/basicwidget.qml +++ b/doc/src/snippets/declarative/focus/basicwidget.qml @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the FOO module of the Qt Toolkit. +** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:BSD$ ** You may use this file under the terms of the BSD license as follows: diff --git a/doc/src/snippets/declarative/focus/focusscopewidget.qml b/doc/src/snippets/declarative/focus/focusscopewidget.qml index 7421a63..6a97512 100644 --- a/doc/src/snippets/declarative/focus/focusscopewidget.qml +++ b/doc/src/snippets/declarative/focus/focusscopewidget.qml @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the FOO module of the Qt Toolkit. +** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:BSD$ ** You may use this file under the terms of the BSD license as follows: @@ -37,6 +37,7 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ +//! [document] import QtQuick 1.0 //! [focusscope window] @@ -59,3 +60,4 @@ Rectangle { } //! [focusscope window] +//! [document] diff --git a/doc/src/snippets/declarative/focus/myclickablewidget.qml b/doc/src/snippets/declarative/focus/myclickablewidget.qml index 4777dd1..30b1c69 100644 --- a/doc/src/snippets/declarative/focus/myclickablewidget.qml +++ b/doc/src/snippets/declarative/focus/myclickablewidget.qml @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the FOO module of the Qt Toolkit. +** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:BSD$ ** You may use this file under the terms of the BSD license as follows: diff --git a/doc/src/snippets/declarative/focus/myfocusscopewidget.qml b/doc/src/snippets/declarative/focus/myfocusscopewidget.qml index c87a47e..6462301 100644 --- a/doc/src/snippets/declarative/focus/myfocusscopewidget.qml +++ b/doc/src/snippets/declarative/focus/myfocusscopewidget.qml @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the FOO module of the Qt Toolkit. +** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:BSD$ ** You may use this file under the terms of the BSD license as follows: @@ -37,12 +37,13 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ +//! [document] import QtQuick 1.0 //! [widget in focusscope] FocusScope { - //FocusScope needs to bind to visual properties of the children + //FocusScope needs to bind to visual properties of the Rectangle property alias color: rectangle.color x: rectangle.x; y: rectangle.y width: rectangle.width; height: rectangle.height @@ -64,3 +65,4 @@ FocusScope { } } //! [widget in focusscope] +//! [document] diff --git a/doc/src/snippets/declarative/focus/mywidget.qml b/doc/src/snippets/declarative/focus/mywidget.qml index 86d2d0f..0cca747 100644 --- a/doc/src/snippets/declarative/focus/mywidget.qml +++ b/doc/src/snippets/declarative/focus/mywidget.qml @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the FOO module of the Qt Toolkit. +** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:BSD$ ** You may use this file under the terms of the BSD license as follows: @@ -37,10 +37,10 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ +//! [document] import QtQuick 1.0 //! [mywidget] -//MyWidget code Rectangle { id: widget color: "lightsteelblue"; width: 175; height: 25; radius: 10; smooth: true diff --git a/doc/src/snippets/declarative/focus/widget.qml b/doc/src/snippets/declarative/focus/widget.qml index a5053d9..a3a726e 100644 --- a/doc/src/snippets/declarative/focus/widget.qml +++ b/doc/src/snippets/declarative/focus/widget.qml @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the FOO module of the Qt Toolkit. +** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:BSD$ ** You may use this file under the terms of the BSD license as follows: diff --git a/doc/src/snippets/declarative/grid/grid-spacing.qml b/doc/src/snippets/declarative/grid-spacing.qml index 8914ce3..8914ce3 100644 --- a/doc/src/snippets/declarative/grid/grid-spacing.qml +++ b/doc/src/snippets/declarative/grid-spacing.qml diff --git a/doc/src/snippets/declarative/grid/grid-items.qml b/doc/src/snippets/declarative/grid/grid-items.qml deleted file mode 100644 index 3c60d12..0000000 --- a/doc/src/snippets/declarative/grid/grid-items.qml +++ /dev/null @@ -1,58 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 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:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor -** the names of its contributors may be used to endorse or promote -** products derived from this software without specific prior written -** permission. -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 1.0 - -Rectangle { - width: 112; height: 112 - color: "#303030" - - Grid { - anchors.horizontalCenter: parent.horizontalCenter - anchors.verticalCenter: parent.verticalCenter - columns: 2 - spacing: 6 - - Rectangle { color: "#aa6666"; width: 50; height: 50 } - Rectangle { color: "#aaaa66"; width: 50; height: 50 } - Rectangle { color: "#9999aa"; width: 50; height: 50 } - Rectangle { color: "#6666aa"; width: 50; height: 50 } - } -} diff --git a/doc/src/snippets/declarative/grid/grid-no-spacing.qml b/doc/src/snippets/declarative/grid/grid-no-spacing.qml deleted file mode 100644 index 7c8b0f8..0000000 --- a/doc/src/snippets/declarative/grid/grid-no-spacing.qml +++ /dev/null @@ -1,57 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 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:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor -** the names of its contributors may be used to endorse or promote -** products derived from this software without specific prior written -** permission. -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 1.0 - -Rectangle { - width: 112; height: 112 - color: "#303030" - - Grid { - anchors.horizontalCenter: parent.horizontalCenter - anchors.verticalCenter: parent.verticalCenter - columns: 2 - - Rectangle { color: "#aa6666"; width: 50; height: 50 } - Rectangle { color: "#aaaa66"; width: 50; height: 50 } - Rectangle { color: "#9999aa"; width: 50; height: 50 } - Rectangle { color: "#6666aa"; width: 50; height: 50 } - } -} diff --git a/doc/src/snippets/declarative/qml-intro/rectangle.qml b/doc/src/snippets/declarative/imports/best-practices.qml index b25accc..17e5b7a 100644 --- a/doc/src/snippets/declarative/qml-intro/rectangle.qml +++ b/doc/src/snippets/declarative/imports/best-practices.qml @@ -38,13 +38,12 @@ ** ****************************************************************************/ -//! [document] +//! [imports] import QtQuick 1.0 +import QtWebKit 1.0 +import "subdirectory" +import "script.js" +//! [imports] -// This is a comment. And below myRectangle is defined. -Rectangle { - id: myRectangle - width: 500 - height: 400 +Item { } -//! [document] diff --git a/doc/src/snippets/declarative/qml-intro/hello-world2.qml b/doc/src/snippets/declarative/imports/chart.qml index 2564e25..6de02c1 100644 --- a/doc/src/snippets/declarative/qml-intro/hello-world2.qml +++ b/doc/src/snippets/declarative/imports/chart.qml @@ -38,19 +38,9 @@ ** ****************************************************************************/ -import QtQuick 1.0 +//! [import] +import Charts 1.0 +//! [import] -Rectangle { - id: myRectangle - width: 500 - height: 400 - -//! [updated text] - Text { - text: "<h2>Hello World</h2>"; color: "darkgreen" - x: 100; y:100 - } -//! [updated text] - - color: "lightgray" +Item { } diff --git a/doc/src/snippets/declarative/qml-intro/hello-world1.qml b/doc/src/snippets/declarative/imports/installed-module.qml index 81ad333..288bdd3 100644 --- a/doc/src/snippets/declarative/qml-intro/hello-world1.qml +++ b/doc/src/snippets/declarative/imports/installed-module.qml @@ -38,16 +38,10 @@ ** ****************************************************************************/ -//! [document] +//! [imports] import QtQuick 1.0 +import com.nokia.qml.mymodule 1.0 +//! [imports] -Rectangle { - id: myRectangle - width: 500 - height: 400 - - Text { text: "Hello World!" } - - color: "lightgray" +Item { } -//! [document] diff --git a/doc/src/snippets/declarative/imports/merged-named-imports.qml b/doc/src/snippets/declarative/imports/merged-named-imports.qml new file mode 100644 index 0000000..366e76e --- /dev/null +++ b/doc/src/snippets/declarative/imports/merged-named-imports.qml @@ -0,0 +1,47 @@ +/**************************************************************************** +** +** Copyright (C) 2011 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: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$ +** +****************************************************************************/ + +//! [imports] +import QtQuick 1.0 as Nokia +import Ovi 1.0 as Nokia +//! [imports] + +Item { +} diff --git a/doc/src/snippets/declarative/qml-intro/hello-world4.qml b/doc/src/snippets/declarative/imports/named-imports.qml index 832e37d..a8fa743 100644 --- a/doc/src/snippets/declarative/qml-intro/hello-world4.qml +++ b/doc/src/snippets/declarative/imports/named-imports.qml @@ -38,24 +38,24 @@ ** ****************************************************************************/ -import QtQuick 1.0 +//! [imports] +import QtQuick 1.0 as QtLibrary +import "../MyComponents" as MyComponents +import com.nokia.qml.mymodule 1.0 as MyModule +//! [imports] -Rectangle { - id: myRectangle - width: 500 - height: 400 - - Text { - text: "<h1>Hello world again</h1>" - color: "#002288" - x: 100; y: 100 +Item { + //! [imported items] + QtLibrary.Rectangle { + // ... } -//! [added an image] - Image { - source: "images/qt-logo.svg" + MyComponents.Slider { + // ... } -//! [added an image] - color: "lightgray" + MyModule.SomeComponent { + // ... + } + //! [imported items] } diff --git a/doc/src/snippets/declarative/imports/network-imports.qml b/doc/src/snippets/declarative/imports/network-imports.qml new file mode 100644 index 0000000..54e177a --- /dev/null +++ b/doc/src/snippets/declarative/imports/network-imports.qml @@ -0,0 +1,47 @@ +/**************************************************************************** +** +** Copyright (C) 2011 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: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$ +** +****************************************************************************/ + +//! [imports] +import "http://www.my-server.com/MyQMLProject/MyComponents" +import "http://www.my-server.com/MyQMLProject/MyComponents" 1.0 +//! [imports] + +Item { +} diff --git a/doc/src/snippets/declarative/listview/listview-snippet.qml b/doc/src/snippets/declarative/imports/qtquick-1.0.qml index f73dec9..e2a642d 100644 --- a/doc/src/snippets/declarative/listview/listview-snippet.qml +++ b/doc/src/snippets/declarative/imports/qtquick-1.0.qml @@ -38,15 +38,9 @@ ** ****************************************************************************/ -//! [document] +//! [import] import QtQuick 1.0 +//! [import] -ListView { - width: 50; height: 200 - model: 4 - delegate: Text { - text: index; - font.pixelSize: 40 - } +Item { } -//! [document] diff --git a/doc/src/snippets/declarative/imports/timeexample.qml b/doc/src/snippets/declarative/imports/timeexample.qml new file mode 100644 index 0000000..24eafd7 --- /dev/null +++ b/doc/src/snippets/declarative/imports/timeexample.qml @@ -0,0 +1,46 @@ +/**************************************************************************** +** +** Copyright (C) 2011 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: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] +import com.nokia.TimeExample 1.0 +//! [import] + +Item { +} diff --git a/doc/src/snippets/declarative/qml-intro/transformations1.qml b/doc/src/snippets/declarative/listview-decorations.qml index 7be79c8..9ba9b70 100644 --- a/doc/src/snippets/declarative/qml-intro/transformations1.qml +++ b/doc/src/snippets/declarative/listview-decorations.qml @@ -41,40 +41,71 @@ //! [document] import QtQuick 1.0 +//! [parent begin] Rectangle { - id: myWin - width: 500 - height: 400 +//! [parent begin] + width: 550; height: 220; color: "white" - Image { - id: image1 - source: "images/qt-logo.svg" - width: 150; height: 150 - anchors.bottom: myWin.bottom - anchors.horizontalCenter: myWin.horizontalCenter - anchors.bottomMargin: 10 - - transform: Rotation { - origin.x: 75; origin.y: 75 - axis{ x: 0; y: 0; z:1 } angle: -90 - } - - } +//! [model] +ListModel { + id: nameModel + ListElement { name: "Alice" } + ListElement { name: "Bob" } + ListElement { name: "Jane" } + ListElement { name: "Harry" } + ListElement { name: "Wendy" } +} +//! [model] +//! [delegate] +Component { + id: nameDelegate Text { - text: "<h2>The Qt Logo -- taking it easy</h2>" - anchors.bottom: image1.top - anchors.horizontalCenter: myWin.horizontalCenter - anchors.bottomMargin: 15 + text: name; + font.pixelSize: 24 + } +} +//! [delegate] - transform: [ - Scale { xScale: 1.5; yScale: 1.2 } , +//! [decorations] +ListView { + anchors.fill: parent + clip: true + model: nameModel + delegate: nameDelegate + header: bannercomponent + footer: Rectangle { + width: parent.width; height: 30; + gradient: clubcolors + } + highlight: Rectangle { + width: parent.width + color: "lightgray" + } +} - Rotation { - origin.x: 75; origin.y: 75 - axis{ x: 0; y: 0; z:1 } angle: -45 - } - ] +Component { //instantiated when header is processed + id: bannercomponent + Rectangle { + id: banner + width: parent.width; height: 50 + gradient: clubcolors + border {color: "#9EDDF2"; width: 2} + Text { + anchors.centerIn: parent + text: "Club Members" + font.pixelSize: 32 + } } } +Gradient { + id: clubcolors + GradientStop { position: 0.0; color: "#8EE2FE"} + GradientStop { position: 0.66; color: "#7ED2EE"} +} +//! [decorations] + +//! [parent end] +} +//! [parent end] //! [document] diff --git a/doc/src/snippets/declarative/qml-intro/states1.qml b/doc/src/snippets/declarative/listview-sections.qml index 270d6c3..74c96dd 100644 --- a/doc/src/snippets/declarative/qml-intro/states1.qml +++ b/doc/src/snippets/declarative/listview-sections.qml @@ -37,58 +37,65 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ - //! [document] import QtQuick 1.0 +//! [parent begin] Rectangle { - id: mainRectangle - width: 600 - height: 400 - color: "black" +//! [parent begin] + width: 150; height: 300; color: "white" - Rectangle { - id: sky - width: 600 - height: 200 - y: 0 - color: "lightblue" - } +//! [model] +ListModel { + id: nameModel + ListElement { name: "Alice"; team: "Crypto" } + ListElement { name: "Bob"; team: "Crypto" } + ListElement { name: "Jane"; team: "QA" } + ListElement { name: "Victor"; team: "QA" } + ListElement { name: "Wendy"; team: "Graphics" } +} +//! [model] - Rectangle { - id: ground - width: 600; height: 200 - y: 200 - color: "green" +//! [delegate] +Component { + id: nameDelegate + Text { + text: name; + font.pixelSize: 24 + anchors.left: parent.left + anchors.leftMargin: 2 } +} +//! [delegate] - MouseArea { - id: mousearea - anchors.fill: mainRectangle +//! [section] +ListView { + anchors.fill: parent + model: nameModel + delegate: nameDelegate + focus: true + highlight: Rectangle { + color: "lightblue" + width: parent.width } - - states: [ State { - name: "night" - when: mousearea.pressed == true - PropertyChanges { target: sky; color: "darkblue" } - PropertyChanges { target: ground; color: "black" } - }, - State { - name: "daylight" - when: mousearea.pressed == false - PropertyChanges { target: sky; color: "lightblue" } - PropertyChanges { target: ground; color: "green" } + section { + property: "team" + criteria: ViewSection.FullString + delegate: Rectangle { + color: "#b0dfb0" + width: parent.width + height: childrenRect.height + 4 + Text { anchors.horizontalCenter: parent.horizontalCenter + font.pixelSize: 16 + font.bold: true + text: section + } } - ] + } +} +//! [section] - transitions: [ Transition { - from: "daylight"; to: "night" - ColorAnimation { duration: 1000 } - }, - Transition { - from: "night"; to: "daylight" - ColorAnimation { duration: 500 } - } - ] +//! [parent end] } +//! [parent end] //! [document] diff --git a/doc/src/snippets/declarative/qml-intro/number-animation1.qml b/doc/src/snippets/declarative/listview.qml index ccf2d36..081d2b0 100644 --- a/doc/src/snippets/declarative/qml-intro/number-animation1.qml +++ b/doc/src/snippets/declarative/listview.qml @@ -41,24 +41,47 @@ //! [document] import QtQuick 1.0 +//! [parent begin] Rectangle { - id: mainRec - width: 600 - height: 400 +//! [parent begin] + width: 175; height: 175; color: "white" - Image { - id: image1 - source: "images/qt-logo.svg" - x: 200; y: 100 - width: 100; height: 100 +//! [model] +ListModel { + id: petlist + ListElement { type: "Cat" } + ListElement { type: "Dog" } + ListElement { type: "Mouse" } + ListElement { type: "Rabbit" } + ListElement { type: "Horse" } +} +//! [model] - // Animate a rotation - transformOrigin: Item.Center - NumberAnimation on rotation { - from: 0; to: 360 - duration: 2000 - loops: Animation.Infinite - } +//! [delegate] +Component { + id: petdelegate + Text { + id: label + font.pixelSize: 24 + text: if (index == 0) + label.text = type + " (default)" + else + text: type } } +//! [delegate] + +//! [view] +ListView { + id: view + anchors.fill: parent + + model: petlist + delegate: petdelegate +} +//! [view] + +//! [parent end] +} +//! [parent end] //! [document] diff --git a/doc/src/snippets/declarative/animation-behavioral.qml b/doc/src/snippets/declarative/models/views-models-delegates.qml index 93cf2fa..2f76856 100644 --- a/doc/src/snippets/declarative/animation-behavioral.qml +++ b/doc/src/snippets/declarative/models/views-models-delegates.qml @@ -37,25 +37,42 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ -//![0] -import QtQuick 1.0 -Item { - width: 100; height: 100 +//! [rectangle] +Rectangle { + width: 200; height: 200 - Rectangle { - id: rect - width: 100; height: 100 - color: "red" - - Behavior on x { PropertyAnimation { duration: 500 } } - Behavior on y { PropertyAnimation { duration: 500 } } + ListModel { + id: fruitModel + property string language: "en" + ListElement { + name: "Apple" + cost: 2.45 + } + ListElement { + name: "Orange" + cost: 3.25 + } + ListElement { + name: "Banana" + cost: 1.95 + } } - MouseArea { + Component { + id: fruitDelegate + Row { + Text { text: " Fruit: " + name; color: ListView.view.fruit_color } + Text { text: " Cost: $" + cost } + Text { text: " Language: " + ListView.view.model.language } + } + } + + ListView { + property color fruit_color: "green" + model: fruitModel + delegate: fruitDelegate anchors.fill: parent - onClicked: { rect.x = mouse.x; rect.y = mouse.y } } } -//![0] - +//! [rectangle] diff --git a/doc/src/snippets/declarative/animation-transitions.qml b/doc/src/snippets/declarative/models/visual-model-and-view.qml index 62bef23..4d42b65 100644 --- a/doc/src/snippets/declarative/animation-transitions.qml +++ b/doc/src/snippets/declarative/models/visual-model-and-view.qml @@ -37,26 +37,21 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ -//![0] -import QtQuick 1.0 Rectangle { - id: rect - width: 100; height: 100 - color: "red" - - MouseArea { - anchors.fill: parent - onClicked: rect.state = "moved" - } - - states: State { - name: "moved" - PropertyChanges { target: rect; x: 50; y: 50 } + width: 200; height: 200 + + //! [visual model and view] + VisualItemModel { + id: itemModel + Rectangle { height: 30; width: 80; color: "red" } + Rectangle { height: 30; width: 80; color: "green" } + Rectangle { height: 30; width: 80; color: "blue" } } - - transitions: Transition { - PropertyAnimation { properties: "x,y"; duration: 1000 } + + ListView { + anchors.fill: parent + model: itemModel } + //! [visual model and view] } -//![0] diff --git a/doc/src/snippets/declarative/mousearea/mousearea-snippet.qml b/doc/src/snippets/declarative/mousearea/mousearea-snippet.qml index 3c2e143..03473ba 100644 --- a/doc/src/snippets/declarative/mousearea/mousearea-snippet.qml +++ b/doc/src/snippets/declarative/mousearea/mousearea-snippet.qml @@ -41,13 +41,60 @@ //! [document] import QtQuick 1.0 -Rectangle { - width: 100; height: 100 +//! [parent begin] +Rectangle { +//! [parent begin] + width: 500; height: 500 color: "green" - MouseArea { +Column { +//! [anchor fill] +Rectangle { + id: button + width: 100; height: 100 + + MouseArea { anchors.fill: parent - onClicked: { parent.color = 'red' } + onClicked: console.log("button clicked") + } + MouseArea { + width:150; height: 75 + onClicked: console.log("irregular area clicked") + } +} +//! [anchor fill] + +Rectangle { + id: button + width: 100; height: 100 + +//! [enable handlers] + MouseArea { + hoverEnabled: true + acceptedButtons: Qt.LeftButton | Qt.RightButton + onEntered: console.log("mouse entered the area") + onExited: console.log("mouse left the area") } +//! [enable handlers] +} + +Rectangle { + id: button + width: 100; height: 100 + +//! [mouse handlers] + MouseArea { + anchors.fill: parent + onClicked: console.log("area clicked") + onDoubleClicked: console.log("area double clicked") + onEntered: console.log("mouse entered the area") + onExited: console.log("mouse left the area") + } +//! [mouse handlers] +} + +} //end of column +//! [parent end] } +//! [parent end] //! [document] diff --git a/doc/src/snippets/declarative/pics/qt.png b/doc/src/snippets/declarative/pics/qt.png Binary files differindex cbed1a9..4f68e16 100644 --- a/doc/src/snippets/declarative/pics/qt.png +++ b/doc/src/snippets/declarative/pics/qt.png diff --git a/doc/src/snippets/declarative/properties.qml b/doc/src/snippets/declarative/properties.qml new file mode 100644 index 0000000..330d1cf --- /dev/null +++ b/doc/src/snippets/declarative/properties.qml @@ -0,0 +1,315 @@ +/**************************************************************************** +** +** 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: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$ +** +****************************************************************************/ + +//! [document] +import QtQuick 1.0 + +//! [parent begin] +Rectangle { +//! [parent begin] + + //! [inherited properties] + width: 320; height: 240 + color: "lightblue" + focus: true + //! [inherited properties] + + //! [custom properties] + property int counter + property real area: 100.45 + //! [custom properties] + + //! [property types] + property int number + property real volume: 100.45 + property date today: "2011-01-01" + property color background: "yellow" + //! [property types] + + +//! [grouped properties] +Text { + //dot notation + font.pixelSize: 12 + font.bold: true +} + +Text { + //group notation + font {pixelSize: 12; bold: true} +} +//! [grouped properties] + + +//! [property binding] +Rectangle { + width: parent.width +} +//! [property binding] + +//! [property assignment] +Rectangle { + Component.onCompleted: { + width = 150 + } +} +//! [property assignment] + +Rectangle { + //placeholder slider + id: slider + property real value +} +Rectangle { + //placeholder system + id: system + property real brightness +} +//! [binding element] +Binding { + target: system + property: "brightness" + value: slider.value +} +//! [binding element] + +Rectangle { + //placeholder warning + id: warning + color: "red" +} +//! [PropertyChanges element] +Rectangle { + id: rectangle + + states: State { + name: "WARNING" + PropertyChanges { + target: rectangle + color: warning.color + } + } +} +//! [PropertyChanges element] + +//! [list property] +Item { + id: multistate + states: [ + State {name: "FETCH"}, + State {name: "DECODE"}, + State {name: "EXECUTE"} + ] +} +//! [list property] +//! [single property] +Item { + id: monostate + states: State {name: "RUNNING"} +} +//! [single property] + +Item { + id: printstate +//! [print list property] + Component.onCompleted: console.log (multistate.states[0].name) +//! [print list property] +} + +//! [JavaScript sample] +function calculateArea(width, height) { + return (width * height) * 0.5 +} + +Rectangle { + width: 150; height: 75 + property real area: calculateArea(width, height) + property real parentArea: calculateArea(parent.width,parent.height) + color: { if (area > parentArea) "blue"; else "red" } +} +//! [JavaScript sample] + +//! [id property] +Rectangle { + id: container + width: 100; height: 100 + Rectangle { + width: parent.width; height: parent.height + } +} +Rectangle { + width: container.width; height: container.height +} +//! [id property] + +//! [default property] +Item { + Text {} + Rectangle {} + Timer {} +} + +Item { + //without default property + children: [ + Text {}, + Rectangle {} + ] + resources: [ + Timer {} + ] +} +//! [default property] + +//! [state default] +State { + changes: [ + PropertyChanges {}, + PropertyChanges {} + ] +} + +State { + PropertyChanges {} + PropertyChanges {} +} +//! [state default] + +//! [object binding] +Rectangle { + + id: parentrectangle + gradient: + Gradient { //not a child of parentrectangle + + //generates a TypeError + //Component.onCompleted: console.log(parent.width) + } + + //child of parentrectangle + Rectangle {property string name: "childrectangle"} + + //prints "childrectangle" + Component.onCompleted: console.log(children[0].name) +} +//! [object binding] + +//! [list attached property] +Component { + id: listdelegate + Text { + text: "Hello" + color: ListView.isCurrentItem ? "red" : "blue" + } +} +ListView { + delegate: listdelegate +} +//! [list attached property] + +//! [attached signal handler] +Item { + Keys.onPressed: console.log("Key Press Detected") + Component.onCompleted: console.log("Completed initialization") +} +//! [attached signal handler] + +//! [alias usage] +Button { + id: textbutton + buttonLabel: "Click Me!" +} +//! [alias usage] + +//! [image alias] +Button { + id: imagebutton + buttonImage.source: "http://qt.nokia.com/logo.png" + buttonLabel: buttonImage.source +} +//! [image alias] + +Item { +id: widget + +//! [alias complete] +property alias widgetLabel: label + +//will generate an error +//widgetLabel.text: "Initial text" + +//will generate an error +//property alias widgetLabelText: widgetLabel.text + +Component.onCompleted: widgetLabel.text = "Alias completed Initialization" +//! [alias complete] + + Text {id: label} +} + +//![alias overwrite] +Rectangle { + id: coloredrectangle + property alias color: bluerectangle.color + color: "red" + + Rectangle { + id: bluerectangle + color: "#1234ff" + } + + Component.onCompleted: { + console.log (coloredrectangle.color) //prints "#1234ff" + setInternalColor() + console.log (coloredrectangle.color) //prints "#111111" + coloredrectangle.color = "#884646" + console.log (coloredrectangle.color) //prints #884646 + } + + //internal function that has access to internal properties + function setInternalColor() { + color = "#111111" + } +} +//![alias overwrite] +//! [parent end] +} +//! [parent end] +//! [document] diff --git a/doc/src/snippets/declarative/qml-intro/anchors3.qml b/doc/src/snippets/declarative/qml-intro/anchors3.qml deleted file mode 100644 index 24851af..0000000 --- a/doc/src/snippets/declarative/qml-intro/anchors3.qml +++ /dev/null @@ -1,65 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 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:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor -** the names of its contributors may be used to endorse or promote -** products derived from this software without specific prior written -** permission. -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 1.0 - -Rectangle { - id: myWin - width: 500 - height: 400 - - Image { - id: image1 - source: "images/qt-logo.svg" - width: 150; height: 150 - anchors.bottom: myWin.bottom - anchors.horizontalCenter: myWin.horizontalCenter - anchors.bottomMargin: 10 - } - -//! [adding some text] - Text { - text: "<h2>The Qt Logo</h2>" - anchors.bottom: image1.top - anchors.horizontalCenter: myWin.horizontalCenter - anchors.bottomMargin: 15 - } -//! [adding some text] -} diff --git a/doc/src/snippets/declarative/qml-intro/hello-world3.qml b/doc/src/snippets/declarative/qml-intro/hello-world3.qml deleted file mode 100644 index 03358d0..0000000 --- a/doc/src/snippets/declarative/qml-intro/hello-world3.qml +++ /dev/null @@ -1,57 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 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:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor -** the names of its contributors may be used to endorse or promote -** products derived from this software without specific prior written -** permission. -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 1.0 - -Rectangle { - id: myRectangle - width: 500 - height: 400 - -//! [updated text] - Text { - text: "<h1>Hello world again</h1>" - color: "#002288" - x: 100; y: 100 - } -//! [updated text] - - color: "lightgray" -} diff --git a/doc/src/snippets/declarative/qml-intro/images/qt-logo.svg b/doc/src/snippets/declarative/qml-intro/images/qt-logo.svg deleted file mode 100644 index 8c018be..0000000 --- a/doc/src/snippets/declarative/qml-intro/images/qt-logo.svg +++ /dev/null @@ -1,104 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" standalone="no"?> -<svg - xmlns:dc="http://purl.org/dc/elements/1.1/" - xmlns:cc="http://creativecommons.org/ns#" - xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" - xmlns:svg="http://www.w3.org/2000/svg" - xmlns="http://www.w3.org/2000/svg" - xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" - xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" - clip-rule="evenodd" - stroke-miterlimit="10" - viewBox="0 0 174.35 209.78" - id="svg2" - sodipodi:version="0.32" - inkscape:version="0.46" - width="744.09186" - height="895.29858" - sodipodi:docname="qt-logo.svg" - inkscape:output_extension="org.inkscape.output.svg.inkscape" - version="1.0" - style="stroke-miterlimit:10"> - <metadata - id="metadata29"> - <rdf:RDF> - <cc:Work - rdf:about=""> - <dc:format>image/svg+xml</dc:format> - <dc:type - rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> - </cc:Work> - </rdf:RDF> - </metadata> - <sodipodi:namedview - inkscape:window-height="668" - inkscape:window-width="722" - inkscape:pageshadow="2" - inkscape:pageopacity="0.0" - guidetolerance="10.0" - gridtolerance="10.0" - objecttolerance="10.0" - borderopacity="1.0" - bordercolor="#666666" - pagecolor="#ffffff" - id="base" - showgrid="false" - inkscape:zoom="0.12195802" - inkscape:cx="525.6108" - inkscape:cy="-287.87189" - inkscape:window-x="476" - inkscape:window-y="228" - inkscape:current-layer="svg2" /> - <desc - id="desc4">SVG generated by Lineform</desc> - <defs - id="defs6"> - <inkscape:perspective - sodipodi:type="inkscape:persp3d" - inkscape:vp_x="0 : 526.18109 : 1" - inkscape:vp_y="0 : 1000 : 0" - inkscape:vp_z="744.09448 : 526.18109 : 1" - inkscape:persp3d-origin="372.04724 : 350.78739 : 1" - id="perspective31" /> - </defs> - <g - id="g8" - transform="translate(-1.5304326e-4,-3.775985e-4)"> - <path - d="M 43.08,0.36 C 40.94,0 38.84,-0.08 36.81,0.08 L 36.8,0.08 C 36.8,0.08 22.92,1.02 22.29,1.07 C 9.62,2.08 0,12.5 0,26.89 L 0,196.55 L 14.19,209.78 L 156.79,185.81 C 166.6,184.11 174.35,172.54 174.35,160.04 L 174.35,21.88 L 43.08,0.36" - id="path10" - style="fill:#0c481e" /> - <path - d="M 174.35,160.04 C 174.35,172.54 166.6,184.11 156.79,185.82 L 14.19,209.78 L 14.19,25.99 C 14.19,9.27 27.53,-2.21 43.08,0.36 L 174.35,21.88 L 174.35,160.04" - id="path12" - style="fill:#66b036" /> - <path - d="M 130.42,45.91 L 141.94,47.15 L 141.94,67.36 L 154.9,68.28 L 154.9,80.96 L 141.94,80.36 L 141.94,126.69 C 141.94,130.72 142.38,133.31 143.28,134.48 C 144.08,135.55 145.32,136.07 146.99,136.07 C 147.15,136.07 147.32,136.07 147.48,136.06 C 150.03,135.91 152.81,135.13 155.83,133.75 L 155.83,145.4 C 150.69,147.65 145.65,149 140.7,149.42 C 139.99,149.47 139.29,149.5 138.62,149.5 C 134.14,149.5 130.72,148.2 128.38,145.57 C 125.65,142.52 124.29,137.62 124.29,130.9 L 124.29,79.54 L 118.06,79.26 L 118.06,65.67 L 125.65,66.22 L 130.42,45.91" - id="path14" - style="fill:#ffffff" /> - <path - d="M 154.9,80.96 L 141.94,80.36 L 141.94,80.64 L 148.88,80.96 L 154.9,80.96" - id="path16" - style="fill:#0c481e" /> - <path - d="M 144.64,135.6 C 145.3,135.92 146.07,136.07 146.99,136.07 C 147.15,136.07 147.32,136.07 147.48,136.06 C 150.03,135.91 152.81,135.13 155.83,133.75 L 149.81,133.75 C 147.99,134.58 146.28,135.21 144.64,135.6" - id="path18" - style="fill:#0c481e" /> - <path - d="M 128.38,145.57 C 125.65,142.52 124.29,137.62 124.29,130.9 L 124.29,79.54 L 118.06,79.26 L 118.06,65.67 L 112.05,65.67 L 112.05,68.71 C 112.92,71.98 113.6,75.53 114.11,79.35 L 118.28,79.54 L 118.28,130.9 C 118.28,137.62 119.64,142.52 122.37,145.57 C 124.71,148.2 128.13,149.5 132.61,149.5 L 138.62,149.5 C 134.14,149.5 130.72,148.2 128.38,145.57 z M 130.42,45.91 L 124.41,45.91 L 119.74,65.79 L 125.65,66.22 L 130.42,45.91" - id="path20" - style="fill:#0c481e" /> - <path - d="M 91.15,132.4 C 93.5,126.36 94.66,114.49 94.66,96.79 C 94.66,80.9 93.51,69.97 91.18,63.98 C 88.84,57.95 85.35,54.69 80.66,54.28 C 80.3,54.25 79.95,54.23 79.6,54.23 C 75.26,54.23 71.92,56.77 69.59,61.86 C 67.07,67.4 65.8,78.9 65.8,96.3 C 65.8,113.11 67.04,125.05 69.54,132.05 C 71.89,138.72 75.41,142.03 80.04,142.03 C 80.25,142.03 80.45,142.02 80.66,142.01 C 85.29,141.71 88.78,138.51 91.15,132.4 M 109.13,136.15 C 105.01,145.86 98.73,152.21 90.14,155.15 C 91.01,159.6 92.32,162.6 94.06,164.17 C 95.41,165.39 97.49,165.99 100.28,165.99 C 101.09,165.99 101.96,165.94 102.87,165.84 L 102.87,178.96 L 96.91,179.75 C 95.16,179.97 93.49,180.09 91.91,180.09 C 86.69,180.09 82.47,178.82 79.29,176.26 C 75.08,172.89 71.98,166.37 69.99,156.73 C 60.86,154.78 53.73,148.97 48.8,139.23 C 43.8,129.32 41.25,114.83 41.25,95.89 C 41.25,75.46 44.74,60.38 51.6,50.81 C 57.38,42.75 65.46,38.78 75.62,38.78 C 77.24,38.78 78.93,38.88 80.66,39.08 C 92.61,40.46 101.28,46.1 106.92,55.87 C 112.46,65.43 115.17,79.14 115.17,97.13 C 115.17,113.62 113.17,126.58 109.13,136.15" - id="path22" - style="fill:#ffffff" /> - <path - d="M 100.28,165.99 C 101.09,165.99 101.95,165.94 102.87,165.84 L 98.04,165.84 C 98.71,165.94 99.49,165.99 100.28,165.99" - id="path24" - style="fill:#0c481e" /> - <path - d="M 84.85,63.98 C 87.19,69.97 88.34,80.9 88.34,96.79 C 88.34,114.49 87.18,126.36 84.82,132.4 C 82.93,137.28 80.3,140.31 76.96,141.48 C 77.93,141.84 78.96,142.03 80.04,142.03 C 80.25,142.03 80.45,142.02 80.66,142.01 C 85.29,141.71 88.78,138.51 91.15,132.4 C 93.5,126.36 94.66,114.49 94.66,96.79 C 94.66,80.9 93.51,69.97 91.18,63.98 C 88.84,57.95 85.35,54.69 80.66,54.28 C 80.3,54.25 79.95,54.23 79.6,54.23 C 78.51,54.23 77.48,54.39 76.52,54.72 L 76.52,54.72 C 80.12,55.83 82.89,58.93 84.85,63.98 z M 82.51,178.25 C 82.4,178.2 82.28,178.15 82.17,178.09 C 82.16,178.09 82.15,178.08 82.14,178.08 C 82.03,178.03 81.93,177.97 81.83,177.92 C 81.81,177.91 81.79,177.9 81.77,177.89 C 81.68,177.84 81.59,177.79 81.49,177.74 C 81.46,177.72 81.44,177.71 81.41,177.69 C 81.33,177.65 81.24,177.6 81.16,177.55 C 81.12,177.53 81.09,177.51 81.05,177.48 C 80.98,177.44 80.91,177.4 80.84,177.36 C 80.79,177.33 80.74,177.3 80.7,177.27 C 80.64,177.23 80.58,177.19 80.52,177.15 C 80.46,177.12 80.41,177.08 80.35,177.04 C 80.3,177.01 80.25,176.98 80.2,176.94 C 80.14,176.9 80.07,176.85 80.01,176.81 C 79.97,176.78 79.93,176.75 79.89,176.72 C 79.82,176.67 79.74,176.61 79.67,176.55 C 79.64,176.54 79.61,176.52 79.59,176.5 C 79.49,176.42 79.39,176.34 79.29,176.26 C 75.08,172.89 71.98,166.37 69.99,156.73 C 60.86,154.78 53.73,148.97 48.8,139.23 C 43.8,129.32 41.25,114.83 41.25,95.89 C 41.25,75.46 44.74,60.38 51.6,50.81 C 57.38,42.75 65.46,38.78 75.62,38.78 C 75.65,38.78 69.27,38.77 69.27,38.77 L 69.27,38.78 C 59.12,38.78 51.05,42.75 45.27,50.81 C 38.41,60.38 34.92,75.46 34.92,95.89 C 34.92,114.83 37.47,129.32 42.47,139.23 C 47.41,148.97 54.53,154.78 63.67,156.73 C 65.65,166.37 68.76,172.89 72.96,176.26 C 76.14,178.82 80.36,180.09 85.58,180.09 C 85.68,180.09 85.78,180.09 85.88,180.09 L 91.42,180.09 C 88.01,180.03 85.04,179.43 82.52,178.26 C 82.51,178.26 82.51,178.26 82.51,178.25" - id="path26" - style="fill:#0c481e" /> - </g> -</svg> diff --git a/doc/src/snippets/declarative/qml-intro/number-animation2.qml b/doc/src/snippets/declarative/qml-intro/number-animation2.qml deleted file mode 100644 index 7be22b5..0000000 --- a/doc/src/snippets/declarative/qml-intro/number-animation2.qml +++ /dev/null @@ -1,66 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 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: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$ -** -****************************************************************************/ - -//! [document] -import QtQuick 1.0 - -Rectangle { - id: mainRec - width: 600 - height: 400 - - Image { - id: image1 - source: "images/qt-logo.svg" - x: 200; y: 100 - width: 100; height: 100 - - // Animate a rotation - transform: Rotation { - origin.x: 50; origin.y: 50; axis {x:0; y:1; z:0} angle:0 - NumberAnimation on angle { - from: 0; to: 360; - duration: 3000; - loops: Animation.Infinite - } - } - } -} -//! [document] diff --git a/doc/src/snippets/declarative/qml-intro/sequential-animation1.qml b/doc/src/snippets/declarative/qml-intro/sequential-animation1.qml deleted file mode 100644 index c789bbe..0000000 --- a/doc/src/snippets/declarative/qml-intro/sequential-animation1.qml +++ /dev/null @@ -1,65 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 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: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$ -** -****************************************************************************/ - -//! [document] -import QtQuick 1.0 - -Rectangle { - id: mainRec - width: 600 - height: 400 - z: 0 - - Image { - id: image1 - source: "images/qt-logo.svg" - x: 20; y: 20 ; z: 1 - width: 100; height: 100 - } - - Image { - id: image2 - source: "images/qt-logo.svg" - width: 100; height: 100 - x: (mainRec.width - 100)/2; y: (mainRec.height - 100)/2 - z: 2 - } -} -//! [document] diff --git a/doc/src/snippets/declarative/qml-intro/sequential-animation2.qml b/doc/src/snippets/declarative/qml-intro/sequential-animation2.qml deleted file mode 100644 index b2b1a57..0000000 --- a/doc/src/snippets/declarative/qml-intro/sequential-animation2.qml +++ /dev/null @@ -1,73 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 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:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor -** the names of its contributors may be used to endorse or promote -** products derived from this software without specific prior written -** permission. -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 1.0 - -Rectangle { - id: mainRec - width: 600 - height: 400 - z: 0 - -//! [adding a sequential animation] - Image { - id: image1 - source: "images/qt-logo.svg" - width: 100; height: 100 - - SequentialAnimation on x { - loops: Animation.Infinite - NumberAnimation { - from: 20; to: 450; easing.type: "InOutQuad"; - duration: 2000 - } - PauseAnimation { duration: 500 } - } - } -//! [adding a sequential animation] - - Image { - id: image2 - source: "images/qt-logo.svg" - width: 100; height: 100 - x: (mainRec.width - 100)/2; y: (mainRec.height - 100)/2 - z: 2 - } -} diff --git a/doc/src/snippets/declarative/reusablecomponents/Button.qml b/doc/src/snippets/declarative/reusablecomponents/Button.qml new file mode 100644 index 0000000..3b97e00 --- /dev/null +++ b/doc/src/snippets/declarative/reusablecomponents/Button.qml @@ -0,0 +1,84 @@ +/**************************************************************************** +** +** Copyright (C) 2011 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: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$ +** +****************************************************************************/ +//! [document] +//contents of Button.qml +import QtQuick 1.0 + +//! [parent begin] +Rectangle { +//! [parent begin] + id: button +//! [properties] + width: 145; height: 60 + color: "blue" + smooth: true; radius: 9 + property alias text: label.text +//! [properties] + border {color: "#B9C5D0"; width: 1} + + gradient: Gradient { + GradientStop {color: "#CFF7FF"; position: 0.0} + GradientStop {color: "#99C0E5"; position: 0.57} + GradientStop {color: "#719FCB"; position: 0.9} + } + + Text { + id: label + anchors.centerIn: parent + text: "Click Me!" + font.pointSize: 12 + color: "blue" + } + + MouseArea { + anchors.fill: parent + onClicked: console.log(text + " clicked") + } +//! [parent end] +} +//! [parent end] + +//! [document] + +//! [ellipses] + //... +//! [ellipses] + + diff --git a/doc/src/snippets/declarative/qml-intro/anchors1.qml b/doc/src/snippets/declarative/reusablecomponents/application.qml index b958138..a09b276 100644 --- a/doc/src/snippets/declarative/qml-intro/anchors1.qml +++ b/doc/src/snippets/declarative/reusablecomponents/application.qml @@ -37,20 +37,19 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ - //! [document] import QtQuick 1.0 Rectangle { - id: myWin - width: 500 - height: 400 + width: 175; height: 350 + color: "lightgrey" - Image { - id: image1 - source: "images/qt-logo.svg" - width: 150; height: 150 - anchors.bottom: myWin.bottom + Column { + anchors.centerIn: parent + spacing: 15 + Button {} + Button {text: "Me Too!"} + Button {text: "Me Three!"} } } //! [document] diff --git a/doc/src/snippets/declarative/animation-standalone.qml b/doc/src/snippets/declarative/reusablecomponents/component.qml index 0bf3020..8660c50 100644 --- a/doc/src/snippets/declarative/animation-standalone.qml +++ b/doc/src/snippets/declarative/reusablecomponents/component.qml @@ -37,27 +37,41 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ -//![0] +//! [document] import QtQuick 1.0 +//! [parent begin] Rectangle { - id: rect - width: 100; height: 100 - color: "red" - - PropertyAnimation { - id: animation - target: rect - properties: "x,y" - duration: 1000 +//! [parent begin] + id: screen + width: 175; height: 175 + color: "lightgrey" + +//! [define inline component] + Component { + id: inlinecomponent + Rectangle { + id: display + width: 50; height: 50 + color: "blue" + } } - +//! [define inline component] +//! [create inline component] MouseArea { anchors.fill: parent onClicked: { - animation.to = 50; - animation.running = true; + inlinecomponent.createObject(parent) + + var second = inlinecomponent.createObject(parent) + + var third = inlinecomponent.createObject(parent) + third.x = second.width + 10 + third.color = "red" } - } + } +//! [create inline component] +//! [parent end] } -//![0] +//! [parent end] +//! [document] diff --git a/doc/src/snippets/declarative/qml-intro/sequential-animation3.qml b/doc/src/snippets/declarative/reusablecomponents/focusbutton.qml index d840575..2522a98 100644 --- a/doc/src/snippets/declarative/qml-intro/sequential-animation3.qml +++ b/doc/src/snippets/declarative/reusablecomponents/focusbutton.qml @@ -37,56 +37,62 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ - -import QtQuick 1.0 - //! [document] +//contents of focusbutton.qml import QtQuick 1.0 -Rectangle { - id: mainRec - width: 600 - height: 400 - z: 0 +//! [parent begin] +FocusScope { +//! [parent begin] - Image { - id: image2 - source: "images/qt-logo.svg" - width: 100; height: 100 - x: (mainRec.width - 100)/2; y: (mainRec.height - 100)/2 - z: 2 - } + //! [expose visuals] + //FocusScope needs to bind to visual properties of the children + property alias color: button.color + x: button.x; y: button.y + width: button.width; height: button.height + //! [expose visuals] - Image { - id: image1 - source: "images/qt-logo.svg" - x: 20; y: 20 ; z: 1 - width: 100; height: 100 + //! [rectangle begin] + Rectangle { + //! [rectangle begin] + id: button + //! [properties] + width: 145; height: 60 + color: "blue" + smooth: true; radius: 9 + property alias text: label.text + //! [properties] + border {color: "#B9C5D0"; width: 1} - SequentialAnimation on x { - loops: Animation.Infinite - NumberAnimation { - from: 20; to: 450 - easing.type: "InOutQuad"; duration: 2000 - } - PauseAnimation { duration: 500 } + gradient: Gradient { + GradientStop {color: "#CFF7FF"; position: 0.0} + GradientStop {color: "#99C0E5"; position: 0.57} + GradientStop {color: "#719FCB"; position: 0.9} } - SequentialAnimation on y { - loops: Animation.Infinite - NumberAnimation { - from: 20; to: 250 - easing.type: "InOutQuad"; duration: 2000 - } - PauseAnimation { duration: 500 } + Text { + id: label + anchors.centerIn: parent + text: "Click Me!" + font.pointSize: 12 + color: "blue" } - SequentialAnimation on scale { - loops: Animation.Infinite - NumberAnimation { from: 1; to: 0.5; duration: 1000 } - NumberAnimation { from: 0.5; to: 1; duration: 1000 } - PauseAnimation { duration: 500 } + MouseArea { + anchors.fill: parent + onClicked: console.log(text + " clicked") } + //! [rectangle end] } + //! [rectangle end] +//! [parent end] } +//! [parent end] + //! [document] + +//! [ellipses] + //... +//! [ellipses] + + diff --git a/doc/src/snippets/declarative/reusablecomponents/qmldir b/doc/src/snippets/declarative/reusablecomponents/qmldir new file mode 100644 index 0000000..253732d --- /dev/null +++ b/doc/src/snippets/declarative/reusablecomponents/qmldir @@ -0,0 +1,4 @@ +//! [document] +Button ./Button.qml +FocusButton ./focusbutton.qml +//! [document] diff --git a/doc/src/snippets/declarative/states.qml b/doc/src/snippets/declarative/states.qml index c3b7197..ab6b8d0 100644 --- a/doc/src/snippets/declarative/states.qml +++ b/doc/src/snippets/declarative/states.qml @@ -37,24 +37,85 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ -//![0] +//![document] import QtQuick 1.0 - + +//![parent begin] Rectangle { - id: myRect - width: 200; height: 200 - color: "red" +//![parent begin] + + id: screen + width: 400; height: 500 - MouseArea { - anchors.fill: parent - onClicked: myRect.state = 'moved' - } + +Rectangle { + id: flag +} +Column { + spacing: 15 +//![signal states] +Rectangle { + id: signal + width: 200; height: 200 + state: "NORMAL" states: [ State { - name: "moved" - PropertyChanges { target: myRect; x: 50; y: 50 } + name: "NORMAL" + PropertyChanges { target: signal; color: "green"} + PropertyChanges { target: flag; state: "FLAG_DOWN"} + }, + State { + name: "CRITICAL" + PropertyChanges { target: signal; color: "red"} + PropertyChanges { target: flag; state: "FLAG_UP"} } ] } -//![0] +//![signal states] + +//![switch states] +Rectangle { + id: signalswitch + width: 75; height: 75 + color: "blue" + + MouseArea { + anchors.fill: parent + onClicked: { + if (signal.state == "NORMAL") + signal.state = "CRITICAL" + else + signal.state = "NORMAL" + } + } +} +//![switch states] + +//![when property] +Rectangle { + id: bell + width: 75; height: 75 + color: "yellow" + + states: State { + name: "RINGING" + when: (signal.state == "CRITICAL") + PropertyChanges {target: speaker; play: "RING!"} + } +} +//![when property] + +Text { + id: speaker + property alias play: speaker.text + text: "NORMAL" +} + +} // end of row + +//![parent end] +} +//![parent end] + +//![document] diff --git a/doc/src/snippets/declarative/qml-intro/hello-world5.qml b/doc/src/snippets/declarative/texthandling.qml index 7357282..377bb8b 100644 --- a/doc/src/snippets/declarative/qml-intro/hello-world5.qml +++ b/doc/src/snippets/declarative/texthandling.qml @@ -37,29 +37,53 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ - //! [document] import QtQuick 1.0 + +//! [parent begin] Rectangle { - id: myRectangle - width: 500 - height: 400 +//! [parent begin] + width: 300; height: 300 + id: screen + +Column { + anchors.centerIn:parent + +//! [int validator] +Column { + spacing: 10 Text { - text: "<h1>Hello world again</h1>" - color: "#002288" - x: 100; y: 100 + text: "Enter a value from 0 to 2000" } + TextInput { + focus: true + validator: IntValidator { bottom:0; top: 2000} + } +} +//! [int validator] + +//! [regexp validator] +Column { + spacing: 10 -//! [positioning the image] - Image { - source: "images/qt-logo.svg" - x: 100; y: 150 - width: 150; height: 150 + Text { + text: "Which basket?" + } + TextInput { + focus: true + validator: RegExpValidator { regExp: /fruit basket/ } } -//! [positioning the image] +} +//! [regexp validator] - color: "lightgray" +//end of column } + +//! [parent end] +} +//! [parent end] + //! [document] + diff --git a/doc/src/snippets/declarative/webview/webview.qml b/doc/src/snippets/declarative/webview/webview.qml index dac8010..f652369 100644 --- a/doc/src/snippets/declarative/webview/webview.qml +++ b/doc/src/snippets/declarative/webview/webview.qml @@ -39,7 +39,9 @@ ****************************************************************************/ //! [document] +//! [import] import QtWebKit 1.0 +//! [import] WebView { url: "http://www.nokia.com" |