diff options
author | Bea Lam <bea.lam@nokia.com> | 2012-05-28 11:56:24 +1000 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-05-31 10:40:41 +0200 |
commit | 4c671c046e8140bfb8372aab2c38aabe82b102b0 (patch) | |
tree | 7a70a75a553dcc806372a6b43ea39da05191db8a /src/quick/doc | |
parent | 0c7669b241aae96fca97acae0b628e627d5bfc4e (diff) |
Fix doc snippets paths and parsing errors
qtqml.qdocconf and qtquick.qdocconf now refer to the correct
snippets and source directories.
Snippet paths in .qdoc and .cpp files have been updated to refer to
the new shortened path references, e.g. \snippet qml/file.cpp instead of
\snippet doc/src/snippets/qml/file.cpp.
This also deletes snippets from src/qml/doc/snippets that belonged under
src/quick/doc/snippets (and were already duplicated there anyway) and
restores some snippet files that shouldn't have been deleted.
Also fixes some inline snippets to use \code .. \endcode instead of
\qml .. \endqml as they contained javascript or partial QML
snippets that were causing parsing errors from qdoc.
There are still snippet errors arising from qmlintro.qdoc as the
qmlintro snippets directory that it refers to cannot be located.
There are also two references to a removed snippet identifier in
examples/qml/cppextensions/plugins/plugin.cpp that need to be fixed
in conjunction with the related docs in a later commit as the relevant
code has changed and the docs are now invalid.
Task-number: QTBUG-25721
Change-Id: I50c665245a74c140470c58a32546591d187dfe4b
Reviewed-by: Chris Adams <christopher.adams@nokia.com>
Diffstat (limited to 'src/quick/doc')
31 files changed, 1023 insertions, 129 deletions
diff --git a/src/quick/doc/qtquick.qdocconf b/src/quick/doc/qtquick.qdocconf index 8b0f9a43b3..452fe46ffc 100644 --- a/src/quick/doc/qtquick.qdocconf +++ b/src/quick/doc/qtquick.qdocconf @@ -83,7 +83,8 @@ headerdirs += .. sourcedirs += .. -exampledirs += ../../../examples \ +exampledirs += ../../../ \ + ../../../examples \ ../ \ snippets @@ -91,10 +92,7 @@ imagedirs += images #add qml sources because of dependencies headerdirs += ../../qml -sourcedirs += ../../qml -exampledirs += ../../qml/snippets \ - ../../qml - +exampledirs += ../../qml imagedirs += ../../qml #add particles sources diff --git a/src/quick/doc/snippets/qml/animatedimage.qml b/src/quick/doc/snippets/qml/animatedimage.qml index a483619e11..ab768442c8 100644 --- a/src/quick/doc/snippets/qml/animatedimage.qml +++ b/src/quick/doc/snippets/qml/animatedimage.qml @@ -39,7 +39,7 @@ ****************************************************************************/ // This snippet should be turned into an example and put in -// examples/declarative/imageelements/animatedimage +// examples/quick/imageelements/animatedimage //! [document] import QtQuick 2.0 diff --git a/src/quick/doc/snippets/qml/qml-extending-types/components/Button.qml b/src/quick/doc/snippets/qml/qml-extending-types/components/Button.qml new file mode 100644 index 0000000000..7cdd4b4d0c --- /dev/null +++ b/src/quick/doc/snippets/qml/qml-extending-types/components/Button.qml @@ -0,0 +1,53 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/ +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +//![0] +// Button.qml +import QtQuick 2.0 + +Rectangle { + width: 100; height: 100 + color: "red" + + MouseArea { + anchors.fill: parent + onClicked: console.log("Button clicked!") + } +} +//![0] diff --git a/src/quick/doc/snippets/qml/qml-extending-types/components/application.qml b/src/quick/doc/snippets/qml/qml-extending-types/components/application.qml new file mode 100644 index 0000000000..a01c74b668 --- /dev/null +++ b/src/quick/doc/snippets/qml/qml-extending-types/components/application.qml @@ -0,0 +1,49 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/ +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +//![0] +// application.qml +import QtQuick 2.0 + +Column { + Button { width: 50; height: 50 } + Button { x: 50; width: 100; height: 50; color: "blue" } + Button { width: 50; height: 50; radius: 8 } +} +//![0] diff --git a/src/quick/doc/snippets/qml/qml-extending-types/methods/app.qml b/src/quick/doc/snippets/qml/qml-extending-types/methods/app.qml new file mode 100644 index 0000000000..ef6e9220d2 --- /dev/null +++ b/src/quick/doc/snippets/qml/qml-extending-types/methods/app.qml @@ -0,0 +1,55 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/ +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +import QtQuick 2.0 +//![0] +Rectangle { + id: rect + width: 100; height: 100 + + function say(text) { + console.log("You said: " + text); + } + + MouseArea { + anchors.fill: parent + onClicked: rect.say("Mouse clicked") + } +} +//![0] diff --git a/src/quick/doc/snippets/qml/qml-extending-types/properties/ImageViewer.qml b/src/quick/doc/snippets/qml/qml-extending-types/properties/ImageViewer.qml new file mode 100644 index 0000000000..513a4e5c81 --- /dev/null +++ b/src/quick/doc/snippets/qml/qml-extending-types/properties/ImageViewer.qml @@ -0,0 +1,52 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/ +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +//![0] +// ImageViewer.qml +import QtQuick 2.0 + +Item { + id: item + width: 200; height: 200 + + property string currentImage: "default-image.png" + + Image { source: item.currentImage } +} +//![0] diff --git a/src/quick/doc/snippets/qml/qml-extending-types/properties/alias-override.qml b/src/quick/doc/snippets/qml/qml-extending-types/properties/alias-override.qml new file mode 100644 index 0000000000..0826a12e3c --- /dev/null +++ b/src/quick/doc/snippets/qml/qml-extending-types/properties/alias-override.qml @@ -0,0 +1,48 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/ +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +import QtQuick 2.0 +//![0] +Rectangle { + property alias color: childRect.color + color: "red" + + Rectangle { id: childRect } +} +//![0] diff --git a/src/quick/doc/snippets/qml/qml-extending-types/properties/alias.qml b/src/quick/doc/snippets/qml/qml-extending-types/properties/alias.qml new file mode 100644 index 0000000000..d3cc08b180 --- /dev/null +++ b/src/quick/doc/snippets/qml/qml-extending-types/properties/alias.qml @@ -0,0 +1,51 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/ +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +//![0] +// Button.qml +import QtQuick 2.0 + +Item { + property alias buttonText: textItem.text + + width: 200; height: 50 + + Text { id: textItem } +} +//![0] diff --git a/src/quick/doc/snippets/qml/qml-extending-types/properties/alias/ImageViewer.qml b/src/quick/doc/snippets/qml/qml-extending-types/properties/alias/ImageViewer.qml new file mode 100644 index 0000000000..4f78b20669 --- /dev/null +++ b/src/quick/doc/snippets/qml/qml-extending-types/properties/alias/ImageViewer.qml @@ -0,0 +1,52 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/ +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +//![0] +// ImageViewer.qml +import QtQuick 2.0 + +Item { + id: item + width: 200; height: 200 + + property alias currentImage: image + + Image { id: image } +} +//![0] diff --git a/src/quick/doc/snippets/qml/qml-extending-types/properties/alias/application.qml b/src/quick/doc/snippets/qml/qml-extending-types/properties/alias/application.qml new file mode 100644 index 0000000000..95b644cd07 --- /dev/null +++ b/src/quick/doc/snippets/qml/qml-extending-types/properties/alias/application.qml @@ -0,0 +1,54 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/ +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +//![0] +// application.qml +import QtQuick 2.0 + +ImageViewer { + id: viewer + + currentImage.source: "http://qt.nokia.com/logo.png" + currentImage.width: width + currentImage.height: height + currentImage.fillMode: Image.Tile + + Text { text: currentImage.source } +} +//![0] diff --git a/src/quick/doc/snippets/qml/qml-extending-types/properties/application.qml b/src/quick/doc/snippets/qml/qml-extending-types/properties/application.qml new file mode 100644 index 0000000000..b78da54c10 --- /dev/null +++ b/src/quick/doc/snippets/qml/qml-extending-types/properties/application.qml @@ -0,0 +1,50 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/ +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +//![0] +import QtQuick 2.0 + +ImageViewer { + id: viewer + + currentImage: "http://qt.nokia.com/logo.png" + + Text { text: viewer.currentImage } +} +//![0] diff --git a/src/quick/doc/snippets/qml/qml-extending-types/properties/property-signals.qml b/src/quick/doc/snippets/qml/qml-extending-types/properties/property-signals.qml new file mode 100644 index 0000000000..a3d6433955 --- /dev/null +++ b/src/quick/doc/snippets/qml/qml-extending-types/properties/property-signals.qml @@ -0,0 +1,49 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/ +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +import QtQuick 2.0 +//![0] +Item { + property int myNumber + + onMyNumberChanged: { console.log("myNumber has changed:", myNumber); } + + Component.onCompleted: myNumber = 100 +} +//![0] diff --git a/src/quick/doc/snippets/qml/qml-extending-types/signals/Button.qml b/src/quick/doc/snippets/qml/qml-extending-types/signals/Button.qml new file mode 100644 index 0000000000..2e1855842e --- /dev/null +++ b/src/quick/doc/snippets/qml/qml-extending-types/signals/Button.qml @@ -0,0 +1,55 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/ +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +import QtQuick 2.0 + +//![0] +// Button.qml +Rectangle { + id: rect + width: 100; height: 100 + + signal buttonClicked(int xPos, int yPos) + + MouseArea { + anchors.fill: parent + onClicked: rect.buttonClicked(mouse.x, mouse.y) + } +} +//![0] diff --git a/src/quick/doc/snippets/qml/qml-extending-types/signals/basic.qml b/src/quick/doc/snippets/qml/qml-extending-types/signals/basic.qml new file mode 100644 index 0000000000..0454c869f5 --- /dev/null +++ b/src/quick/doc/snippets/qml/qml-extending-types/signals/basic.qml @@ -0,0 +1,55 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/ +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +//![0] +// Button.qml +import QtQuick 2.0 + +Rectangle { + id: rect + width: 100; height: 100 + + signal buttonClicked + + MouseArea { + anchors.fill: parent + onClicked: rect.buttonClicked() + } +} +//![0] diff --git a/src/quick/doc/snippets/qml/qml-extending-types/signals/connectdynamic.qml b/src/quick/doc/snippets/qml/qml-extending-types/signals/connectdynamic.qml new file mode 100644 index 0000000000..4774277d5d --- /dev/null +++ b/src/quick/doc/snippets/qml/qml-extending-types/signals/connectdynamic.qml @@ -0,0 +1,61 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/ +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +import QtQuick 2.0 +//![0] +Item { + id: item + width: 300; height: 100 + + function myMethod() { + console.log("Button was clicked!") + } + + Row { id: row } + + Component.onCompleted: { + var component = Qt.createComponent("Button.qml") + for (var i=0; i<3; i++) { + var button = component.createObject(row) + button.border.width = 1 + button.buttonClicked.connect(myMethod) + } + } +} +//![0] diff --git a/src/quick/doc/snippets/qml/qml-extending-types/signals/connectslots.qml b/src/quick/doc/snippets/qml/qml-extending-types/signals/connectslots.qml new file mode 100644 index 0000000000..ec0d2bec6a --- /dev/null +++ b/src/quick/doc/snippets/qml/qml-extending-types/signals/connectslots.qml @@ -0,0 +1,56 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/ +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +import QtQuick 2.0 +//![0] +Item { + id: item + width: 200; height: 200 + + function myMethod() { + console.log("Button was clicked!") + } + + Button { + id: button + anchors.fill: parent + Component.onCompleted: buttonClicked.connect(item.myMethod) + } +} +//![0] diff --git a/src/quick/doc/snippets/qml/qml-extending-types/signals/no-parameters.qml b/src/quick/doc/snippets/qml/qml-extending-types/signals/no-parameters.qml new file mode 100644 index 0000000000..09cdfd40de --- /dev/null +++ b/src/quick/doc/snippets/qml/qml-extending-types/signals/no-parameters.qml @@ -0,0 +1,49 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/ +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +//![0] +// application.qml +import QtQuick 2.0 + +Button { + width: 100; height: 100 + onButtonClicked: console.log("Mouse was clicked") +} +//![0] + diff --git a/src/quick/doc/snippets/qml/qml-extending-types/signals/parameters.qml b/src/quick/doc/snippets/qml/qml-extending-types/signals/parameters.qml new file mode 100644 index 0000000000..d2a2071557 --- /dev/null +++ b/src/quick/doc/snippets/qml/qml-extending-types/signals/parameters.qml @@ -0,0 +1,50 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/ +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +import QtQuick 2.0 +//![0] +// application.qml +Button { + width: 100; height: 100 + onButtonClicked: { + console.log("Mouse clicked at " + xPos + "," + yPos) + } +} +//![0] + diff --git a/src/quick/doc/snippets/qml/texteditor.qml b/src/quick/doc/snippets/qml/texteditor.qml new file mode 100644 index 0000000000..cc28992223 --- /dev/null +++ b/src/quick/doc/snippets/qml/texteditor.qml @@ -0,0 +1,72 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/ +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +import QtQuick 2.0 + +//! [0] +Flickable { + id: flick + + width: 300; height: 200; + contentWidth: edit.paintedWidth + contentHeight: edit.paintedHeight + clip: true + + function ensureVisible(r) + { + if (contentX >= r.x) + contentX = r.x; + else if (contentX+width <= r.x+r.width) + contentX = r.x+r.width-width; + if (contentY >= r.y) + contentY = r.y; + else if (contentY+height <= r.y+r.height) + contentY = r.y+r.height-height; + } + + TextEdit { + id: edit + width: flick.width + height: flick.height + focus: true + wrapMode: TextEdit.Wrap + onCursorRectangleChanged: flick.ensureVisible(cursorRectangle) + } + } +//! [0] diff --git a/src/quick/doc/src/animation.qdoc b/src/quick/doc/src/animation.qdoc index 013359a0c5..6644e794f5 100644 --- a/src/quick/doc/src/animation.qdoc +++ b/src/quick/doc/src/animation.qdoc @@ -71,14 +71,14 @@ There are several ways of setting animation to an object. To create an immediate movement or animated movement, set the property value directly. This may be done in signal handlers or attached properties. -\snippet doc/snippets/qml/animation.qml direct property change +\snippet qml/animation.qml direct property change However, to create more control, \e {property animations} apply smooth movements by interpolating values between property value changes. Property animations provide timing controls and allows different interpolations through \l{qml-easing-animation}{easing curves}. -\snippet doc/snippets/qml/animation.qml property animation +\snippet qml/animation.qml property animation Specialized \l{qml-property-animation-elements}{property animation elements} have more efficient implementations than the \l{PropertyAnimation} element. They @@ -107,14 +107,14 @@ change from the \c pressed state to the \c released state. Likewise, there would be an animation during the change from the \c released state to the \c pressed state. -\snippet doc/snippets/qml/animation.qml transition animation +\snippet qml/animation.qml transition animation Binding the \c to and \c from properties to the state's name will assign that particular transition to the state change. For simple or symmetric transitions, setting the to \c to property to the wild card symbol, "\c{*}", denotes that the transition applies to any state change. -\snippet doc/snippets/qml/animation.qml wildcard animation +\snippet qml/animation.qml wildcard animation \section2 Default Animation as Behaviors @@ -128,7 +128,7 @@ A ball component might have a behavior animation assigned to its \c x, \c y, and elastic effect. In effect, this behavior animation would apply the elastic effect to the properties whenever the ball moves. -\snippet doc/snippets/qml/animation.qml behavior animation +\snippet qml/animation.qml behavior animation There are several methods of assigning behavior animations to properties. The \c{Behavior on <property>} declaration is a convenient way of assigning a @@ -151,7 +151,7 @@ object. Using the \l{SequentialAnimation} element, the opacity animations will play after the preceding animation finishes. The \l{ParallelAnimation} element will play the animations at the same time. -\snippet doc/snippets/qml/animation.qml sequential animation +\snippet qml/animation.qml sequential animation Once individual animations are placed into a SequentialAnimation or ParallelAnimation, they can no longer be started and stopped independently. The @@ -249,18 +249,3 @@ Rectangle { \endqml */ - - - -\snippet doc/snippets/qml/animation-elements.qml color -\snippet doc/snippets/qml/animation-propertyvaluesource.qml 0 -\snippet doc/snippets/qml/animation-signalhandler.qml 0 -\snippet doc/snippets/qml/animation-standalone.qml 0 - -\snippet doc/snippets/qml/animation-transitions.qml 0 -\snippet doc/snippets/qml/animation-groups.qml 0 - -\snippet doc/snippets/qml/animation-groups.qml 1 -\snippet doc/snippets/qml/animation-groups.qml 0 -\image propanim.gif - diff --git a/src/quick/doc/src/focus.qdoc b/src/quick/doc/src/focus.qdoc index 1aafb10baa..69617c9773 100644 --- a/src/quick/doc/src/focus.qdoc +++ b/src/quick/doc/src/focus.qdoc @@ -56,8 +56,8 @@ If the \c {Rectangle} element in the following example has active focus and the it will bubble up to its parent. However, pressing the \c B key will bubble up to the root item and thus subsequently be ignored. -\snippet doc/snippets/qml/focus/rectangle.qml simple key event -\snippet doc/snippets/qml/focus/rectangle.qml simple key event end +\snippet qml/focus/rectangle.qml simple key event +\snippet qml/focus/rectangle.qml simple key event end \li If the root \l Item is reached, the key event is \l {QEvent::ignore()}{ignored} and regular Qt key handling continues. @@ -71,7 +71,7 @@ Whether or not an \l Item has active focus can be queried through the property \c {Item::activeFocus} property. For example, here we have a \l Text element whose text is determined by whether or not it has active focus. -\snippet doc/snippets/qml/focus/rectangle.qml active focus +\snippet qml/focus/rectangle.qml active focus \section1 Acquiring Focus and Focus Scopes @@ -82,7 +82,7 @@ sufficient. If we run the following example with the \l {QML Viewer}, we see tha the \c {keyHandler} element has active focus and pressing the \c A, \c B, or \c C keys modifies the text appropriately. -\snippet doc/snippets/qml/focus/basicwidget.qml focus true +\snippet qml/focus/basicwidget.qml focus true \image declarative-qmlfocus1.png @@ -95,10 +95,10 @@ set the first one to have focus. The intention is that when the \c A, \c B, or responds accordingly. The code that imports and creates two MyWidget instances: -\snippet doc/snippets/qml/focus/widget.qml window +\snippet qml/focus/widget.qml window The MyWidget code: -\snippet doc/snippets/qml/focus/MyWidget.qml mywidget +\snippet qml/focus/MyWidget.qml mywidget We would like to have the first MyWidget object to have the focus by setting its \c focus property to \c true. However, by running the code, we can confirm that @@ -126,7 +126,7 @@ A focus scope is created by declaring the \l FocusScope element. In the next example, a \l FocusScope element is added to the component, and the visual result shown. -\snippet doc/snippets/qml/focus/myfocusscopewidget.qml widget in focusscope +\snippet qml/focus/myfocusscopewidget.qml widget in focusscope \image declarative-qmlfocus3.png @@ -158,10 +158,10 @@ Now, clicking either MyClickableWidget gives it focus and the other widget loses the focus. The code that imports and creates two MyClickableWidget instances: -\snippet doc/snippets/qml/focus/clickablewidget.qml clickable window +\snippet qml/focus/clickablewidget.qml clickable window The MyClickableWidget code: -\snippet doc/snippets/qml/focus/MyClickableWidget.qml clickable in focusscope +\snippet qml/focus/MyClickableWidget.qml clickable in focusscope \image declarative-qmlfocus4.png @@ -188,7 +188,7 @@ current item delegate to react to key presses. This contrived example shows how this works. Pressing the \c Return key will print the name of the current list item. -\snippet doc/snippets/qml/focus/advancedFocus.qml FocusScope delegate +\snippet qml/focus/advancedFocus.qml FocusScope delegate \image declarative-qmlfocus5.png diff --git a/src/quick/doc/src/localstorage/localstorage.qdoc b/src/quick/doc/src/localstorage/localstorage.qdoc index 96c44328cb..e9d2a46b53 100644 --- a/src/quick/doc/src/localstorage/localstorage.qdoc +++ b/src/quick/doc/src/localstorage/localstorage.qdoc @@ -64,12 +64,12 @@ Database connections are automatically closed during Javascript garbage collecti The API can be used from JavaScript functions in your QML: -\snippet declarative/sqllocalstorage/hello.qml 0 +\snippet examples/localstorage/hello.qml 0 The API conforms to the Synchronous API of the HTML5 Web Database API, \link http://www.w3.org/TR/2009/WD-webdatabase-20091029/ W3C Working Draft 29 October 2009\endlink. -The \l{declarative/sqllocalstorage}{SQL Local Storage example} demonstrates the basics of +The \l{examples/localstorage}{SQL Local Storage example} demonstrates the basics of using the Local Storage API. \section3 db = openDatabaseSync(identifier, version, description, estimated_size, callback(db)) diff --git a/src/quick/doc/src/modelview.qdoc b/src/quick/doc/src/modelview.qdoc index 7d5b334ee7..e9a34b34e4 100644 --- a/src/quick/doc/src/modelview.qdoc +++ b/src/quick/doc/src/modelview.qdoc @@ -80,13 +80,13 @@ To visualize data, bind the view's \c model property to a model and the Suppose that a specific club wants to decorate its members list with its brand colors. A member list is in a \c model and the \c delegate will display the model's content. - \snippet doc/snippets/qml/listview-decorations.qml model - \snippet doc/snippets/qml/listview-decorations.qml delegate + \snippet qml/listview-decorations.qml model + \snippet qml/listview-decorations.qml delegate The club may decorate the members list by binding visual objects to the \c header and \c footer properties. The visual object may be defined inline, in another file, or in a \l {Component} element. - \snippet doc/snippets/qml/listview-decorations.qml decorations + \snippet qml/listview-decorations.qml decorations \image listview-decorations.png \section2 Mouse and Touch Handling @@ -110,8 +110,8 @@ To visualize data, bind the view's \c model property to a model and the A list may contain a list indicating people's names and the team on which team the person belongs. - \snippet doc/snippets/qml/listview-sections.qml model - \snippet doc/snippets/qml/listview-sections.qml delegate + \snippet qml/listview-sections.qml model + \snippet qml/listview-sections.qml delegate The ListView element has the \c section \l{Property Binding in QML#Attached Properties}{attached property} that can combine adjacent and related @@ -119,7 +119,7 @@ To visualize data, bind the view's \c model property to a model and the which list element property to use as sections. The \c criteria can dictate how the section names are displayed and the \c delegate is similar to the views' \l {qml-view-delegate}{delegate} property. - \snippet doc/snippets/qml/listview-sections.qml section + \snippet qml/listview-sections.qml section \image listview-section.png \keyword qml-view-delegate @@ -129,7 +129,7 @@ To visualize data, bind the view's \c model property to a model and the visualize each item list according to the template defined by the delegate. Items in a model are accessible through the \c index property as well as the item's properties. - \snippet doc/snippets/qml/listview.qml delegate + \snippet qml/listview.qml delegate \image listview-setup.png \section2 Accessing Views and Models from Delegates @@ -150,7 +150,7 @@ To visualize data, bind the view's \c model property to a model and the the model, and the color of one of the fields depends on the property \e{fruit_color} of the view. - \snippet doc/snippets/qml/models/views-models-delegates.qml rectangle + \snippet qml/models/views-models-delegates.qml rectangle \keyword qml-data-models \section1 Models @@ -159,7 +159,7 @@ To visualize data, bind the view's \c model property to a model and the bind to. Here is a ListModel with two roles, \e type and \e age, and a ListView with a delegate that binds to these roles to display their values: - \snippet doc/snippets/qml/qml-data-models/listmodel-listview.qml document + \snippet qml/qml-data-models/listmodel-listview.qml document If there is a naming clash between the model's properties and the delegate's properties, the roles can be accessed with the qualified \e model name @@ -197,12 +197,12 @@ To visualize data, bind the view's \c model property to a model and the ListModel is a simple hierarchy of elements specified in QML. The available roles are specified by the \l ListElement properties. - \snippet doc/snippets/qml/qml-data-models/listelements.qml model + \snippet qml/qml-data-models/listelements.qml model The above model has two roles, \e name and \e cost. These can be bound to by a ListView delegate, for example: - \snippet doc/snippets/qml/qml-data-models/listelements.qml view + \snippet qml/qml-data-models/listelements.qml view ListModel provides methods to manipulate the ListModel directly via JavaScript. In this case, the first item inserted determines the roles available @@ -210,9 +210,9 @@ To visualize data, bind the view's \c model property to a model and the created and populated via JavaScript, the roles provided by the first insertion are the only roles that will be shown in the view: - \snippet doc/snippets/qml/qml-data-models/dynamic-listmodel.qml model + \snippet qml/qml-data-models/dynamic-listmodel.qml model \dots - \snippet doc/snippets/qml/qml-data-models/dynamic-listmodel.qml mouse area + \snippet qml/qml-data-models/dynamic-listmodel.qml mouse area When the MouseArea is clicked, \c fruitModel will have two roles, \e cost and \e name. Even if subsequent roles are added, only the first two will be handled by views @@ -253,7 +253,7 @@ To visualize data, bind the view's \c model property to a model and the VisualItemModel provide the contents of the delegate. The model does not provide any roles. - \snippet doc/snippets/qml/models/visual-model-and-view.qml visual model and view + \snippet qml/models/visual-model-and-view.qml visual model and view Note that in the above example there is no delegate required. The items of the model itself provide the visual elements that @@ -347,7 +347,7 @@ The following example shows a repeater used with a \l{#Grid}{Grid} item to arrange a set of Rectangle items. The Repeater item creates a series of 24 rectangles for the Grid item to position in a 5 by 5 arrangement. -\snippet doc/snippets/qml/repeaters/repeater-grid-index.qml document +\snippet qml/repeaters/repeater-grid-index.qml document The number of items created by a Repeater is held by its \l{Repeater::}{count} property. It is not possible to set this property to determine the number of diff --git a/src/quick/doc/src/mouseevents.qdoc b/src/quick/doc/src/mouseevents.qdoc index 2281cda1cd..aa4f3501e0 100644 --- a/src/quick/doc/src/mouseevents.qdoc +++ b/src/quick/doc/src/mouseevents.qdoc @@ -55,7 +55,7 @@ to define this area is to anchor the \c MouseArea to its parent's area using the component), then the MouseArea will fill the area defined by the parent's dimensions. Alternatively, an area smaller or larger than the parent is definable. -\snippet doc/snippets/qml/mousearea/mousearea-snippet.qml anchor fill +\snippet qml/mousearea/mousearea-snippet.qml anchor fill \section1 Receiving Events @@ -77,7 +77,7 @@ gestures in greater detail: \endlist These signals have signal handlers that are invoked when the signals are emitted. -\snippet doc/snippets/qml/mousearea/mousearea-snippet.qml mouse handlers +\snippet qml/mousearea/mousearea-snippet.qml mouse handlers \section1 Enabling Gestures Some mouse gestures and button clicks need to be enabled before they send or @@ -95,7 +95,7 @@ positioning even when there are no mouse button presses. Setting the \c hoverEnabled property to \c true, in turn will enable the \c entered, \c exited, and \c positionChanged signal and their respective signal handlers. -\snippet doc/snippets/qml/mousearea/mousearea-snippet.qml enable handlers +\snippet qml/mousearea/mousearea-snippet.qml enable handlers Additionally, to disable the whole mouse area, set the \c MouseArea element's \c enabled property to \c false. diff --git a/src/quick/doc/src/positioners.qdoc b/src/quick/doc/src/positioners.qdoc index d73d1cdbac..4ca87cf910 100644 --- a/src/quick/doc/src/positioners.qdoc +++ b/src/quick/doc/src/positioners.qdoc @@ -61,7 +61,7 @@ uses a Column item to arrange three \l Rectangle items in an area defined by an outer \l Item. The \l{Column::spacing}{spacing} property is set to include a small amount of space between the rectangles. -\snippet doc/snippets/qml/column/column.qml document +\snippet qml/column/column.qml document Note that, since Column inherits directly from Item, any background color must be added to a parent Rectangle, if desired. @@ -80,7 +80,7 @@ include a small amount of space between the rectangles. We ensure that the parent Rectangle is large enough so that there is some space left around the edges of the horizontally centered Row item. -\snippet doc/snippets/qml/row.qml document +\snippet qml/row.qml document \section2 Grid @@ -93,7 +93,7 @@ The following example uses a Grid item to place four \l Rectangle items in a 2-by-2 grid. As with the other positioners, the spacing between items can be specified using the \l{Grid::spacing}{spacing} property. -\snippet doc/snippets/qml/grid-spacing.qml document +\snippet qml/grid-spacing.qml document There is no difference between horizontal and vertical spacing inserted between items, so any additional space must be added within the items @@ -122,7 +122,7 @@ The following example shows a Flow item containing a number of \l Text child items. These are arranged in a similar way to those shown in the screenshots. -\snippet doc/snippets/qml/flow.qml document +\snippet qml/flow.qml document The main differences between the Grid and Flow positioners are that items inside a Flow will wrap when they run out of space on the minor axis, and diff --git a/src/quick/doc/src/qmlintro.qdoc b/src/quick/doc/src/qmlintro.qdoc index 86502b0d17..8a01e6464a 100644 --- a/src/quick/doc/src/qmlintro.qdoc +++ b/src/quick/doc/src/qmlintro.qdoc @@ -41,7 +41,7 @@ diving deeper into QML. It is also helpful to have a basic understanding of other Web technologies like HTML and JSON, but it is not required. The examples shown in this guide are located in the -\c{examples/declarative/tutorials/qmlintro} directory within the Qt source +\c{examples/quick/tutorials/qmlintro} directory within the Qt source package. You can run then with the \l{QML Viewer} tool. \section1 \l{QML Concepts and Syntax} @@ -75,7 +75,7 @@ The following example shows the basic syntax of QML. When opened in the \l{QML Viewer}{\QQV tool}, the output displayed should match the image shown on the right: a light blue rectangle. -\snippet examples/declarative/tutorials/qmlintro/basic-syntax.qml document +\snippet examples/quick/tutorials/qmlintro/basic-syntax.qml document In this example, we import the features defined by Qt Quick 1.0, and we declare and create a single rectangle with width, height and color. @@ -103,7 +103,7 @@ defined for the object, such as its property values and any child objects. \div {class="float-right"} \inlineimage declarative-qmlintro-elements1.png \enddiv -\snippet examples/declarative/tutorials/qmlintro/elements1.qml document +\snippet examples/quick/tutorials/qmlintro/elements1.qml document Here, we create two elements: a rectangle with an image inside it. We say that the rectangle is the parent element and the image is its child. Since the @@ -119,7 +119,7 @@ element. \div {class="float-right"} \inlineimage declarative-qmlintro-elements2.png \enddiv -\snippet examples/declarative/tutorials/qmlintro/elements2.qml document +\snippet examples/quick/tutorials/qmlintro/elements2.qml document In this example, we can define as many elements inside the rectangle as we like, but we cannot define other top level elements. All the @@ -218,11 +218,11 @@ display text. Grouped properties can be written like this: -\snippet examples/declarative/tutorials/qmlintro/grouped-properties1.qml text with grouped properties +\snippet examples/quick/tutorials/qmlintro/grouped-properties1.qml text with grouped properties or like this: -\snippet examples/declarative/tutorials/qmlintro/grouped-properties2.qml text with grouped properties +\snippet examples/quick/tutorials/qmlintro/grouped-properties2.qml text with grouped properties In the element documentation, grouped properties are shown using the "dot" notation. @@ -276,7 +276,7 @@ automatically updated to the new value. For example: \br \inlineimage declarative-qmlintro-property-binding2.png \enddiv -\snippet examples/declarative/tutorials/qmlintro/property-binding.qml elements +\snippet examples/quick/tutorials/qmlintro/property-binding.qml elements Here, the child \l Rectangle item's \c width property is set relative to the width of its parent. Whenever the parent's width changes, the width of @@ -308,7 +308,7 @@ to be the same as that of the Text object by referring to \inlineimage declarative-qmlintro-object-identifiers.png \enddiv -\snippet examples/declarative/tutorials/qmlintro/object-identifiers.qml document +\snippet examples/quick/tutorials/qmlintro/object-identifiers.qml document An object can be referred to by its \c id from anywhere within the \l{QML Documents}{component} in which it is declared. Therefore, an @@ -340,7 +340,7 @@ Comments are ignored by the QML engine. They are useful for explaining what you are doing; for referring back to at a later date, or for others reading your QML files. -\snippet examples/declarative/tutorials/qmlintro/comments.qml commenting +\snippet examples/quick/tutorials/qmlintro/comments.qml commenting Comments can also be used to prevent the execution of code, which is sometimes useful for tracking down problems. In the above example, the @@ -363,7 +363,7 @@ For example, the \l MouseArea element has an \l{MouseArea::}{onClicked} handler that can be used to respond to a mouse click. Below, we use this handler to print a message whenever the mouse is clicked: -\snippet examples/declarative/tutorials/qmlintro/signal-handlers.qml document +\snippet examples/quick/tutorials/qmlintro/signal-handlers.qml document All signal handlers begin with \e "on". @@ -372,7 +372,7 @@ the MouseArea \l{MouseArea::}{onPressed} signal handler has a \c mouse parameter that contains information about the mouse press. This parameter can be referred to in the JavaScript code, as below: -\snippet examples/declarative/tutorials/qmlintro/signal-handlers-parameters.qml mouse area +\snippet examples/quick/tutorials/qmlintro/signal-handlers-parameters.qml mouse area \section2 Property Change Notifications @@ -396,7 +396,7 @@ The following code shows this in practice: \br \inlineimage declarative-qmlintro-property-change2.png \enddiv -\snippet examples/declarative/tutorials/qmlintro/property-change.qml property change +\snippet examples/quick/tutorials/qmlintro/property-change.qml property change When the user modifies the text, the expression assigned to the \c textChanged handler will be evaluated. In this example, the text changes color when this @@ -435,7 +435,7 @@ attaches properties for handling key presses to any item. For example: \div {class="float-right"} \inlineimage declarative-qmlintro-attached-properties.png \enddiv -\snippet examples/declarative/tutorials/qmlintro/attached-properties.qml attached properties +\snippet examples/quick/tutorials/qmlintro/attached-properties.qml attached properties The \l Keys properties are not defined by the \l Item element. They are defined separately and attached to the item. @@ -447,7 +447,7 @@ the \e ListView.isCurrentItem property to each delegate it creates: \div {class="float-right"} \inlineimage declarative-qmlintro-attached-properties-view.png \enddiv -\snippet examples/declarative/tutorials/qmlintro/attached-properties-view.qml delegate with attached property +\snippet examples/quick/tutorials/qmlintro/attached-properties-view.qml delegate with attached property In effect, by attaching this property, \l ListView provides an interface that lets the delegate access information about the current item in the @@ -528,7 +528,7 @@ center of a \l Rectangle. \div {class="float-right"} \inlineimage declarative-qmlintro-anchors-centerin.png \enddiv -\snippet examples/declarative/tutorials/qmlintro/anchors.qml centered text +\snippet examples/quick/tutorials/qmlintro/anchors.qml centered text In this case, the center of the text item is anchored to the center of its parent item by using the \c{anchors.centerIn} grouped property. @@ -549,7 +549,7 @@ to define its position relative to the text item. \div {class="float-right"} \inlineimage declarative-qmlintro-anchors-edges.png \enddiv -\snippet examples/declarative/tutorials/qmlintro/anchors2.qml anchored items +\snippet examples/quick/tutorials/qmlintro/anchors2.qml anchored items By giving the text item the \c textItem identifier, we can refer to it when defining the anchors for the rectangle. We line up the right edge of the @@ -575,7 +575,7 @@ the same width. \br \inlineimage declarative-qmlintro-anchors-expanding2.png \enddiv -\snippet examples/declarative/tutorials/qmlintro/anchors-expanding.qml anchored items +\snippet examples/quick/tutorials/qmlintro/anchors-expanding.qml anchored items The anchor lines on the left and right edges of the rectangle are connected to those of the text input item. Since the text can be modified by the user, @@ -597,7 +597,7 @@ between them. \br \inlineimage declarative-qmlintro-anchors-baseline-margins.png \enddiv -\snippet examples/declarative/tutorials/qmlintro/anchors-margins.qml anchored items +\snippet examples/quick/tutorials/qmlintro/anchors-margins.qml anchored items Note that the image also uses a margin to leave a gap between its left edge and the left edge of the user interface. @@ -634,7 +634,7 @@ order in which items will be updated. Problems can occur if circular dependencie are created between items. The following example shows this occurring with a parent item and its child. -\snippet examples/declarative/tutorials/qmlintro/circular.qml circular +\snippet examples/quick/tutorials/qmlintro/circular.qml circular \section3 Strategies for Use @@ -655,7 +655,7 @@ items contain an image and a text item that are anchored to their parent. \div {class="float-right"} \inlineimage declarative-qmlintro-anchors-strategy-annotated.png \enddiv -\snippet examples/declarative/tutorials/qmlintro/anchors-strategy.qml anchor strategy +\snippet examples/quick/tutorials/qmlintro/anchors-strategy.qml anchor strategy The above example shows how each item is anchored to its parent. This ensures that the dependencies introduced by the anchors all consistently point to each @@ -687,7 +687,7 @@ item. \div {class="float-right"} \inlineimage declarative-qmlintro-anchors-stretch.png \enddiv -\snippet examples/declarative/tutorials/qmlintro/anchors-stretch.qml items +\snippet examples/quick/tutorials/qmlintro/anchors-stretch.qml items The rectangle uses anchors to define its top, left and right edges in terms of its parent item, and the bottom edge is aligned with the top of the text @@ -745,7 +745,7 @@ include a small amount of space between the rectangles. \div {class="float-right"} \inlineimage qml-row.png \enddiv -\snippet examples/declarative/tutorials/qmlintro/row.qml document +\snippet examples/quick/tutorials/qmlintro/row.qml document We ensure that the parent \l Rectangle is large enough so that there is some space left around the edges of the horizontally centered Row item. The equally-sized @@ -763,7 +763,7 @@ different sizes. \div {class="float-right"} \inlineimage declarative-qmlintro-row-anchors.png \enddiv -\snippet examples/declarative/tutorials/qmlintro/row-anchors.qml row +\snippet examples/quick/tutorials/qmlintro/row-anchors.qml row Note that the \l Row item itself uses \c horizontalCenter and \c verticalCenter anchors to place itself in the center of its parent. It is free to do this @@ -787,7 +787,7 @@ include a small amount of space between the rectangles. \div {class="float-right"} \inlineimage qml-column.png \enddiv -\snippet examples/declarative/tutorials/qmlintro/column.qml document +\snippet examples/quick/tutorials/qmlintro/column.qml document In the above example, each of the rounded rectangles are positioned by the \l Column item. The column only changes the vertical positions of its @@ -803,7 +803,7 @@ it will only be as wide as the widest child item. \div {class="float-right"} \inlineimage declarative-qmlintro-column-anchors.png \enddiv -\snippet examples/declarative/tutorials/qmlintro/column-anchors.qml document +\snippet examples/quick/tutorials/qmlintro/column-anchors.qml document The example above stretches the column horizontally to fill the entire user interface, and stretches each rectangle inside to fill the column. @@ -819,7 +819,7 @@ can be specified using the \l{Grid::spacing}{spacing} property. \div {class="float-right"} \inlineimage qml-grid-spacing.png \enddiv -\snippet examples/declarative/tutorials/qmlintro/grid-spacing.qml document +\snippet examples/quick/tutorials/qmlintro/grid-spacing.qml document There is no difference between horizontal and vertical spacing inserted between items, so any additional space must be added within the items @@ -836,8 +836,8 @@ them. \div {class="float-right"} \inlineimage declarative-qmlintro-grid-positioning.png \enddiv -\snippet examples/declarative/tutorials/qmlintro/grid-positioning.qml document start -\snippet examples/declarative/tutorials/qmlintro/grid-positioning.qml document end +\snippet examples/quick/tutorials/qmlintro/grid-positioning.qml document start +\snippet examples/quick/tutorials/qmlintro/grid-positioning.qml document end We only show the first item, but the principle is the same for the others. @@ -861,7 +861,7 @@ screenshots. \br \inlineimage qml-flow-text2.png \enddiv -\snippet examples/declarative/tutorials/qmlintro/flow.qml document +\snippet examples/quick/tutorials/qmlintro/flow.qml document The main differences between the \l Grid and \l Flow positioners are that items inside a \l Flow will wrap when they run out of space on the minor @@ -878,7 +878,7 @@ items, placing one positioner inside another. The following example shows a \div {class="float-right"} \inlineimage declarative-qmlintro-nested-positioners.png \enddiv -\snippet examples/declarative/tutorials/qmlintro/nested-positioners.qml column +\snippet examples/quick/tutorials/qmlintro/nested-positioners.qml column The example works around the restrictions on the use of anchors mentioned earlier by using appropriate anchors for each item. The innermost items, @@ -941,7 +941,7 @@ is in the user interface, but it will not be visible in the running example. \div {class="float-right"} \inlineimage declarative-qmlintro-mousearea-annotated.png \enddiv -\snippet examples/declarative/tutorials/qmlintro/mousearea.qml mouse area +\snippet examples/quick/tutorials/qmlintro/mousearea.qml mouse area The \l{MouseArea::}{onPressed} and \l{MouseArea::}{onReleased} definitions are \l{QML Concepts and Syntax#Signal Handlers}{signal handlers} that @@ -965,7 +965,7 @@ area, and defines two signal handlers to response to mouse button input. \br \inlineimage declarative-qmlintro-mouse-pressed2.png \enddiv -\snippet examples/declarative/tutorials/qmlintro/mouse-pressed-signals.qml text item +\snippet examples/quick/tutorials/qmlintro/mouse-pressed-signals.qml text item The \l{MouseArea::}{onPressed} and \l{MouseArea::}{onReleased} signal handlers are defined for the mouse area. As a result, when the user @@ -981,7 +981,7 @@ operator), as in the following example. \div {class="float-right"} \inlineimage declarative-qmlintro-mouse-pressed-buttons.png \enddiv -\snippet examples/declarative/tutorials/qmlintro/mouse-pressed-buttons.qml items +\snippet examples/quick/tutorials/qmlintro/mouse-pressed-buttons.qml items The mouse area covers the entire area of the user interface and accepts input from both left and right buttons. Each of the rectangles defines its @@ -1005,7 +1005,7 @@ position of the cursor, as shown in the following example. \div {class="float-right"} \inlineimage declarative-qmlintro-mouse-pressed-position.png \enddiv -\snippet examples/declarative/tutorials/qmlintro/mouse-pressed-position.qml text item +\snippet examples/quick/tutorials/qmlintro/mouse-pressed-position.qml text item When the user presses the mouse button over the text item, the text changes to show the coordinates within the mouse area where the press occurred. If @@ -1023,7 +1023,7 @@ case, we could try the following: \div {class="float-right"} \inlineimage declarative-qmlintro-mouse-pressed-position2.png \enddiv -\snippet examples/declarative/tutorials/qmlintro/mouse-pressed-position2.qml text item +\snippet examples/quick/tutorials/qmlintro/mouse-pressed-position2.qml text item When we run this example, the text item shows the initial, default value of the mouse area's \c mouseX and \c mouseY properties. Moving the cursor over @@ -1038,7 +1038,7 @@ mouse cursor, we need to enable \e{mouse hover} by setting its \div {class="float-right"} \inlineimage declarative-qmlintro-mouse-hover-enabled.png \enddiv -\snippet examples/declarative/tutorials/qmlintro/mouse-hover-enabled.qml text item +\snippet examples/quick/tutorials/qmlintro/mouse-hover-enabled.qml text item With mouse hover enabled, other properties of the \l MouseArea can be monitored. For example, the \l{MouseArea::}{containsMouse} property can be @@ -1051,7 +1051,7 @@ press a mouse button over the area. \br \inlineimage declarative-qmlintro-mouse-hover-containsmouse2.png \enddiv -\snippet examples/declarative/tutorials/qmlintro/mouse-hover-containsmouse.qml items +\snippet examples/quick/tutorials/qmlintro/mouse-hover-containsmouse.qml items The above example uses \l{QML Concepts and Syntax#Expressions}{an expression} to show the coordinates of the mouse cursor when it is in the mouse area, @@ -1072,7 +1072,7 @@ following example shows how dragging is enabled for an item. \div {class="float-right"} \inlineimage declarative-qmlintro-mouse-drag.png \enddiv -\snippet examples/declarative/tutorials/qmlintro/mouse-drag.qml draggable item +\snippet examples/quick/tutorials/qmlintro/mouse-drag.qml draggable item The item to be dragged is the \l Rectangle containing a \l MouseArea and \l Text items. All that is required is to set the value of the @@ -1135,7 +1135,7 @@ positioner. These are defined with identifiers, \c{leftRect} and \br \inlineimage declarative-qmlintro-key-navigation2.png \enddiv -\snippet examples/declarative/tutorials/qmlintro/key-navigation.qml items +\snippet examples/quick/tutorials/qmlintro/key-navigation.qml items The \c{leftRect} rectangle attaches the \l{KeyNavigation::right}{KeyNavigation.right} property, setting it to refer @@ -1183,7 +1183,7 @@ The following example shows a repeater used with a \l{#Grid}{Grid} item to arrange a set of Rectangle items. The Repeater item creates a series of 24 rectangles for the Grid item to position in a 5 by 5 arrangement. -\snippet doc/snippets/qml/repeaters/repeater-grid-index.qml document +\snippet qml/repeaters/repeater-grid-index.qml document The number of items created by a Repeater is held by its \l{Repeater::}{count} property. It is not possible to set this property to determine the number of diff --git a/src/quick/doc/src/qmltexthandling.qdoc b/src/quick/doc/src/qmltexthandling.qdoc index 105b094be4..63f2c40145 100644 --- a/src/quick/doc/src/qmltexthandling.qdoc +++ b/src/quick/doc/src/qmltexthandling.qdoc @@ -60,10 +60,10 @@ respective element documentation. The \l {Validators}{validator} elements enforce the type and format of \l TextInput objects. -\snippet doc/snippets/qml/texthandling.qml int validator +\snippet qml/texthandling.qml int validator The validator elements bind to \c {TextInput}'s \c validator property. -\snippet doc/snippets/qml/texthandling.qml regexp validator +\snippet qml/texthandling.qml regexp validator The regular expression in the snippet will only allow the inputted text to be \c {fruit basket}. diff --git a/src/quick/doc/src/qtquick-intro.qdoc b/src/quick/doc/src/qtquick-intro.qdoc index 0fcf4ef603..56f507dd82 100644 --- a/src/quick/doc/src/qtquick-intro.qdoc +++ b/src/quick/doc/src/qtquick-intro.qdoc @@ -57,7 +57,7 @@ A Dial element might define a \e value property that can be used to control the position of the needle on the dial. The element could be declared to use a slider that adjusts the value of this property. -\snippet examples/declarative/ui-components/dialcontrol/qml/dialcontrol.qml the dial in use +\snippet examples/tutorials/ui-components/dialcontrol/dialcontrol.qml the dial in use Building user interfaces by importing these elements and linking their properties together is one of the fundamental features of QML and Qt Quick. diff --git a/src/quick/doc/src/righttoleft.qdoc b/src/quick/doc/src/righttoleft.qdoc index 2769970798..d24d18d0c2 100644 --- a/src/quick/doc/src/righttoleft.qdoc +++ b/src/quick/doc/src/righttoleft.qdoc @@ -68,7 +68,7 @@ Note that when \l LayoutMirroring is set, the \c horizontalAlignment property va the effective alignment of the text element that takes the mirroring into account can be read from the \c effectiveHorizontalAlignment property. -\snippet doc/snippets/qml/righttoleft.qml 0 +\snippet qml/righttoleft.qml 0 \section1 Layout direction of positioners and views @@ -84,7 +84,7 @@ This causes the effective \c layoutDirection of positioners and views to be mirr of the \c layoutDirection property will remain unchanged; the effective layout direction of positioners and views that takes the mirroring into account can be read from the \c effectiveLayoutDirection property. -\snippet doc/snippets/qml/righttoleft.qml 1 +\snippet qml/righttoleft.qml 1 \section1 Layout mirroring @@ -95,11 +95,11 @@ support for existing left-to-right Qt Quick applications. It mirrors the behavio You can enable layout mirroring for a particular \l Item: -\snippet doc/snippets/qml/righttoleft.qml 2 +\snippet qml/righttoleft.qml 2 Or set all child elements to also inherit the layout direction: -\snippet doc/snippets/qml/righttoleft.qml 3 +\snippet qml/righttoleft.qml 3 Applying mirroring in this manner does not change the actual value of the relevant anchor, \c layoutDirection or \c horizontalAlignment properties. The separate read-only property @@ -116,7 +116,7 @@ especially in views that rely on both the anchors and x coordinate-based positio the \l LayoutMirroring attached property to apply mirroring to an item that is positioned using \l {Item::}{x} coordinates: -\snippet doc/snippets/qml/righttoleft.qml 4 +\snippet qml/righttoleft.qml 4 Not all layouts should necessarily be mirrored. There are cases where a visual element is positioned to the right side of the screen for improved one-handed use, because most people are right-handed, and not @@ -135,7 +135,7 @@ aligned and just make sure that text is translated and aligned properly. Most images do not need to be mirrored, but some directional icons, such as arrows, may need to be mirrored. The painting of these icons can be mirrored with a dedicated \c mirror property introduced in Qt Quick 1.1: -\snippet doc/snippets/qml/righttoleft.qml 5 +\snippet qml/righttoleft.qml 5 \section1 Default layout direction diff --git a/src/quick/doc/src/states.qdoc b/src/quick/doc/src/states.qdoc index 13d2d82412..cc42adfb82 100644 --- a/src/quick/doc/src/states.qdoc +++ b/src/quick/doc/src/states.qdoc @@ -79,7 +79,7 @@ signal should be \c green and the warning \c flag is down. Meanwhile, in the \c CRITICAL state, the \c color should be \c red and the flag is \c up. We may model the states using the \c State element and the color and flag configurations with the \c PropertyChanges element. -\snippet doc/snippets/qml/states.qml signal states +\snippet qml/states.qml signal states The \l PropertyChanges element will change the values of object properties. Objects are referenced through their \l {qml-id}{id}. Objects outside the component are also referenced using the \c id property, exemplified by the @@ -88,7 +88,7 @@ property change to the external \c flag object. Further, the state may change by assigning the \c state property with the appropriate signal state. A state switch could be in a \l MouseArea element, assigning a different state whenever the signal receives a mouse click. -\snippet doc/snippets/qml/states.qml switch states +\snippet qml/states.qml switch states The State element is not limited to performing modifications on property values. It can also: @@ -114,7 +114,7 @@ expressions to change the state whenever the bound expression evaluates to \c true. The \c when property will revert the state back to the \l {The Default State}{default state} when the expression evaluates to false. -\snippet doc/snippets/qml/states.qml when property +\snippet qml/states.qml when property The \c bell component will change to the \c RINGING state whenever the \c signal.state is \c CRITICAL. diff --git a/src/quick/doc/src/writingcomponents.qdoc b/src/quick/doc/src/writingcomponents.qdoc index 104e1c6b2c..c664b7799f 100644 --- a/src/quick/doc/src/writingcomponents.qdoc +++ b/src/quick/doc/src/writingcomponents.qdoc @@ -55,14 +55,14 @@ For example, one of the simplest and most common components you can build in QML button-type component. Below, we implement this component as a \l Rectangle with a clickable \l MouseArea, in a file named \c Button.qml: -\snippet doc/snippets/qml/qml-extending-types/components/Button.qml 0 +\snippet qml/qml-extending-types/components/Button.qml 0 Now this component can be reused by another file within the same directory. Since the file is named \c Button.qml, the component is referred to as \c Button: \table \row -\li \snippet doc/snippets/qml/qml-extending-types/components/application.qml 0 +\li \snippet qml/qml-extending-types/components/application.qml 0 \li \image qml-extending-types.png \endtable @@ -119,8 +119,8 @@ an \c ImageViewer object and read or modify the \c currentImage value: \table \row -\li \snippet doc/snippets/qml/qml-extending-types/properties/ImageViewer.qml 0 -\li \snippet doc/snippets/qml/qml-extending-types/properties/application.qml 0 +\li \snippet qml/qml-extending-types/properties/ImageViewer.qml 0 +\li \snippet qml/qml-extending-types/properties/application.qml 0 \endtable It is optional for a property to have a default value. The default value is a convenient shortcut, and is @@ -195,7 +195,7 @@ property name. For example, the following \c onMyNumberChanged signal handler is automatically called whenever the \c myNumber property changes: -\snippet doc/snippets/qml/qml-extending-types/properties/property-signals.qml 0 +\snippet qml/qml-extending-types/properties/property-signals.qml 0 \section2 Default properties @@ -266,7 +266,7 @@ declaring the alias, and, optionally, <property> refers to a property on that ob For example, below is a \c Button.qml component with a \c buttonText aliased property which is connected to the child Text object's \c text property: -\snippet doc/snippets/qml/qml-extending-types/properties/alias.qml 0 +\snippet qml/qml-extending-types/properties/alias.qml 0 The following code would create a \c Button with a defined text string for the child \l Text object: @@ -290,8 +290,8 @@ been changed to an alias to the child \l Image object: \table \row -\li \snippet doc/snippets/qml/qml-extending-types/properties/alias/ImageViewer.qml 0 -\li \snippet doc/snippets/qml/qml-extending-types/properties/alias/application.qml 0 +\li \snippet qml/qml-extending-types/properties/alias/ImageViewer.qml 0 +\li \snippet qml/qml-extending-types/properties/alias/application.qml 0 \endtable Instead of being limited to setting the \l Image source, \c application.qml can now directly @@ -335,7 +335,7 @@ It is possible for an aliased property to have the same name as an existing prop the following component has a \c color alias property, named the same as the built-in \l {Rectangle::color} property: -\snippet doc/snippets/qml/qml-extending-types/properties/alias-override.qml 0 +\snippet qml/qml-extending-types/properties/alias-override.qml 0 Any objects that use this component and refer to its \c color property will be referring to the alias rather than the ordinary \l {Rectangle::color} property. Internally, @@ -366,7 +366,7 @@ the parameters by name. Here is an example of a component with a \c say() method that accepts a single \c text argument: -\snippet doc/snippets/qml/qml-extending-types/methods/app.qml 0 +\snippet qml/qml-extending-types/methods/app.qml 0 A method can be connected to a signal so that it is automatically invoked whenever the signal is emitted. See \l {Connecting signals to methods and other signals} below. @@ -422,8 +422,8 @@ signal is received by \c application.qml through an \c onButtonClicked signal ha \table \row -\li \snippet doc/snippets/qml/qml-extending-types/signals/basic.qml 0 -\li \snippet doc/snippets/qml/qml-extending-types/signals/no-parameters.qml 0 +\li \snippet qml/qml-extending-types/signals/basic.qml 0 +\li \snippet qml/qml-extending-types/signals/no-parameters.qml 0 \endtable If the signal has parameters, they are accessible by parameter name in the signal handler. @@ -431,8 +431,8 @@ In the example below, \c buttonClicked is emitted with \c xPos and \c yPos param \table \row -\li \snippet doc/snippets/qml/qml-extending-types/signals/Button.qml 0 -\li \snippet doc/snippets/qml/qml-extending-types/signals/parameters.qml 0 +\li \snippet qml/qml-extending-types/signals/Button.qml 0 +\li \snippet qml/qml-extending-types/signals/parameters.qml 0 \endtable @@ -446,7 +446,7 @@ to be received by a method instead of a \l {Signal Handlers}{signal handler}. For example, the \c application.qml above could be rewritten as: -\snippet doc/snippets/qml/qml-extending-types/signals/connectslots.qml 0 +\snippet qml/qml-extending-types/signals/connectslots.qml 0 The \c myMethod() method will be called whenever the \c buttonClicked signal is received. @@ -458,7 +458,7 @@ or \l {Integrating JavaScript}{integrating JavaScript code}, then you will find objects dynamically, and connects the \c buttonClicked signal of each object to the \c myMethod() function: -\snippet doc/snippets/qml/qml-extending-types/signals/connectdynamic.qml 0 +\snippet qml/qml-extending-types/signals/connectdynamic.qml 0 In the same way, you could connect a signal to methods defined in a dynamically created object, or \l {Receiving QML Signals in JavaScript}{connect a signal to a JavaScript method}. |