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 | |
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')
68 files changed, 1173 insertions, 271 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}. diff --git a/src/quick/items/qquickaccessibleattached.cpp b/src/quick/items/qquickaccessibleattached.cpp index 0ab96c184b..c07a60bd9a 100644 --- a/src/quick/items/qquickaccessibleattached.cpp +++ b/src/quick/items/qquickaccessibleattached.cpp @@ -98,13 +98,18 @@ QT_BEGIN_NAMESPACE \qml Item { id: myButton + Text { id: label // ... } + Accessible.name: label.text Accessible.role: Accessible.Button - funtion accessiblePressAction { ... } + + function accessiblePressAction() { + //... + } } \endqml diff --git a/src/quick/items/qquickanimatedimage.cpp b/src/quick/items/qquickanimatedimage.cpp index 4fd7b99190..f93dc4aa28 100644 --- a/src/quick/items/qquickanimatedimage.cpp +++ b/src/quick/items/qquickanimatedimage.cpp @@ -83,7 +83,7 @@ QT_BEGIN_NAMESPACE \b Note: Unlike images, animated images are not cached or shared internally. \clearfloat - \snippet doc/snippets/qml/animatedimage.qml document + \snippet qml/animatedimage.qml document \sa BorderImage, Image */ diff --git a/src/quick/items/qquickborderimage.cpp b/src/quick/items/qquickborderimage.cpp index 9c3992792e..015dca5809 100644 --- a/src/quick/items/qquickborderimage.cpp +++ b/src/quick/items/qquickborderimage.cpp @@ -100,7 +100,7 @@ QT_BEGIN_NAMESPACE used to determine the parts of the image that will lie inside the unscaled corner areas and the parts that will be stretched horizontally and vertically. - \snippet doc/snippets/qml/borderimage/normal-image.qml normal image + \snippet qml/borderimage/normal-image.qml normal image \clearfloat \beginfloatleft @@ -114,7 +114,7 @@ QT_BEGIN_NAMESPACE is set to \l{BorderImage::verticalTileMode}{BorderImage.Stretch}, the parts of image in regions 4 and 6 are stretched vertically. - \snippet doc/snippets/qml/borderimage/borderimage-scaled.qml scaled border image + \snippet qml/borderimage/borderimage-scaled.qml scaled border image \clearfloat \beginfloatleft @@ -128,7 +128,7 @@ QT_BEGIN_NAMESPACE \l{BorderImage::verticalTileMode}{BorderImage.Repeat}, the parts of image in regions 4 and 6 are tiled so that they fill the space at the left and right of the element. - \snippet doc/snippets/qml/borderimage/borderimage-tiled.qml tiled border image + \snippet qml/borderimage/borderimage-tiled.qml tiled border image \clearfloat In some situations, the width of regions 2 and 8 may not be an exact multiple of the width diff --git a/src/quick/items/qquickdrag.cpp b/src/quick/items/qquickdrag.cpp index bc9732b6b3..7768d73dca 100644 --- a/src/quick/items/qquickdrag.cpp +++ b/src/quick/items/qquickdrag.cpp @@ -112,7 +112,7 @@ public: However, dragging is not limited to mouse drags, anything that can move an item can generate drag events, this can include touch events, animations and bindings. - \snippet doc/snippets/qml/drag.qml 0 + \snippet qml/drag.qml 0 A drag can be terminated either by canceling it with Drag.cancel() or setting Drag.active to false, or it can be terminated with a drop event by calling diff --git a/src/quick/items/qquickflickable.cpp b/src/quick/items/qquickflickable.cpp index ba61ca4972..b6d80cdd9b 100644 --- a/src/quick/items/qquickflickable.cpp +++ b/src/quick/items/qquickflickable.cpp @@ -534,7 +534,7 @@ is finished. The following example shows a small view onto a large image in which the user can drag or flick the image in order to view different parts of it. - \snippet doc/snippets/qml/flickable.qml document + \snippet qml/flickable.qml document \clearfloat @@ -596,9 +596,9 @@ is finished. These properties are typically used to draw a scrollbar. For example: - \snippet doc/snippets/qml/flickableScrollbar.qml 0 + \snippet qml/flickableScrollbar.qml 0 \dots 8 - \snippet doc/snippets/qml/flickableScrollbar.qml 1 + \snippet qml/flickableScrollbar.qml 1 \sa {declarative/ui-components/scrollbar}{scrollbar example} */ @@ -1507,7 +1507,7 @@ void QQuickFlickable::setBoundsBehavior(BoundsBehavior b) The following snippet shows how these properties are used to display an image that is larger than the Flickable item itself: - \snippet doc/snippets/qml/flickable.qml document + \snippet qml/flickable.qml document In some cases, the the content dimensions can be automatically set using the \l {Item::childrenRect.width}{childrenRect.width} diff --git a/src/quick/items/qquickflipable.cpp b/src/quick/items/qquickflipable.cpp index 0231e84cf7..c2f487c9f2 100644 --- a/src/quick/items/qquickflipable.cpp +++ b/src/quick/items/qquickflipable.cpp @@ -113,7 +113,7 @@ public: degrees to produce the flipping effect. When \c flipped is false, the item reverts to the default state, in which the \c angle value is 0. - \snippet doc/snippets/qml/flipable/flipable.qml 0 + \snippet qml/flipable/flipable.qml 0 \image flipable.gif diff --git a/src/quick/items/qquickgridview.cpp b/src/quick/items/qquickgridview.cpp index 48d04bf7e7..932518489f 100644 --- a/src/quick/items/qquickgridview.cpp +++ b/src/quick/items/qquickgridview.cpp @@ -1167,7 +1167,7 @@ void QQuickGridViewPrivate::flick(AxisData &data, qreal minExtent, qreal maxExte The following example shows the definition of a simple list model defined in a file called \c ContactModel.qml: - \snippet doc/snippets/qml/gridview/ContactModel.qml 0 + \snippet qml/gridview/ContactModel.qml 0 \div {class="float-right"} \inlineimage gridview-simple.png @@ -1181,9 +1181,9 @@ void QQuickGridViewPrivate::flick(AxisData &data, qreal minExtent, qreal maxExte (containing \l Image and \l Text elements) for its delegate. \clearfloat - \snippet doc/snippets/qml/gridview/gridview.qml import + \snippet qml/gridview/gridview.qml import \codeline - \snippet doc/snippets/qml/gridview/gridview.qml classdocs simple + \snippet qml/gridview/gridview.qml classdocs simple \div {class="float-right"} \inlineimage gridview-highlight.png @@ -1196,7 +1196,7 @@ void QQuickGridViewPrivate::flick(AxisData &data, qreal minExtent, qreal maxExte into a separate \c contactDelegate component. \clearfloat - \snippet doc/snippets/qml/gridview/gridview.qml classdocs advanced + \snippet qml/gridview/gridview.qml classdocs advanced The currently selected item is highlighted with a blue \l Rectangle using the \l highlight property, and \c focus is set to \c true to enable keyboard navigation for the grid view. @@ -1210,7 +1210,7 @@ void QQuickGridViewPrivate::flick(AxisData &data, qreal minExtent, qreal maxExte this attached property directly as \c GridView.isCurrentItem, while the child \c contactInfo object must refer to this property as \c wrapper.GridView.isCurrentItem. - \snippet doc/snippets/qml/gridview/gridview.qml isCurrentItem + \snippet qml/gridview/gridview.qml isCurrentItem \note Views do not set the \l{Item::}{clip} property automatically. If the view is not clipped by another item or the screen, it will be necessary @@ -1308,7 +1308,7 @@ void QQuickGridView::setHighlightFollowsCurrentItem(bool autoHighlight) It is attached to each instance of the delegate. - \snippet doc/snippets/qml/gridview/gridview.qml isCurrentItem + \snippet qml/gridview/gridview.qml isCurrentItem */ /*! @@ -1320,7 +1320,7 @@ void QQuickGridView::setHighlightFollowsCurrentItem(bool autoHighlight) until an animation completes. The example delegate below ensures that the animation completes before the item is removed from the list. - \snippet doc/snippets/qml/gridview/gridview.qml delayRemove + \snippet qml/gridview/gridview.qml delayRemove If a \l remove transition has been specified, it will not be applied until delayRemove is returned to \c false. @@ -1428,7 +1428,7 @@ void QQuickGridView::setHighlightFollowsCurrentItem(bool autoHighlight) Here is a highlight with its motion defined by a \l {SpringAnimation} item: - \snippet doc/snippets/qml/gridview/gridview.qml highlightFollowsCurrentItem + \snippet qml/gridview/gridview.qml highlightFollowsCurrentItem */ diff --git a/src/quick/items/qquickimage.cpp b/src/quick/items/qquickimage.cpp index 8331d14d0a..d4a3cd5b0d 100644 --- a/src/quick/items/qquickimage.cpp +++ b/src/quick/items/qquickimage.cpp @@ -120,7 +120,7 @@ QQuickImagePrivate::QQuickImagePrivate() The following example shows the simplest usage of the Image element. - \snippet doc/snippets/qml/image.qml document + \snippet qml/image.qml document \beginfloatleft \image declarative-qtlogo.png diff --git a/src/quick/items/qquickitem.cpp b/src/quick/items/qquickitem.cpp index 0dd04e8d70..747f1a1da9 100644 --- a/src/quick/items/qquickitem.cpp +++ b/src/quick/items/qquickitem.cpp @@ -254,7 +254,7 @@ void QQuickItemPrivate::registerAccessorProperties() rotations you must specify the axis to rotate around in addition to the origin point. The following example shows various 3D-like rotations applied to an \l Image. - \snippet doc/snippets/qml/rotation.qml 0 + \snippet qml/rotation.qml 0 \image axisrotation.png @@ -512,7 +512,7 @@ void QQuickItemKeyFilter::componentComplete() The following example provides key navigation for a 2x2 grid of items: - \snippet doc/snippets/qml/keynavigation.qml 0 + \snippet qml/keynavigation.qml 0 The top-left item initially receives focus by setting \l {Item::}{focus} to \c true. When an arrow key is pressed, the focus will move to the @@ -937,13 +937,13 @@ bool QQuickKeysAttached::isConnected(const char *signalName) be used to test for a certain key; in this case, the left cursor key: - \snippet doc/snippets/qml/keys/keys-pressed.qml key item + \snippet qml/keys/keys-pressed.qml key item Some keys may alternatively be handled via specific signal properties, for example \e onSelectPressed. These handlers automatically set \e event.accepted to true. - \snippet doc/snippets/qml/keys/keys-handler.qml key item + \snippet qml/keys/keys-handler.qml key item See \l{Qt::Key}{Qt.Key} for the list of keyboard codes. @@ -1485,7 +1485,7 @@ QQuickKeysAttached *QQuickKeysAttached::qmlAttachedProperties(QObject *obj) from left to right by default, they are now positioned from right to left instead, as demonstrated by the numbering and opacity of the items: - \snippet doc/snippets/qml/layoutmirroring.qml 0 + \snippet qml/layoutmirroring.qml 0 \image layoutmirroring.png diff --git a/src/quick/items/qquickitemanimation.cpp b/src/quick/items/qquickitemanimation.cpp index a0437b271e..03ada67c06 100644 --- a/src/quick/items/qquickitemanimation.cpp +++ b/src/quick/items/qquickitemanimation.cpp @@ -70,7 +70,7 @@ QT_BEGIN_NAMESPACE the transition, ensures the item animates smoothly as it moves to its new parent: - \snippet doc/snippets/qml/parentanimation.qml 0 + \snippet qml/parentanimation.qml 0 A ParentAnimation can contain any number of animations. These animations will be run in parallel; to run them sequentially, define them within a @@ -425,7 +425,7 @@ QAbstractAnimationJob* QQuickParentAnimation::transition(QQuickStateActions &act In the following snippet we animate the addition of a right anchor to a \l Rectangle: - \snippet doc/snippets/qml/anchoranimation.qml 0 + \snippet qml/anchoranimation.qml 0 For convenience, when an AnchorAnimation is used in a \l Transition, it will animate any AnchorChanges that have occurred during the state change. diff --git a/src/quick/items/qquickitemviewtransition.cpp b/src/quick/items/qquickitemviewtransition.cpp index aec4de43b6..d51d79230a 100644 --- a/src/quick/items/qquickitemviewtransition.cpp +++ b/src/quick/items/qquickitemviewtransition.cpp @@ -642,7 +642,7 @@ QQuickViewTransitionAttached::QQuickViewTransitionAttached(QObject *parent) Here is a basic example of the use of view transitions. The view below specifies transitions for the \c add and \c displaced properties, which will be run when items are added to the view: - \snippet doc/snippets/qml/viewtransitions/viewtransitions-basic.qml 0 + \snippet qml/viewtransitions/viewtransitions-basic.qml 0 When the space key is pressed, adding an item to the model, the new item will fade in and increase in scale over 400 milliseconds as it is added to the view. Also, any item that is @@ -728,7 +728,7 @@ QQuickViewTransitionAttached::QQuickViewTransitionAttached(QObject *parent) each displaced item based on the difference between its index (provided by ViewTransition.index) and the first removed index (provided by ViewTransition.targetIndexes): - \snippet doc/snippets/qml/viewtransitions/viewtransitions-delayedbyindex.qml 0 + \snippet qml/viewtransitions/viewtransitions-delayedbyindex.qml 0 Each displaced item delays its animation by an additional 100 milliseconds, producing a subtle ripple-type effect when items are displaced by the add, like this: @@ -748,7 +748,7 @@ QQuickViewTransitionAttached::QQuickViewTransitionAttached(QObject *parent) animate to an intermediate position relative to its starting point for the transition, before animating to its final position in the view: - \snippet doc/snippets/qml/viewtransitions/viewtransitions-intermediatemove.qml 0 + \snippet qml/viewtransitions/viewtransitions-intermediatemove.qml 0 Now, a displaced item will first move to a position of (20, 50) relative to its starting position, and then to its final, correct position in the view: @@ -764,7 +764,7 @@ QQuickViewTransitionAttached::QQuickViewTransitionAttached(QObject *parent) a curved path. For example, the \c add transition in the previous example could be augmented with a PathAnimation as follows: to animate newly added items along a path: - \snippet doc/snippets/qml/viewtransitions/viewtransitions-pathanim.qml 0 + \snippet qml/viewtransitions/viewtransitions-pathanim.qml 0 This animates newly added items along a path. Notice that each path is specified relative to each item's final destination point, so that items inserted at different indexes start their @@ -787,7 +787,7 @@ QQuickViewTransitionAttached::QQuickViewTransitionAttached(QObject *parent) properties, this interruption may cause unwanted side effects. Consider the first example on this page, repeated below for convenience: - \snippet doc/snippets/qml/viewtransitions/viewtransitions-basic.qml 0 + \snippet qml/viewtransitions/viewtransitions-basic.qml 0 If multiple items are added in rapid succession, without waiting for a previous transition to finish, this is the result: @@ -804,7 +804,7 @@ QQuickViewTransitionAttached::QQuickViewTransitionAttached(QObject *parent) set to the end values specified in the \c add transition, effectively resetting these values whenever an item is displaced. In this case, it means setting the item opacity and scale to 1.0: - \snippet doc/snippets/qml/viewtransitions/viewtransitions-interruptedgood.qml 0 + \snippet qml/viewtransitions/viewtransitions-interruptedgood.qml 0 Now, when an item's \c add transition is interrupted, its opacity and scale are animated to 1.0 upon displacement, avoiding the erroneous visual effects from before: @@ -829,7 +829,7 @@ QQuickViewTransitionAttached::QQuickViewTransitionAttached(QObject *parent) attached property, as it may not refer to the expected values at the time that the ScriptAction is actually invoked. Consider the following example: - \snippet doc/snippets/qml/viewtransitions/viewtransitions-scriptactionbad.qml 0 + \snippet qml/viewtransitions/viewtransitions-scriptactionbad.qml 0 When the space key is pressed, three items are moved from index 5 to index 1. For each moved item, the \c moveTransition sequence presumably animates the item's color to "yellow", then @@ -847,7 +847,7 @@ QQuickViewTransitionAttached::QQuickViewTransitionAttached(QObject *parent) In this instance, to avoid this issue, the view could set the property using a PropertyAction instead: - \snippet doc/snippets/qml/viewtransitions/viewtransitions-scriptactiongood.qml 0 + \snippet qml/viewtransitions/viewtransitions-scriptactiongood.qml 0 When the transition is initialized, the PropertyAction \c target will be set to the respective ViewTransition.item for the transition and will later run with the correct item target as diff --git a/src/quick/items/qquicklistview.cpp b/src/quick/items/qquicklistview.cpp index 864c639f35..8ee3625775 100644 --- a/src/quick/items/qquicklistview.cpp +++ b/src/quick/items/qquicklistview.cpp @@ -1659,13 +1659,13 @@ void QQuickListViewPrivate::flick(AxisData &data, qreal minExtent, qreal maxExte The following example shows the definition of a simple list model defined in a file called \c ContactModel.qml: - \snippet doc/snippets/qml/listview/ContactModel.qml 0 + \snippet qml/listview/ContactModel.qml 0 Another component can display this model data in a ListView, like this: - \snippet doc/snippets/qml/listview/listview.qml import + \snippet qml/listview/listview.qml import \codeline - \snippet doc/snippets/qml/listview/listview.qml classdocs simple + \snippet qml/listview/listview.qml classdocs simple \image listview-simple.png @@ -1676,7 +1676,7 @@ void QQuickListViewPrivate::flick(AxisData &data, qreal minExtent, qreal maxExte An improved list view is shown below. The delegate is visually improved and is moved into a separate \c contactDelegate component. - \snippet doc/snippets/qml/listview/listview.qml classdocs advanced + \snippet qml/listview/listview.qml classdocs advanced \image listview-highlight.png The currently selected item is highlighted with a blue \l Rectangle using the \l highlight property, @@ -1691,7 +1691,7 @@ void QQuickListViewPrivate::flick(AxisData &data, qreal minExtent, qreal maxExte this attached property directly as \c ListView.isCurrentItem, while the child \c contactInfo object must refer to this property as \c wrapper.ListView.isCurrentItem. - \snippet doc/snippets/qml/listview/listview.qml isCurrentItem + \snippet qml/listview/listview.qml isCurrentItem \note Views do not enable \e clip automatically. If the view is not clipped by another item or the screen, it will be necessary @@ -1756,7 +1756,7 @@ QQuickListView::~QQuickListView() This property may be used to adjust the appearance of the current item, for example: - \snippet doc/snippets/qml/listview/listview.qml isCurrentItem + \snippet qml/listview/listview.qml isCurrentItem */ /*! @@ -1803,7 +1803,7 @@ QQuickListView::~QQuickListView() until an animation completes. The example delegate below ensures that the animation completes before the item is removed from the list. - \snippet doc/snippets/qml/listview/listview.qml delayRemove + \snippet qml/listview/listview.qml delayRemove If a \l remove transition has been specified, it will not be applied until delayRemove is returned to \c false. @@ -1913,7 +1913,7 @@ QQuickListView::~QQuickListView() Here is a highlight with its motion defined by a \l {SpringAnimation} item: - \snippet doc/snippets/qml/listview/listview.qml highlightFollowsCurrentItem + \snippet qml/listview/listview.qml highlightFollowsCurrentItem Note that the highlight animation also affects the way that the view is scrolled. This is because the view moves to maintain the @@ -2172,7 +2172,7 @@ void QQuickListView::setOrientation(QQuickListView::Orientation orientation) each section. - \snippet examples/declarative/modelviews/listview/sections.qml 0 + \snippet examples/quick/modelviews/listview/sections.qml 0 \image qml-listview-sections-example.png diff --git a/src/quick/items/qquickloader.cpp b/src/quick/items/qquickloader.cpp index 2cde9effdc..843d0c18fd 100644 --- a/src/quick/items/qquickloader.cpp +++ b/src/quick/items/qquickloader.cpp @@ -173,7 +173,7 @@ qreal QQuickLoaderPrivate::getImplicitHeight() const Here is a Loader that loads "Page1.qml" as a component when the \l MouseArea is clicked: - \snippet doc/snippets/qml/loader/simple.qml 0 + \snippet qml/loader/simple.qml 0 The loaded item can be accessed using the \l item property. @@ -205,8 +205,8 @@ qreal QQuickLoaderPrivate::getImplicitHeight() const \li sizeloader.qml \li sizeitem.qml \row - \li \snippet doc/snippets/qml/loader/sizeloader.qml 0 - \li \snippet doc/snippets/qml/loader/sizeitem.qml 0 + \li \snippet qml/loader/sizeloader.qml 0 + \li \snippet qml/loader/sizeitem.qml 0 \row \li The red rectangle will be sized to the size of the root item. \li The red rectangle will be 50x50, centered in the root item. @@ -225,8 +225,8 @@ qreal QQuickLoaderPrivate::getImplicitHeight() const \li application.qml \li MyItem.qml \row - \li \snippet doc/snippets/qml/loader/connections.qml 0 - \li \snippet doc/snippets/qml/loader/MyItem.qml 0 + \li \snippet qml/loader/connections.qml 0 + \li \snippet qml/loader/MyItem.qml 0 \endtable Alternatively, since \c MyItem.qml is loaded within the scope of the @@ -252,8 +252,8 @@ qreal QQuickLoaderPrivate::getImplicitHeight() const \li application.qml \li KeyReader.qml \row - \li \snippet doc/snippets/qml/loader/focus.qml 0 - \li \snippet doc/snippets/qml/loader/KeyReader.qml 0 + \li \snippet qml/loader/focus.qml 0 + \li \snippet qml/loader/KeyReader.qml 0 \endtable Once \c KeyReader.qml is loaded, it accepts key events and sets diff --git a/src/quick/items/qquickmousearea.cpp b/src/quick/items/qquickmousearea.cpp index 0ef19633df..30930c3cd8 100644 --- a/src/quick/items/qquickmousearea.cpp +++ b/src/quick/items/qquickmousearea.cpp @@ -354,9 +354,9 @@ bool QQuickMouseAreaPrivate::propagateHelper(QQuickMouseEvent *ev, QQuickItem *i The following example uses a MouseArea in a \l Rectangle that changes the \l Rectangle color to red when clicked: - \snippet doc/snippets/qml/mousearea/mousearea.qml import + \snippet qml/mousearea/mousearea.qml import \codeline - \snippet doc/snippets/qml/mousearea/mousearea.qml intro + \snippet qml/mousearea/mousearea.qml intro \clearfloat Many MouseArea signals pass a \l{MouseEvent}{mouse} parameter that contains @@ -366,7 +366,7 @@ bool QQuickMouseAreaPrivate::propagateHelper(QQuickMouseEvent *ev, QQuickItem *i Here is an extension of the previous example that produces a different color when the area is right clicked: - \snippet doc/snippets/qml/mousearea/mousearea.qml intro-extended + \snippet qml/mousearea/mousearea.qml intro-extended Behavioral Change in QtQuick 2.0 @@ -676,7 +676,7 @@ void QQuickMouseArea::setPropagateComposedEvents(bool prevent) The code below displays "right" when the right mouse buttons is pressed: - \snippet doc/snippets/qml/mousearea/mousearea.qml mousebuttons + \snippet qml/mousearea/mousearea.qml mousebuttons \sa acceptedButtons */ @@ -1181,7 +1181,7 @@ bool QQuickMouseArea::setPressed(bool p) The following example displays a \l Rectangle that can be dragged along the X-axis. The opacity of the rectangle is reduced when it is dragged to the right. - \snippet doc/snippets/qml/mousearea/mousearea.qml drag + \snippet qml/mousearea/mousearea.qml drag \note Items cannot be dragged if they are anchored for the requested \c drag.axis. For example, if \c anchors.left or \c anchors.right was set @@ -1192,7 +1192,7 @@ bool QQuickMouseArea::setPressed(bool p) If \c drag.filterChildren is set to true, a drag can override descendant MouseAreas. This enables a parent MouseArea to handle drags, for example, while descendants handle clicks: - \snippet doc/snippets/qml/mousearea/mouseareadragfilter.qml dragfilter + \snippet qml/mousearea/mouseareadragfilter.qml dragfilter */ diff --git a/src/quick/items/qquickmultipointtoucharea.cpp b/src/quick/items/qquickmultipointtoucharea.cpp index 6f10ea77f1..fa6bb31767 100644 --- a/src/quick/items/qquickmultipointtoucharea.cpp +++ b/src/quick/items/qquickmultipointtoucharea.cpp @@ -309,7 +309,7 @@ void QQuickTouchPoint::setSceneY(qreal sceneY) In the following example, we have two small rectangles that follow our touch points. - \snippet doc/snippets/qml/multipointtoucharea/multipointtoucharea.qml 0 + \snippet qml/multipointtoucharea/multipointtoucharea.qml 0 By default this property holds an empty list. diff --git a/src/quick/items/qquickpathview.cpp b/src/quick/items/qquickpathview.cpp index bf4f9960ce..393f83b34a 100644 --- a/src/quick/items/qquickpathview.cpp +++ b/src/quick/items/qquickpathview.cpp @@ -453,11 +453,11 @@ void QQuickPathViewPrivate::regenerate() For example, if there is a simple list model defined in a file \c ContactModel.qml like this: - \snippet doc/snippets/qml/pathview/ContactModel.qml 0 + \snippet qml/pathview/ContactModel.qml 0 This data can be represented as a PathView, like this: - \snippet doc/snippets/qml/pathview/pathview.qml 0 + \snippet qml/pathview/pathview.qml 0 \image pathview.gif @@ -490,7 +490,7 @@ void QQuickPathViewPrivate::regenerate() this attached property directly as \c PathView.isCurrentItem, while the child \c nameText object must refer to this property as \c wrapper.PathView.isCurrentItem. - \snippet doc/snippets/qml/pathview/pathview.qml 1 + \snippet qml/pathview/pathview.qml 1 \b Note that views do not enable \e clip automatically. If the view is not clipped by another item or the screen, it will be necessary @@ -552,7 +552,7 @@ QQuickPathView::~QQuickPathView() This property may be used to adjust the appearance of the current item. - \snippet doc/snippets/qml/pathview/pathview.qml 1 + \snippet qml/pathview/pathview.qml 1 */ /*! @@ -1122,7 +1122,7 @@ bool QQuickPathView::isFlicking() const item in the delegate. Here is an example delegate: - \snippet doc/snippets/qml/pathview/pathview.qml 1 + \snippet qml/pathview/pathview.qml 1 */ QQmlComponent *QQuickPathView::delegate() const { diff --git a/src/quick/items/qquickpositioners.cpp b/src/quick/items/qquickpositioners.cpp index 52450b181d..b5816136cd 100644 --- a/src/quick/items/qquickpositioners.cpp +++ b/src/quick/items/qquickpositioners.cpp @@ -587,7 +587,7 @@ void QQuickPositionerAttached::setIsLastItem(bool isLastItem) Below is a Column that contains three rectangles of various sizes: - \snippet doc/snippets/qml/column/vertical-positioner.qml document + \snippet qml/column/vertical-positioner.qml document The Column automatically positions these items in a vertical formation, like this: @@ -616,7 +616,7 @@ void QQuickPositionerAttached::setIsLastItem(bool isLastItem) For example, the Column below sets the \l move property to a specific \l Transition: - \snippet doc/snippets/qml/column/column-transitions.qml document + \snippet qml/column/column-transitions.qml document When the Space key is pressed, the \l {Item::visible}{visible} value of the green \l Rectangle is toggled. As it appears and disappears, the blue \l Rectangle moves within @@ -755,7 +755,7 @@ void QQuickColumn::reportConflictingAnchors() Below is a Row that contains three rectangles of various sizes: - \snippet doc/snippets/qml/row/row.qml document + \snippet qml/row/row.qml document The Row automatically positions these items in a horizontal formation, like this: @@ -993,7 +993,7 @@ void QQuickRow::reportConflictingAnchors() For example, below is a Grid that contains five rectangles of various sizes: - \snippet doc/snippets/qml/grid/grid.qml document + \snippet qml/grid/grid.qml document The Grid automatically positions the child items in a grid formation: @@ -1426,7 +1426,7 @@ void QQuickGrid::reportConflictingAnchors() Below is a Flow that contains various \l Text items: - \snippet doc/snippets/qml/flow.qml flow item + \snippet qml/flow.qml flow item The Flow item automatically positions the child \l Text items side by side, wrapping as necessary: diff --git a/src/quick/items/qquickrectangle.cpp b/src/quick/items/qquickrectangle.cpp index b5a03e88af..f4fe4714ea 100644 --- a/src/quick/items/qquickrectangle.cpp +++ b/src/quick/items/qquickrectangle.cpp @@ -207,7 +207,7 @@ void QQuickGradientStop::updateGradient() with red, blending to yellow at one third of the height of the rectangle, and ending with green: - \snippet doc/snippets/qml/gradient.qml code + \snippet qml/gradient.qml code \clearfloat \section1 Performance and Limitations @@ -309,7 +309,7 @@ int QQuickRectanglePrivate::doUpdateSlotIdx = -1; The following example shows the effects of some of the common properties on a Rectangle item, which in this case is used to create a square: - \snippet doc/snippets/qml/rectangle/rectangle.qml document + \snippet qml/rectangle/rectangle.qml document \clearfloat \section1 Performance @@ -370,7 +370,7 @@ void QQuickRectangle::doUpdate() \inlineimage rect-border-width.png \enddiv - \snippet doc/snippets/qml/rectangle/rect-border-width.qml 0 + \snippet qml/rectangle/rect-border-width.qml 0 \clearfloat Here, the innermost rectangle's border is clipped on the bottom and right edges by its @@ -394,7 +394,7 @@ QQuickPen *QQuickRectangle::border() \inlineimage declarative-rect_gradient.png \enddiv - \snippet doc/snippets/qml/rectangle/rectangle-gradient.qml rectangles + \snippet qml/rectangle/rectangle-gradient.qml rectangles \clearfloat If both a gradient and a color are specified, the gradient will be used. @@ -463,7 +463,7 @@ void QQuickRectangle::setRadius(qreal radius) The following example shows rectangles with colors specified using hexadecimal and named color notation: - \snippet doc/snippets/qml/rectangle/rectangle-colors.qml rectangles + \snippet qml/rectangle/rectangle-colors.qml rectangles \clearfloat If both a gradient and a color are specified, the gradient will be used. diff --git a/src/quick/items/qquickrepeater.cpp b/src/quick/items/qquickrepeater.cpp index db58fba00c..fdba3aa21d 100644 --- a/src/quick/items/qquickrepeater.cpp +++ b/src/quick/items/qquickrepeater.cpp @@ -78,9 +78,9 @@ QQuickRepeaterPrivate::~QQuickRepeaterPrivate() The following Repeater creates three instances of a \l Rectangle item within a \l Row: - \snippet doc/snippets/qml/repeaters/repeater.qml import + \snippet qml/repeaters/repeater.qml import \codeline - \snippet doc/snippets/qml/repeaters/repeater.qml simple + \snippet qml/repeaters/repeater.qml simple \image repeater-simple.png @@ -95,7 +95,7 @@ QQuickRepeaterPrivate::~QQuickRepeaterPrivate() a Repeater to be used inside a layout. For example, the following Repeater's items are stacked between a red rectangle and a blue rectangle: - \snippet doc/snippets/qml/repeaters/repeater.qml layout + \snippet qml/repeaters/repeater.qml layout \image repeater.png @@ -242,7 +242,7 @@ void QQuickRepeater::setModel(const QVariant &model) \table \row - \li \snippet doc/snippets/qml/repeaters/repeater.qml index + \li \snippet qml/repeaters/repeater.qml index \li \image repeater-index.png \endtable @@ -253,7 +253,7 @@ void QQuickRepeater::setModel(const QVariant &model) \table \row - \li \snippet doc/snippets/qml/repeaters/repeater.qml modeldata + \li \snippet qml/repeaters/repeater.qml modeldata \li \image repeater-modeldata.png \endtable diff --git a/src/quick/items/qquickstateoperations.cpp b/src/quick/items/qquickstateoperations.cpp index b6b055c359..6857e3f9b6 100644 --- a/src/quick/items/qquickstateoperations.cpp +++ b/src/quick/items/qquickstateoperations.cpp @@ -165,7 +165,7 @@ void QQuickParentChangePrivate::doChange(QQuickItem *targetParent, QQuickItem *s When the \c blueRect is clicked, it changes to the "reparented" state: its parent is changed to \c redRect and it is positioned at (10, 10) within the red rectangle, as specified in the ParentChange. - \snippet doc/snippets/qml/parentchange.qml 0 + \snippet qml/parentchange.qml 0 \image parentchange.png @@ -572,7 +572,7 @@ void QQuickParentChange::rewind() using AnchorChanges, and the top and bottom anchor margins using PropertyChanges: - \snippet doc/snippets/qml/anchorchanges.qml 0 + \snippet qml/anchorchanges.qml 0 \image anchorchanges.png diff --git a/src/quick/items/qquicktext.cpp b/src/quick/items/qquicktext.cpp index 642409e84a..add789dff7 100644 --- a/src/quick/items/qquicktext.cpp +++ b/src/quick/items/qquicktext.cpp @@ -1247,7 +1247,7 @@ QQuickText::~QQuickText() The link must be in rich text or HTML format and the \a link string provides access to the particular link. - \snippet doc/snippets/qml/text/onLinkActivated.qml 0 + \snippet qml/text/onLinkActivated.qml 0 The example code will display the text "The main website is at \l{http://qt.nokia.com}{Nokia Qt DF}." diff --git a/src/quick/items/qquicktextedit.cpp b/src/quick/items/qquicktextedit.cpp index de5cff217d..5134376807 100644 --- a/src/quick/items/qquicktextedit.cpp +++ b/src/quick/items/qquicktextedit.cpp @@ -93,7 +93,7 @@ TextEdit { Note that the TextEdit does not implement scrolling, following the cursor, or other behaviors specific to a look-and-feel. For example, to add flickable scrolling that follows the cursor: - \snippet snippets/declarative/texteditor.qml 0 + \snippet qml/texteditor.qml 0 A particular look-and-feel might use smooth scrolling (eg. using SmoothedFollow), might have a visible scrollbar, or a scrollbar that fades in to show location, etc. @@ -105,7 +105,7 @@ TextEdit { You can translate between cursor positions (characters from the start of the document) and pixel points using positionAt() and positionToRectangle(). - \sa Text, TextInput, {declarative/text/textselection}{Text Selection example} + \sa Text, TextInput, {examples/quick/text/textselection}{Text Selection example} */ /*! diff --git a/src/quick/items/qquickvisualdatamodel.cpp b/src/quick/items/qquickvisualdatamodel.cpp index 0abcf81cb7..c0277cbb93 100644 --- a/src/quick/items/qquickvisualdatamodel.cpp +++ b/src/quick/items/qquickvisualdatamodel.cpp @@ -136,7 +136,7 @@ QQuickVisualDataModelParts::QQuickVisualDataModelParts(QQuickVisualDataModel *pa The example below illustrates using a VisualDataModel with a ListView. - \snippet doc/snippets/qml/visualdatamodel.qml 0 + \snippet qml/visualdatamodel.qml 0 */ QQuickVisualDataModelPrivate::QQuickVisualDataModelPrivate(QQmlContext *ctxt) @@ -374,10 +374,10 @@ void QQuickVisualDataModel::setDelegate(QQmlComponent *delegate) the new directory's contents. \c main.cpp: - \snippet doc/snippets/qml/visualdatamodel_rootindex/main.cpp 0 + \snippet qml/visualdatamodel_rootindex/main.cpp 0 \c view.qml: - \snippet doc/snippets/qml/visualdatamodel_rootindex/view.qml 0 + \snippet qml/visualdatamodel_rootindex/view.qml 0 If the \l model is a QAbstractItemModel subclass, the delegate can also reference a \c hasModelChildren property (optionally qualified by a @@ -578,7 +578,7 @@ QQuickVisualDataGroup *QQuickVisualDataModelPrivate::group_at( The following example illustrates using groups to select items in a model. - \snippet doc/snippets/qml/visualdatagroup.qml 0 + \snippet qml/visualdatagroup.qml 0 */ QQmlListProperty<QQuickVisualDataGroup> QQuickVisualDataModel::groups() diff --git a/src/quick/util/qquickanimation.cpp b/src/quick/util/qquickanimation.cpp index f6e2e57cc8..33c24f38d7 100644 --- a/src/quick/util/qquickanimation.cpp +++ b/src/quick/util/qquickanimation.cpp @@ -698,7 +698,7 @@ QAbstractAnimationJob* QQuickPauseAnimation::transition(QQuickStateActions &acti as a property value source. It animates the \c color property's value from its current value to a value of "red", over 1000 milliseconds: - \snippet doc/snippets/qml/coloranimation.qml 0 + \snippet qml/coloranimation.qml 0 Like any other animation element, a ColorAnimation can be applied in a number of ways, including transitions, behaviors and property value @@ -852,7 +852,7 @@ void QActionAnimation::updateState(State newState, State oldState) When used as part of a Transition, you can also target a specific StateChangeScript to run using the \c scriptName property. - \snippet doc/snippets/qml/states/statechangescript.qml state and transition + \snippet qml/states/statechangescript.qml state and transition \sa StateChangeScript */ @@ -970,14 +970,14 @@ QAbstractAnimationJob* QQuickScriptAction::transition(QQuickStateActions &action \l {Image::}{smooth} property to \c true, animates the width of the image, then sets \l {Image::}{smooth} back to \c false: - \snippet doc/snippets/qml/propertyaction.qml standalone + \snippet qml/propertyaction.qml standalone PropertyAction is also useful for setting the exact point at which a property change should occur during a \l Transition. For example, if PropertyChanges was used in a \l State to rotate an item around a particular \l {Item::}{transformOrigin}, it might be implemented like this: - \snippet doc/snippets/qml/propertyaction.qml transition + \snippet qml/propertyaction.qml transition However, with this code, the \c transformOrigin is not set until \e after the animation, as a \l State is taken to define the values at the \e end of @@ -985,7 +985,7 @@ QAbstractAnimationJob* QQuickScriptAction::transition(QQuickStateActions &action then jump to \c Item.BottomRight. To fix this, insert a PropertyAction before the RotationAnimation begins: - \snippet doc/snippets/qml/propertyaction-sequential.qml sequential + \snippet qml/propertyaction-sequential.qml sequential This immediately sets the \c transformOrigin property to the value defined in the end state of the \l Transition (i.e. the value defined in the @@ -1220,7 +1220,7 @@ QAbstractAnimationJob* QQuickPropertyAction::transition(QQuickStateActions &acti as a property value source. It animates the \c x value from its current value to a value of 50, over 1000 milliseconds: - \snippet doc/snippets/qml/numberanimation.qml 0 + \snippet qml/numberanimation.qml 0 Like any other animation element, a NumberAnimation can be applied in a number of ways, including transitions, behaviors and property value @@ -1413,7 +1413,7 @@ void QQuickVector3dAnimation::setTo(QVector3D t) In the following example we use RotationAnimation to animate the rotation between states via the shortest path: - \snippet doc/snippets/qml/rotationanimation.qml 0 + \snippet qml/rotationanimation.qml 0 Notice the RotationAnimation did not need to set a \l target value. As a convenience, when used in a transition, RotationAnimation will rotate all @@ -1649,7 +1649,7 @@ QQmlListProperty<QQuickAbstractAnimation> QQuickAnimationGroup::animations() The following example runs two number animations in a sequence. The \l Rectangle animates to a \c x position of 50, then to a \c y position of 50. - \snippet doc/snippets/qml/sequentialanimation.qml 0 + \snippet qml/sequentialanimation.qml 0 Animations defined within a \l Transition are automatically run in parallel, so SequentialAnimation can be used to enclose the animations in a \l Transition @@ -1722,7 +1722,7 @@ QAbstractAnimationJob* QQuickSequentialAnimation::transition(QQuickStateActions The following animation runs two number animations in parallel. The \l Rectangle moves to (50,50) by animating its \c x and \c y properties at the same time. - \snippet doc/snippets/qml/parallelanimation.qml 0 + \snippet qml/parallelanimation.qml 0 Like any other animation element, a ParallelAnimation can be applied in a number of ways, including transitions, behaviors and property value @@ -1850,21 +1850,21 @@ void QQuickBulkValueAnimator::topLevelAnimationLoopChanged() For example, to animate any objects that have changed their \c x or \c y properties as a result of a state change, using an \c InOutQuad easing curve: - \snippet doc/snippets/qml/propertyanimation.qml transition + \snippet qml/propertyanimation.qml transition \li In a \l Behavior For example, to animate all changes to a rectangle's \c x property: - \snippet doc/snippets/qml/propertyanimation.qml behavior + \snippet qml/propertyanimation.qml behavior \li As a property value source For example, to repeatedly animate the rectangle's \c x property: - \snippet doc/snippets/qml/propertyanimation.qml propertyvaluesource + \snippet qml/propertyanimation.qml propertyvaluesource \li In a signal handler @@ -1881,7 +1881,7 @@ void QQuickBulkValueAnimator::topLevelAnimationLoopChanged() For example, to animate \c rect's \c width property over 500ms, from its current width to 30: - \snippet doc/snippets/qml/propertyanimation.qml standalone + \snippet qml/propertyanimation.qml standalone \endlist diff --git a/src/quick/util/qquickbehavior.cpp b/src/quick/util/qquickbehavior.cpp index 1623a00a49..4aa3d17c0e 100644 --- a/src/quick/util/qquickbehavior.cpp +++ b/src/quick/util/qquickbehavior.cpp @@ -85,7 +85,7 @@ public: whenever the \l Rectangle's \c width value changes. When the MouseArea is clicked, the \c width is changed, triggering the behavior's animation: - \snippet doc/snippets/qml/behavior.qml 0 + \snippet qml/behavior.qml 0 Note that a property cannot have more than one assigned Behavior. To provide multiple animations within a Behavior, use ParallelAnimation or diff --git a/src/quick/util/qquickbind.cpp b/src/quick/util/qquickbind.cpp index 622965de23..81377bf778 100644 --- a/src/quick/util/qquickbind.cpp +++ b/src/quick/util/qquickbind.cpp @@ -104,10 +104,10 @@ public: other cirumstances). This often isn't possible to accomplish with a direct binding, as you need to supply values for all possible branches. - \qml - // warning: "Unable to assign [undefined] to double value" + \code + // produces warning: "Unable to assign [undefined] to double value" value: if (mouse.pressed) mouse.mouseX - \endqml + \endcode The above example will produce a warning whenever we release the mouse, as the value of the binding is undefined when the mouse isn't pressed. We can use the Binding @@ -124,7 +124,7 @@ public: the property. In that sense, it functions much like a simplified State. \qml - // this is equivilant to the above Binding + // this is equivalent to the above Binding State { name: "pressed" when: mouse.pressed diff --git a/src/quick/util/qquickimageprovider.cpp b/src/quick/util/qquickimageprovider.cpp index 5ded343195..b0bbf46489 100644 --- a/src/quick/util/qquickimageprovider.cpp +++ b/src/quick/util/qquickimageprovider.cpp @@ -154,7 +154,7 @@ QImage QQuickTextureFactory::image() const an image provider named "colors", and the images to be loaded are "yellow" and "red", respectively: - \snippet examples/declarative/cppextensions/imageprovider/imageprovider-example.qml 0 + \snippet examples/qml/cppextensions/imageprovider/imageprovider-example.qml 0 When these images are loaded by QML, it looks for a matching image provider and calls its requestImage() or requestPixmap() method (depending on its @@ -165,9 +165,9 @@ QImage QQuickTextureFactory::image() const requested by the above QML. This implementation dynamically generates QPixmap images that are filled with the requested color: - \snippet examples/declarative/cppextensions/imageprovider/imageprovider.cpp 0 + \snippet examples/qml/cppextensions/imageprovider/imageprovider.cpp 0 \codeline - \snippet examples/declarative/cppextensions/imageprovider/imageprovider.cpp 1 + \snippet examples/qml/cppextensions/imageprovider/imageprovider.cpp 1 To make this provider accessible to QML, it is registered with the QML engine with a "colors" identifier: @@ -189,7 +189,7 @@ QImage QQuickTextureFactory::image() const \image imageprovider.png A complete example is available in Qt's - \l {declarative/cppextensions/imageprovider}{examples/declarative/cppextensions/imageprovider} + \l {declarative/cppextensions/imageprovider}{examples/qml/cppextensions/imageprovider} directory. Note the example registers the provider via a \l{QQmlExtensionPlugin}{plugin} instead of registering it in the application \c main() function as shown above. diff --git a/src/quick/util/qquickpackage.cpp b/src/quick/util/qquickpackage.cpp index 6c95989ba7..ede1c68d02 100644 --- a/src/quick/util/qquickpackage.cpp +++ b/src/quick/util/qquickpackage.cpp @@ -64,13 +64,13 @@ QT_BEGIN_NAMESPACE delegate it should appear in. This allows an item to move between views. - \snippet examples/declarative/modelviews/package/Delegate.qml 0 + \snippet examples/quick/modelviews/package/Delegate.qml 0 These named items are used as the delegates by the two views who reference the special \l{VisualDataModel::parts} property to select a model which provides the chosen delegate. - \snippet examples/declarative/modelviews/package/view.qml 0 + \snippet examples/quick/modelviews/package/view.qml 0 \sa {declarative/modelviews/package}{Package example}, {declarative/photoviewer}{Photo Viewer example}, QtQml */ diff --git a/src/quick/util/qquickpath.cpp b/src/quick/util/qquickpath.cpp index 32dd9cca88..cce412a851 100644 --- a/src/quick/util/qquickpath.cpp +++ b/src/quick/util/qquickpath.cpp @@ -181,7 +181,7 @@ bool QQuickPath::hasEnd() const \li \l PathPercent - a way to spread out items along various segments of the path. \endlist - \snippet doc/snippets/qml/pathview/pathattributes.qml 2 + \snippet qml/pathview/pathattributes.qml 2 */ QQmlListProperty<QQuickPathElement> QQuickPath::pathElements() @@ -825,7 +825,7 @@ bool QQuickCurve::hasRelativeY() \row \li \image declarative-pathattribute.png \li - \snippet doc/snippets/qml/pathview/pathattributes.qml 0 + \snippet qml/pathview/pathattributes.qml 0 (see the PathView documentation for the specification of ContactModel.qml used for ContactModel above.) \endtable @@ -1359,7 +1359,7 @@ void QQuickPathCubic::addToPath(QPainterPath &path, const QQuickPathData &data) PathCurve provides an easy way to specify a curve passing directly through a set of points. Typically multiple PathCurves are used in a series, as the following example demonstrates: - \snippet doc/snippets/qml/path/basiccurve.qml 0 + \snippet qml/path/basiccurve.qml 0 This example produces the following path (with the starting point and PathCurve points highlighted in red): @@ -1508,7 +1508,7 @@ void QQuickPathCatmullRomCurve::addToPath(QPainterPath &path, const QQuickPathDa \table \row \li \image declarative-patharc.png - \li \snippet doc/snippets/qml/path/basicarc.qml 0 + \li \snippet qml/path/basicarc.qml 0 \endtable Note that a single PathArc cannot be used to specify a circle. Instead, you can @@ -1552,7 +1552,7 @@ void QQuickPathCatmullRomCurve::addToPath(QPainterPath &path, const QQuickPathDa \table \row \li \image declarative-arcradius.png - \li \snippet doc/snippets/qml/path/arcradius.qml 0 + \li \snippet qml/path/arcradius.qml 0 \endtable */ @@ -1597,7 +1597,7 @@ void QQuickPathArc::setRadiusY(qreal radius) \table \row \li \image declarative-largearc.png - \li \snippet doc/snippets/qml/path/largearc.qml 0 + \li \snippet qml/path/largearc.qml 0 \endtable The default value is false. @@ -1628,7 +1628,7 @@ void QQuickPathArc::setUseLargeArc(bool largeArc) \table \row \li \image declarative-arcdirection.png - \li \snippet doc/snippets/qml/path/arcdirection.qml 0 + \li \snippet qml/path/arcdirection.qml 0 \endtable \sa useLargeArc diff --git a/src/quick/util/qquickpathinterpolator.cpp b/src/quick/util/qquickpathinterpolator.cpp index 4328305cd0..62bb9c1a10 100644 --- a/src/quick/util/qquickpathinterpolator.cpp +++ b/src/quick/util/qquickpathinterpolator.cpp @@ -55,7 +55,7 @@ QT_BEGIN_NAMESPACE In the following example, we animate a green rectangle along a bezier path. - \snippet doc/snippets/qml/pathinterpolator.qml 0 + \snippet qml/pathinterpolator.qml 0 */ QQuickPathInterpolator::QQuickPathInterpolator(QObject *parent) : diff --git a/src/quick/util/qquickpropertychanges.cpp b/src/quick/util/qquickpropertychanges.cpp index 5252f625ad..969c326b97 100644 --- a/src/quick/util/qquickpropertychanges.cpp +++ b/src/quick/util/qquickpropertychanges.cpp @@ -77,9 +77,9 @@ QT_BEGIN_NAMESPACE properties are to be modified, and define the new property values or bindings. For example: - \snippet doc/snippets/qml/propertychanges.qml import + \snippet qml/propertychanges.qml import \codeline - \snippet doc/snippets/qml/propertychanges.qml 0 + \snippet qml/propertychanges.qml 0 When the mouse is pressed, the \l Rectangle changes to the \e resized state. In this state, the PropertyChanges object sets the rectangle's @@ -113,7 +113,7 @@ QT_BEGIN_NAMESPACE state, its \c width property is reset, giving the text its natural width and displaying the whole string on a single line. - \snippet doc/snippets/qml/propertychanges.qml reset + \snippet qml/propertychanges.qml reset \section2 Immediate property changes in transitions diff --git a/src/quick/util/qquicksmoothedanimation.cpp b/src/quick/util/qquicksmoothedanimation.cpp index 75682152f1..4bc802cded 100644 --- a/src/quick/util/qquicksmoothedanimation.cpp +++ b/src/quick/util/qquicksmoothedanimation.cpp @@ -324,7 +324,7 @@ void QSmoothedAnimation::init() bound to those of the red rectangle. Whenever these values change, the green rectangle smoothly animates to its new position: - \snippet doc/snippets/qml/smoothedanimation.qml 0 + \snippet qml/smoothedanimation.qml 0 A SmoothedAnimation can be configured by setting the \l velocity at which the animation should occur, or the \l duration that the animation should take. diff --git a/src/quick/util/qquickspringanimation.cpp b/src/quick/util/qquickspringanimation.cpp index 1f5b15cf77..1f6e51e2b9 100644 --- a/src/quick/util/qquickspringanimation.cpp +++ b/src/quick/util/qquickspringanimation.cpp @@ -357,7 +357,7 @@ void QQuickSpringAnimationPrivate::updateMode() on the \c x and \c y values indicates that whenever these values are changed, a SpringAnimation should be applied. - \snippet doc/snippets/qml/springanimation.qml 0 + \snippet qml/springanimation.qml 0 Like any other animation element, a SpringAnimation can be applied in a number of ways, including transitions, behaviors and property value diff --git a/src/quick/util/qquickstate.cpp b/src/quick/util/qquickstate.cpp index 7cbd16a51b..da4dde5af3 100644 --- a/src/quick/util/qquickstate.cpp +++ b/src/quick/util/qquickstate.cpp @@ -139,7 +139,7 @@ QQuickStateOperation::QQuickStateOperation(QObjectPrivate &dd, QObject *parent) between the default state and the "clicked" state, thus toggling the color of the rectangle between black and red. - \snippet doc/snippets/qml/state.qml 0 + \snippet qml/state.qml 0 Notice the default state is referred to using an empty string (""). @@ -205,7 +205,7 @@ bool QQuickState::isWhenKnown() const be applied. For example, the following \l Rectangle changes in and out of the "hidden" state when the \l MouseArea is pressed: - \snippet doc/snippets/qml/state-when.qml 0 + \snippet qml/state-when.qml 0 If multiple states in a group have \c when clauses that evaluate to \c true at the same time, the first matching state will be applied. For example, in diff --git a/src/quick/util/qquickstatechangescript.cpp b/src/quick/util/qquickstatechangescript.cpp index 4865859a91..49db12740c 100644 --- a/src/quick/util/qquickstatechangescript.cpp +++ b/src/quick/util/qquickstatechangescript.cpp @@ -77,7 +77,7 @@ public: ScriptAction to specify the point in the transition at which the StateChangeScript should to be run. - \snippet snippets/qml/states/statechangescript.qml state and transition + \snippet qml/states/statechangescript.qml state and transition \sa ScriptAction */ diff --git a/src/quick/util/qquicksystempalette.cpp b/src/quick/util/qquicksystempalette.cpp index cf5098e8ec..cc3a618faf 100644 --- a/src/quick/util/qquicksystempalette.cpp +++ b/src/quick/util/qquicksystempalette.cpp @@ -76,7 +76,7 @@ public: group and uses this to color the window and text items appropriately: - \snippet doc/snippets/qml/systempalette.qml 0 + \snippet qml/systempalette.qml 0 \sa QPalette */ diff --git a/src/quick/util/qquicktransition.cpp b/src/quick/util/qquicktransition.cpp index edad787b6e..3f56145566 100644 --- a/src/quick/util/qquicktransition.cpp +++ b/src/quick/util/qquicktransition.cpp @@ -66,7 +66,7 @@ QT_BEGIN_NAMESPACE changes between the default and the "moved" state, any changes to the \c x and \c y properties should be animated, using an \c Easing.InOutQuad. - \snippet doc/snippets/qml/transition.qml 0 + \snippet qml/transition.qml 0 Notice the example does not require \l{PropertyAnimation::}{to} and \l{PropertyAnimation::}{from} values for the NumberAnimation. As a convenience, @@ -83,7 +83,7 @@ QT_BEGIN_NAMESPACE To define multiple transitions, specify \l Item::transitions as a list: - \snippet doc/snippets/qml/transitions-list.qml list of transitions + \snippet qml/transitions-list.qml list of transitions If multiple Transitions are specified, only a single (best-matching) Transition will be applied for any particular state change. In the example above, when changing to \c state1, the first transition will be used, rather @@ -283,11 +283,11 @@ QQuickTransitionInstance *QQuickTransition::prepare(QQuickStateOperation::Action properties, so the animation is always applied when changing between the two states (i.e. when the mouse is pressed and released). - \snippet doc/snippets/qml/transition-from-to.qml 0 + \snippet qml/transition-from-to.qml 0 If the transition was changed to this: - \snippet doc/snippets/qml/transition-from-to-modified.qml modified transition + \snippet qml/transition-from-to-modified.qml modified transition The animation would only be applied when changing from the default state to the "brighter" state (i.e. when the mouse is pressed, but not on release). @@ -330,7 +330,7 @@ void QQuickTransition::setFromState(const QString &f) transition applies a sequential animation when the mouse is pressed, and reverses the sequence of the animation when the mouse is released: - \snippet doc/snippets/qml/transition-reversible.qml 0 + \snippet qml/transition-reversible.qml 0 If the transition did not set the \c to and \c reversible values, then on the mouse release, the transition would play the PropertyAnimation @@ -378,19 +378,22 @@ void QQuickTransition::setToState(const QString &t) Note that in some circumstances disabling a Transition may cause an alternative Transition to be used in its place. In the following - example, the generic Transition will be used to animate the change - from \c state1 to \c state2, as the more specific Transition has - been disabled. + example, although the first Transition has been set to animate changes + from "state1" to "state2", this transition has been disabled by setting + \c enabled to \c false, so any such state change will actually be animated + by the second Transition instead. \qml Item { states: [ - State { name: "state1" ... } - State { name: "state2" ... } + State { name: "state1" }, + State { name: "state2" } ] transitions: [ - Transition { from: "state1"; to: "state2"; enabled: false ... } - Transition { ... } + Transition { from: "state1"; to: "state2"; enabled: false }, + Transition { + // ... + } ] } \endqml @@ -431,12 +434,12 @@ bool QQuickTransition::running() const This property holds a list of the animations to be run for this transition. - \snippet examples/declarative/toys/dynamicscene/dynamicscene.qml top-level transitions + \snippet examples/qml/dynamicscene/dynamicscene.qml top-level transitions The top-level animations are run in parallel. To run them sequentially, define them within a SequentialAnimation: - \snippet doc/snippets/qml/transition-reversible.qml sequential animations + \snippet qml/transition-reversible.qml sequential animations */ QQmlListProperty<QQuickAbstractAnimation> QQuickTransition::animations() { |