diff options
author | David Boddie <dboddie@trolltech.com> | 2010-08-27 18:23:37 +0200 |
---|---|---|
committer | David Boddie <dboddie@trolltech.com> | 2010-08-27 18:23:37 +0200 |
commit | 1a75b369797c41d37f92950f7527c1eb989f1215 (patch) | |
tree | 0e154f2e4eb3bee637fc4d577377592786f5af21 | |
parent | c408dd8a80d509f18ec3c3bc8a74891f541f6fdd (diff) | |
download | qt4-tools-1a75b369797c41d37f92950f7527c1eb989f1215.tar.gz |
Doc: More work on the QML documentation.
29 files changed, 955 insertions, 209 deletions
diff --git a/doc/src/declarative/anchor-layout.qdoc b/doc/src/declarative/anchor-layout.qdoc index 5c025e5765..99f777764c 100644 --- a/doc/src/declarative/anchor-layout.qdoc +++ b/doc/src/declarative/anchor-layout.qdoc @@ -26,7 +26,7 @@ ****************************************************************************/ /*! -\page anchor-layout.html +\page qml-anchor-layout.html \target anchor-layout \title Anchor-based Layout in QML diff --git a/doc/src/declarative/codingconventions.qdoc b/doc/src/declarative/codingconventions.qdoc index 94039204f8..aa4feefd0b 100644 --- a/doc/src/declarative/codingconventions.qdoc +++ b/doc/src/declarative/codingconventions.qdoc @@ -26,7 +26,7 @@ ****************************************************************************/ /*! -\page codingconventions.html +\page qml-coding-conventions.html \title QML Coding Conventions This document contains the QML coding conventions that we follow in our documentation and examples and recommend that others follow. diff --git a/doc/src/declarative/declarativeui.qdoc b/doc/src/declarative/declarativeui.qdoc index 9609954258..ae64e2aa92 100644 --- a/doc/src/declarative/declarativeui.qdoc +++ b/doc/src/declarative/declarativeui.qdoc @@ -107,7 +107,8 @@ Module. \section1 Handling Data \list -\o \l{Data Models} +\o \l{Using QML Positioner and Repeater Items} +\o \l{QML Data Models} \o \l{Network Transparency} \endlist diff --git a/doc/src/declarative/pics/spacing_a.png b/doc/src/declarative/pics/spacing_a.png Binary files differdeleted file mode 100644 index c0fe8954c2..0000000000 --- a/doc/src/declarative/pics/spacing_a.png +++ /dev/null diff --git a/doc/src/declarative/pics/spacing_b.png b/doc/src/declarative/pics/spacing_b.png Binary files differdeleted file mode 100644 index 24cf640e4f..0000000000 --- a/doc/src/declarative/pics/spacing_b.png +++ /dev/null diff --git a/doc/src/declarative/qdeclarativemodels.qdoc b/doc/src/declarative/qdeclarativemodels.qdoc index 173002a7d2..ace0465c41 100644 --- a/doc/src/declarative/qdeclarativemodels.qdoc +++ b/doc/src/declarative/qdeclarativemodels.qdoc @@ -28,7 +28,7 @@ /*! \page qdeclarativemodels.html \target qmlmodels -\title Data Models +\title QML Data Models QML items such as ListView, GridView and \l Repeater require Data Models that provide the data to be displayed. diff --git a/doc/src/examples/qml-examples.qdoc b/doc/src/examples/qml-examples.qdoc index 0d191c9fbb..03bf7bbb52 100644 --- a/doc/src/examples/qml-examples.qdoc +++ b/doc/src/examples/qml-examples.qdoc @@ -229,7 +229,7 @@ */ /*! - \title Internationlization Example + \title Internationalization Example \example declarative/i18n This example shows how to enable text translation in QML. diff --git a/doc/src/images/qml-flow-snippet.png b/doc/src/images/qml-flow-snippet.png Binary files differnew file mode 100644 index 0000000000..1a2af4b14c --- /dev/null +++ b/doc/src/images/qml-flow-snippet.png diff --git a/doc/src/images/qml-grid-no-spacing.png b/doc/src/images/qml-grid-no-spacing.png Binary files differnew file mode 100644 index 0000000000..c2092e0bf9 --- /dev/null +++ b/doc/src/images/qml-grid-no-spacing.png diff --git a/doc/src/images/qml-grid-spacing.png b/doc/src/images/qml-grid-spacing.png Binary files differnew file mode 100644 index 0000000000..1083bee59f --- /dev/null +++ b/doc/src/images/qml-grid-spacing.png diff --git a/doc/src/images/qml-repeater-grid-index.png b/doc/src/images/qml-repeater-grid-index.png Binary files differnew file mode 100644 index 0000000000..44aed24f55 --- /dev/null +++ b/doc/src/images/qml-repeater-grid-index.png diff --git a/doc/src/images/qml-row.png b/doc/src/images/qml-row.png Binary files differnew file mode 100644 index 0000000000..30d9caad7c --- /dev/null +++ b/doc/src/images/qml-row.png diff --git a/doc/src/snippets/declarative/anchoranimation.qml b/doc/src/snippets/declarative/anchoranimation.qml index 6c7aaf67c5..9a7b8ff84c 100644 --- a/doc/src/snippets/declarative/anchoranimation.qml +++ b/doc/src/snippets/declarative/anchoranimation.qml @@ -37,6 +37,7 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ + //![0] import Qt 4.7 diff --git a/doc/src/snippets/declarative/column/column.qml b/doc/src/snippets/declarative/column/column.qml new file mode 100644 index 0000000000..e372cfd4bc --- /dev/null +++ b/doc/src/snippets/declarative/column/column.qml @@ -0,0 +1,67 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +//! [document] +import Qt 4.7 + +Item { + width: 310; height: 170 + + Column { + anchors.horizontalCenter: parent.horizontalCenter + anchors.verticalCenter: parent.verticalCenter + + spacing: 5 + + Rectangle { color: "lightblue"; radius: 10.0 + width: 300; height: 50 + Text { anchors.fill: parent + font.pointSize: 32; text: "Books" } } + Rectangle { color: "gold"; radius: 10.0 + width: 300; height: 50 + Text { anchors.fill: parent + font.pointSize: 32; text: "Music" } } + Rectangle { color: "lightgreen"; radius: 10.0 + width: 300; height: 50 + Text { anchors.fill: parent + font.pointSize: 32; text: "Movies" } } + } +} +//! [document] diff --git a/doc/src/snippets/declarative/column/vertical-positioner-transition.qml b/doc/src/snippets/declarative/column/vertical-positioner-transition.qml new file mode 100644 index 0000000000..7785776815 --- /dev/null +++ b/doc/src/snippets/declarative/column/vertical-positioner-transition.qml @@ -0,0 +1,61 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import Qt 4.7 + +//! [document] +Column { + spacing: 2 + Rectangle { color: "red"; width: 50; height: 50 } + Rectangle { id: rect1; color: "green"; width: 20; height: 50 } + Rectangle { color: "blue"; width: 50; height: 20 } + + //![transitions] + add: Transition { + NumberAnimation { properties: "opacity"; duration: 1000 } + } + //![transitions] + + MouseArea { + anchors.fill: parent + onClicked: rect1.opacity = 0 + } +} +//! [document] diff --git a/doc/src/snippets/declarative/column/vertical-positioner.qml b/doc/src/snippets/declarative/column/vertical-positioner.qml new file mode 100644 index 0000000000..27b09c1078 --- /dev/null +++ b/doc/src/snippets/declarative/column/vertical-positioner.qml @@ -0,0 +1,50 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import Qt 4.7 + +//! [document] +Column { + spacing: 2 + Rectangle { color: "red"; width: 50; height: 50 } + Rectangle { color: "green"; width: 20; height: 50 } + Rectangle { color: "blue"; width: 50; height: 20 } +} +//! [document] diff --git a/doc/src/snippets/declarative/flow.qml b/doc/src/snippets/declarative/flow.qml new file mode 100644 index 0000000000..c5fbc900d8 --- /dev/null +++ b/doc/src/snippets/declarative/flow.qml @@ -0,0 +1,62 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import Qt 4.7 + +Rectangle { + color: "lightblue" + width: 300; height: 200 + +//! [flow item] + Flow { + anchors.fill: parent + anchors.margins: 4 + spacing: 10 + + Text { text: "Text"; font.pixelSize: 40 } + Text { text: "items"; font.pixelSize: 40 } + Text { text: "flowing"; font.pixelSize: 40 } + Text { text: "in"; font.pixelSize: 40 } + Text { text: "a"; font.pixelSize: 40 } + Text { text: "Flow"; font.pixelSize: 40 } + Text { text: "item"; font.pixelSize: 40 } + } +//! [flow item] +} diff --git a/doc/src/snippets/declarative/grid/grid-items.qml b/doc/src/snippets/declarative/grid/grid-items.qml new file mode 100644 index 0000000000..50997584a0 --- /dev/null +++ b/doc/src/snippets/declarative/grid/grid-items.qml @@ -0,0 +1,58 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import Qt 4.7 + +Rectangle { + width: 112; height: 112 + color: "#303030" + + Grid { + anchors.horizontalCenter: parent.horizontalCenter + anchors.verticalCenter: parent.verticalCenter + columns: 2 + spacing: 6 + + Rectangle { color: "#aa6666"; width: 50; height: 50 } + Rectangle { color: "#aaaa66"; width: 50; height: 50 } + Rectangle { color: "#9999aa"; width: 50; height: 50 } + Rectangle { color: "#6666aa"; width: 50; height: 50 } + } +} diff --git a/doc/src/snippets/declarative/grid/grid-no-spacing.qml b/doc/src/snippets/declarative/grid/grid-no-spacing.qml new file mode 100644 index 0000000000..f04c24234c --- /dev/null +++ b/doc/src/snippets/declarative/grid/grid-no-spacing.qml @@ -0,0 +1,57 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import Qt 4.7 + +Rectangle { + width: 112; height: 112 + color: "#303030" + + Grid { + anchors.horizontalCenter: parent.horizontalCenter + anchors.verticalCenter: parent.verticalCenter + columns: 2 + + Rectangle { color: "#aa6666"; width: 50; height: 50 } + Rectangle { color: "#aaaa66"; width: 50; height: 50 } + Rectangle { color: "#9999aa"; width: 50; height: 50 } + Rectangle { color: "#6666aa"; width: 50; height: 50 } + } +} diff --git a/doc/src/snippets/declarative/grid/grid-spacing.qml b/doc/src/snippets/declarative/grid/grid-spacing.qml new file mode 100644 index 0000000000..50997584a0 --- /dev/null +++ b/doc/src/snippets/declarative/grid/grid-spacing.qml @@ -0,0 +1,58 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import Qt 4.7 + +Rectangle { + width: 112; height: 112 + color: "#303030" + + Grid { + anchors.horizontalCenter: parent.horizontalCenter + anchors.verticalCenter: parent.verticalCenter + columns: 2 + spacing: 6 + + Rectangle { color: "#aa6666"; width: 50; height: 50 } + Rectangle { color: "#aaaa66"; width: 50; height: 50 } + Rectangle { color: "#9999aa"; width: 50; height: 50 } + Rectangle { color: "#6666aa"; width: 50; height: 50 } + } +} diff --git a/doc/src/snippets/declarative/grid/grid.qml b/doc/src/snippets/declarative/grid/grid.qml new file mode 100644 index 0000000000..d57b4b2b3d --- /dev/null +++ b/doc/src/snippets/declarative/grid/grid.qml @@ -0,0 +1,53 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +//! [document] +import Qt 4.7 + +Grid { + columns: 3 + spacing: 2 + Rectangle { color: "red"; width: 50; height: 50 } + Rectangle { color: "green"; width: 20; height: 50 } + Rectangle { color: "blue"; width: 50; height: 20 } + Rectangle { color: "cyan"; width: 50; height: 50 } + Rectangle { color: "magenta"; width: 10; height: 10 } +} +//! [document] diff --git a/doc/src/snippets/declarative/repeaters/repeater-grid-index.qml b/doc/src/snippets/declarative/repeaters/repeater-grid-index.qml new file mode 100644 index 0000000000..106550eb89 --- /dev/null +++ b/doc/src/snippets/declarative/repeaters/repeater-grid-index.qml @@ -0,0 +1,61 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +//! [document] +import Qt 4.7 + +Rectangle { + width: 400; height: 400; color: "black" + + Grid { + x: 5; y: 5 + rows: 5; columns: 5; spacing: 10 + + Repeater { model: 24 + Rectangle { width: 70; height: 70 + color: "lightgreen" + + Text { text: index + font.pointSize: 30 + anchors.centerIn: parent } } + } + } +} +//! [document] diff --git a/doc/src/snippets/declarative/repeater.qml b/doc/src/snippets/declarative/repeaters/repeater.qml index d71fd298ba..d71fd298ba 100644 --- a/doc/src/snippets/declarative/repeater.qml +++ b/doc/src/snippets/declarative/repeaters/repeater.qml diff --git a/doc/src/snippets/declarative/row.qml b/doc/src/snippets/declarative/row.qml new file mode 100644 index 0000000000..bd2db164c5 --- /dev/null +++ b/doc/src/snippets/declarative/row.qml @@ -0,0 +1,62 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +//! [document] +import Qt 4.7 + +Rectangle { + width: 320; height: 110 + color: "#c0c0c0" + + Row { + anchors.horizontalCenter: parent.horizontalCenter + anchors.verticalCenter: parent.verticalCenter + + spacing: 5 + + Rectangle { width: 100; height: 100; radius: 20.0 + color: "#024c1c" } + Rectangle { width: 100; height: 100; radius: 20.0 + color: "#42a51c" } + Rectangle { width: 100; height: 100; radius: 20.0 + color: "white" } + } +} +//! [document] diff --git a/doc/src/snippets/declarative/row/row.qml b/doc/src/snippets/declarative/row/row.qml new file mode 100644 index 0000000000..c863243e8f --- /dev/null +++ b/doc/src/snippets/declarative/row/row.qml @@ -0,0 +1,50 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +//! [document] +import Qt 4.7 + +Row { + spacing: 2 + Rectangle { color: "red"; width: 50; height: 50 } + Rectangle { color: "green"; width: 20; height: 50 } + Rectangle { color: "blue"; width: 50; height: 20 } +} +//! [document] diff --git a/doc/src/snippets/declarative/~image-fillmode.qml b/doc/src/snippets/declarative/~image-fillmode.qml new file mode 100644 index 0000000000..cee26c49ee --- /dev/null +++ b/doc/src/snippets/declarative/~image-fillmode.qml @@ -0,0 +1,46 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import Qt 4.7 + +Image { + source: "pics/qtlogo.png" + width: 20; height: 20 +} diff --git a/src/declarative/graphicsitems/qdeclarativeborderimage.cpp b/src/declarative/graphicsitems/qdeclarativeborderimage.cpp index 5a9a18d687..832e1cddb4 100644 --- a/src/declarative/graphicsitems/qdeclarativeborderimage.cpp +++ b/src/declarative/graphicsitems/qdeclarativeborderimage.cpp @@ -169,7 +169,8 @@ QDeclarativeBorderImage::~QDeclarativeBorderImage() /*! \qmlproperty enumeration BorderImage::status - This property holds the status of image loading. It can be one of: + This property describes the status of image loading. It can be one of: + \list \o BorderImage.Null - no image has been set \o BorderImage.Ready - the image has been loaded @@ -201,18 +202,24 @@ QDeclarativeBorderImage::~QDeclarativeBorderImage() \note Generally scaling artifacts are only visible if the image is stationary on the screen. A common pattern when animating an image is to disable smooth - filtering at the beginning of the animation and reenable it at the conclusion. + filtering at the beginning of the animation and enable it at the conclusion. */ /*! \qmlproperty url BorderImage::source - BorderImage can handle any image format supported by Qt, loaded from any URL scheme supported by Qt. + This property holds the URL that refers to the source image. + + BorderImage can handle any image format supported by Qt, loaded from any + URL scheme supported by Qt. + + It can also handle .sci files, which are a QML-specific format. A .sci + file uses a simple text-based format that specifies the borders, the + image file and the tile rules. - It can also handle .sci files, which are a QML-specific format. A .sci file uses a simple text-based format that specifies - the borders, the image file and the tile rules. + The following .sci file sets the borders to 10 on each side for the + image \c picture.png: - The following .sci file sets the borders to 10 on each side for the image \c picture.png: \qml border.left: 10 border.top: 10 @@ -356,7 +363,7 @@ QDeclarativeScaleGrid *QDeclarativeBorderImage::border() This property describes how to repeat or stretch the middle parts of the border image. \list - \o BorderImage.Stretch - Scale the image to fit to the available area. + \o BorderImage.Stretch - Scales the image to fit to the available area. \o BorderImage.Repeat - Tile the image until there is no more space. May crop the last image. \o BorderImage.Round - Like Repeat, but scales the images down to ensure that the last image is not cropped. \endlist diff --git a/src/declarative/graphicsitems/qdeclarativepositioners.cpp b/src/declarative/graphicsitems/qdeclarativepositioners.cpp index 4ceb5d9149..b653282cd0 100644 --- a/src/declarative/graphicsitems/qdeclarativepositioners.cpp +++ b/src/declarative/graphicsitems/qdeclarativepositioners.cpp @@ -330,58 +330,65 @@ static inline bool isInvisible(QGraphicsObject *child) /*! \qmlclass Column QDeclarativeColumn - \ingroup qml-positioning-elements - \since 4.7 + \ingroup qml-positioning-elements + \since 4.7 \brief The Column item arranges its children vertically. \inherits Item The Column item positions its child items so that they are vertically - aligned and not overlapping. Spacing between items can be added. + aligned and not overlapping. - The below example positions differently shaped rectangles using a Column. - \table - \row - \o \image verticalpositioner_example.png - \o - \qml -Column { - spacing: 2 - Rectangle { color: "red"; width: 50; height: 50 } - Rectangle { color: "green"; width: 20; height: 50 } - Rectangle { color: "blue"; width: 50; height: 20 } -} - \endqml - \endtable + Spacing between items can be added using the \l spacing property. + Transitions can be used for cases where items managed by a Column are + added or moved. These are stored in the \l add and \l move properties + respectively. + + See \l{Using QML Positioner and Repeater Items} for more details about this item and other + related items. + + \section1 Example Usage + + The following example positions differently shaped rectangles using a Column + item. + + \image verticalpositioner_example.png + + \snippet doc/src/snippets/declarative/column/vertical-positioner.qml document + + \section1 Using Transitions + + Transitions can be used to animate items that are added to, moved within, + or removed from a Column item. The \l add and \l move properties can be set to + the transitions that will be applied when items are added to, removed from, + or re-positioned within a Column item. + + The use of transitions with positioners is described in more detail in the + \l{Using QML Positioner and Repeater Items#Using Transitions}{Using QML + Positioner and Repeater Items} document. - Column also provides for transitions to be set when items are added, moved, - or removed in the positioner. Adding and removing apply both to items which are deleted - or have their position in the document changed so as to no longer be children of the positioner, - as well as to items which have their opacity set to or from zero so as to appear or disappear. + \image verticalpositioner_transition.gif - \table - \row - \o \image verticalpositioner_transition.gif - \o \qml -Column { - spacing: 2 - add: ... - move: ... - ... -} + Column { + spacing: 2 + add: ... + move: ... + ... + } \endqml - \endtable + + \section1 Limitations Note that the positioner assumes that the x and y positions of its children will not change. If you manually change the x or y properties in script, bind the x or y properties, use anchors on a child of a positioner, or have the height of a child depend on the position of a child, then the - positioner may exhibit strange behaviour. If you need to perform any of these + positioner may exhibit strange behavior. If you need to perform any of these actions, consider positioning the items without the use of a Column. Items with a width or height of 0 will not be positioned. - \sa Row, {declarative/positioners}{Positioners example} + \sa Row, Grid, Flow, {declarative/positioners}{Positioners example} */ /*! \qmlproperty Transition Column::add @@ -389,55 +396,47 @@ Column { This property holds the transition to be applied when adding an item to the positioner. The transition will only be applied to the added item(s). Positioner transitions will only affect the - position (x,y) of items. - - Added can mean that either the object has been created or - reparented, and thus is now a child or the positioner, or that the - object has had its opacity increased from zero, and thus is now - visible. + position (x, y) of items. + For a positioner, adding an item can mean that either the object + has been created or reparented, and thus is now a child or the + positioner, or that the object has had its opacity increased from + zero, and thus is now visible. + \sa move */ /*! \qmlproperty Transition Column::move This property holds the transition to apply when moving an item within the positioner. Positioner transitions will only affect - the position (x,y) of items. + the position (x, y) of items. + + This transition can be performed when other items are added or removed + from the positioner, or when items resize themselves. - This can happen when other items are added or removed from the - positioner, or when items resize themselves. + \image positioner-move.gif - \table - \row - \o \image positioner-move.gif - \o \qml -Column { - move: Transition { - NumberAnimation { - properties: "y" - easing.type: Easing.OutBounce + Column { + move: Transition { + NumberAnimation { + properties: "y" + easing.type: Easing.OutBounce + } } } -} \endqml - \endtable + + \sa add, {declarative/positioners}{Positioners example} */ /*! \qmlproperty int Column::spacing - spacing is the amount in pixels left empty between each adjacent - item, and defaults to 0. - - The below example places a \l Grid containing a red, a blue and a - green rectangle on a gray background. The area the grid positioner - occupies is colored white. The top positioner has the default of no spacing, - and the bottom positioner has its spacing set to 2. - - \image spacing_a.png - \image spacing_b.png + The spacing is the amount in pixels left empty between adjacent + items. The default spacing is 0. + \sa Grid::spacing */ /*! \internal @@ -496,29 +495,38 @@ void QDeclarativeColumn::reportConflictingAnchors() /*! \qmlclass Row QDeclarativeRow - \ingroup qml-positioning-elements + \ingroup qml-positioning-elements \since 4.7 \brief The Row item arranges its children horizontally. \inherits Item - The Row item positions its child items so that they are - horizontally aligned and not overlapping. + The Row item positions its child items so that they are horizontally + aligned and not overlapping. Use \l spacing to set the spacing between items in a Row, and use the \l add and \l move properties to set the transitions that should be applied when items are added to, removed from, or re-positioned within the Row. - The below example lays out differently shaped rectangles using a Row. - \qml -Row { - spacing: 2 - Rectangle { color: "red"; width: 50; height: 50 } - Rectangle { color: "green"; width: 20; height: 50 } - Rectangle { color: "blue"; width: 50; height: 20 } -} - \endqml + See \l{Using QML Positioner and Repeater Items} for more details about this item and other + related items. + + \section1 Example Usage + + The following example lays out differently shaped rectangles using a Row. + \image horizontalpositioner_example.png + \snippet doc/src/snippets/declarative/row/row.qml document + + \section1 Using Transitions + + Transitions can be used to animate items that are added to, moved within, + or removed from a Grid item. The \l add and \l move properties can be set to + the transitions that will be applied when items are added to, removed from, + or re-positioned within a Row item. + + \section1 Limitations + Note that the positioner assumes that the x and y positions of its children will not change. If you manually change the x or y properties in script, bind the x or y properties, use anchors on a child of a positioner, or have the @@ -528,56 +536,54 @@ Row { Items with a width or height of 0 will not be positioned. - \sa Column, {declarative/positioners}{Positioners example} + \sa Column, Grid, Flow, {declarative/positioners}{Positioners example} */ /*! \qmlproperty Transition Row::add - This property holds the transition to apply when adding an item to the positioner. - The transition will only be applied to the added item(s). - Positioner transitions will only affect the position (x,y) of items. - - An object is considered to be added to the positioner if it has been - created or reparented and thus is now a child or the positioner, or if the - object has had its opacity increased from zero, and thus is now - visible. + + This property holds the transition to be applied when adding an + item to the positioner. The transition will only be applied to the + added item(s). Positioner transitions will only affect the + position (x, y) of items. + + For a positioner, adding an item can mean that either the object + has been created or reparented, and thus is now a child or the + positioner, or that the object has had its opacity increased from + zero, and thus is now visible. + + \sa move */ /*! \qmlproperty Transition Row::move - This property holds the transition to apply when moving an item - within the positioner. Positioner transitions will only affect - the position (x,y) of items. + This property holds the transition to be applied when moving an + item within the positioner. Positioner transitions will only affect + the position (x, y) of items. - This can happen when other items are added or removed from the - positioner, or when items resize themselves. + This transition can be performed when other items are added or removed + from the positioner, or when items resize themselves. \qml -Row { - id: positioner - move: Transition { - NumberAnimation { - properties: "x" - ease: "easeOutBounce" + Row { + id: positioner + move: Transition { + NumberAnimation { + properties: "x" + ease: "easeOutBounce" + } } } -} \endqml + \sa add, {declarative/positioners}{Positioners example} */ /*! \qmlproperty int Row::spacing - spacing is the amount in pixels left empty between each adjacent - item, and defaults to 0. - - The below example places a \l Grid containing a red, a blue and a - green rectangle on a gray background. The area the grid positioner - occupies is colored white. The top positioner has the default of no spacing, - and the bottom positioner has its spacing set to 2. - - \image spacing_a.png - \image spacing_b.png + The spacing is the amount in pixels left empty between adjacent + items. The default spacing is 0. + \sa Grid::spacing */ /*! \internal @@ -635,47 +641,45 @@ void QDeclarativeRow::reportConflictingAnchors() /*! \qmlclass Grid QDeclarativeGrid - \ingroup qml-positioning-elements + \ingroup qml-positioning-elements \since 4.7 \brief The Grid item positions its children in a grid. \inherits Item The Grid item positions its child items so that they are aligned in a grid and are not overlapping. - - Spacing can be added - between child items. It also provides for transitions to be set when items are - added, moved, or removed in the positioner. Adding and removing apply - both to items which are deleted or have their position in the - document changed so as to no longer be children of the positioner, as - well as to items which have their opacity set to or from zero so - as to appear or disappear. - - A Grid defaults to four columns, and as many rows as - are necessary to fit all child items. The number of rows - and/or the number of columns can be constrained by setting the \l rows - or \l columns properties. The grid positioner calculates a grid with - rectangular cells of sufficient size to hold all items, and then - places the items in the cells, going across then down, and - positioning each item at the (0,0) corner of the cell. The below - example demonstrates this. - - \table - \row - \o \image gridLayout_example.png - \o - \qml -Grid { - columns: 3 - spacing: 2 - Rectangle { color: "red"; width: 50; height: 50 } - Rectangle { color: "green"; width: 20; height: 50 } - Rectangle { color: "blue"; width: 50; height: 20 } - Rectangle { color: "cyan"; width: 50; height: 50 } - Rectangle { color: "magenta"; width: 10; height: 10 } -} - \endqml - \endtable + + A Grid defaults to four columns, and as many rows as are necessary to + fit all child items. The number of rows and columns can be constrained + by setting the \l rows and \l columns properties. The grid positioner + calculates a grid of rectangular cells of sufficient size to hold all + items, placing the items in the cells, from left to right and top to + bottom. Each item is positioned in the top-left corner of its cell + with position (0, 0). + + Spacing can be added between child items by setting the \l spacing + property. The amount of spacing applied will be the same in the + horizontal and vertical directions. + + See \l{Using QML Positioner and Repeater Items} for more details about this item and other + related items. + + \section1 Example Usage + + The following example demonstrates this. + + \image gridLayout_example.png + + \snippet doc/src/snippets/declarative/grid/grid.qml document + + \section1 Using Transitions + + Transitions can be used to animate items that are added to, moved within, + or removed from a Grid item. The \l add and \l move properties can be set to + the transitions that will be applied when items are added to, removed from, + or re-positioned within a Grid item. + + \section1 Limitations Note that the positioner assumes that the x and y positions of its children will not change. If you manually change the x or y properties in script, bind @@ -686,55 +690,62 @@ Grid { Items with a width or height of 0 will not be positioned. - \sa Flow, {declarative/positioners}{Positioners example} + \sa Flow, Row, Column, {declarative/positioners}{Positioners example} */ /*! \qmlproperty Transition Grid::add - This property holds the transition to apply when adding an item to the positioner. - The transition is only applied to the added item(s). - Positioner transitions will only affect the position (x,y) of items, - as that is all the positioners affect. To animate other property change - you will have to do so based on how you have changed those properties. - - An object is considered to be added to the positioner if it has been - created or reparented and thus is now a child or the positioner, or if the - object has had its opacity increased from zero, and thus is now - visible. + + This property holds the transition to be applied when adding an + item to the positioner. The transition will only be applied to the + added item(s). Positioner transitions will only affect the + position (x, y) of items. + + For a positioner, adding an item can mean that either the object + has been created or reparented, and thus is now a child or the + positioner, or that the object has had its opacity increased from + zero, and thus is now visible. + + \sa move */ /*! \qmlproperty Transition Grid::move - This property holds the transition to apply when moving an item within the positioner. - Positioner transitions will only affect the position (x,y) of items. - This can happen when other items are added or removed from the positioner, or - when items resize themselves. + This property holds the transition to be applied when moving an + item within the positioner. Positioner transitions will only affect + the position (x, y) of items. + + This transition can be performed when other items are added or removed + from the positioner, or when items resize themselves. \qml -Grid { - move: Transition { - NumberAnimation { - properties: "x,y" - ease: "easeOutBounce" + Grid { + move: Transition { + NumberAnimation { + properties: "x,y" + ease: "easeOutBounce" + } } } -} \endqml + \sa add, {declarative/positioners}{Positioners example} */ /*! \qmlproperty int Grid::spacing - spacing is the amount in pixels left empty between each adjacent - item, and defaults to 0. + The spacing is the amount in pixels left empty between adjacent + items. The default spacing is 0. The below example places a Grid containing a red, a blue and a green rectangle on a gray background. The area the grid positioner - occupies is colored white. The top positioner has the default of no spacing, - and the bottom positioner has its spacing set to 2. + occupies is colored white. The positioner on the left has the + no spacing (the default), and the positioner on the right has + a spacing of 6. - \image spacing_a.png - \image spacing_b.png + \inlineimage qml-grid-no-spacing.png + \inlineimage qml-grid-spacing.png + \sa rows, columns */ /*! \internal @@ -748,7 +759,9 @@ QDeclarativeGrid::QDeclarativeGrid(QDeclarativeItem *parent) : /*! \qmlproperty int Grid::columns - This property holds the number of columns in the grid. + + This property holds the number of columns in the grid. The default + number of columns is 4. If the grid does not have enough items to fill the specified number of columns, some columns will be of zero width. @@ -930,13 +943,43 @@ void QDeclarativeGrid::reportConflictingAnchors() /*! \qmlclass Flow QDeclarativeFlow - \ingroup qml-positioning-elements + \ingroup qml-positioning-elements \since 4.7 \brief The Flow item arranges its children side by side, wrapping as necessary. \inherits Item - The Flow item positions its child items so that they are side by side and are - not overlapping. + The Flow item positions its child items like words on a page, wrapping them + to create rows or columns of items that do not overlap. + + Spacing between items can be added using the \l spacing property. + Transitions can be used for cases where items managed by a Column are + added or moved. These are stored in the \l add and \l move properties + respectively. + + See \l{Using QML Positioner and Repeater Items} for more details about this item and other + related items. + + \section1 Example Usage + + The following example positions \l Text items within a parent item using + a Flow item. + + \image qml-flow-snippet.png + + \snippet doc/src/snippets/declarative/flow.qml flow item + + \section1 Using Transitions + + Transitions can be used to animate items that are added to, moved within, + or removed from a Flow item. The \l add and \l move properties can be set to + the transitions that will be applied when items are added to, removed from, + or re-positioned within a Flow item. + + The use of transitions with positioners is described in more detail in the + \l{Using QML Positioner and Repeater Items#Using Transitions}{Using QML + Positioner and Repeater Items} document. + + \section1 Limitations Note that the positioner assumes that the x and y positions of its children will not change. If you manually change the x or y properties in script, bind @@ -947,38 +990,46 @@ void QDeclarativeGrid::reportConflictingAnchors() Items with a width or height of 0 will not be positioned. - \sa Grid, {declarative/positioners}{Positioners example} + \sa Column, Row, Grid, {declarative/positioners}{Positioners example} */ /*! \qmlproperty Transition Flow::add - This property holds the transition to apply when adding an item to the positioner. - The transition will only be applied to the added item(s). - Positioner transitions will only affect the position (x,y) of items. - - An object is considered to be added to the positioner if it has been - created or reparented and thus is now a child or the positioner, or if the - object has had its opacity increased from zero, and thus is now - visible. + + This property holds the transition to be applied when adding an + item to the positioner. The transition will only be applied to the + added item(s). Positioner transitions will only affect the + position (x, y) of items. + + For a positioner, adding an item can mean that either the object + has been created or reparented, and thus is now a child or the + positioner, or that the object has had its opacity increased from + zero, and thus is now visible. + + \sa move */ /*! \qmlproperty Transition Flow::move - This property holds the transition to apply when moving an item within the positioner. - Positioner transitions will only affect the position (x,y) of items. - This can happen when other items are added or removed from the positioner, or when items resize themselves. + This property holds the transition to be applied when moving an + item within the positioner. Positioner transitions will only affect + the position (x, y) of items. + + This transition can be performed when other items are added or removed + from the positioner, or when items resize themselves. \qml -Flow { - id: positioner - move: Transition { - NumberAnimation { - properties: "x,y" - ease: "easeOutBounce" + Flow { + id: positioner + move: Transition { + NumberAnimation { + properties: "x,y" + ease: "easeOutBounce" + } } } -} \endqml + \sa add, {declarative/positioners}{Positioners example} */ /*! \qmlproperty int Flow::spacing @@ -986,6 +1037,7 @@ Flow { spacing is the amount in pixels left empty between each adjacent item, and defaults to 0. + \sa Grid::spacing */ class QDeclarativeFlowPrivate : public QDeclarativeBasePositionerPrivate diff --git a/src/declarative/graphicsitems/qdeclarativerepeater.cpp b/src/declarative/graphicsitems/qdeclarativerepeater.cpp index 4a951a281c..c4052bbaf7 100644 --- a/src/declarative/graphicsitems/qdeclarativerepeater.cpp +++ b/src/declarative/graphicsitems/qdeclarativerepeater.cpp @@ -78,9 +78,9 @@ QDeclarativeRepeaterPrivate::~QDeclarativeRepeaterPrivate() The following Repeater creates three instances of a \l Rectangle item within a \l Row: - \snippet doc/src/snippets/declarative/repeater.qml import + \snippet doc/src/snippets/declarative/repeaters/repeater.qml import \codeline - \snippet doc/src/snippets/declarative/repeater.qml simple + \snippet doc/src/snippets/declarative/repeaters/repeater.qml simple \image repeater-simple.png @@ -92,7 +92,7 @@ QDeclarativeRepeaterPrivate::~QDeclarativeRepeaterPrivate() 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/src/snippets/declarative/repeater.qml layout + \snippet doc/src/snippets/declarative/repeaters/repeater.qml layout \image repeater.png @@ -106,7 +106,7 @@ QDeclarativeRepeaterPrivate::~QDeclarativeRepeaterPrivate() \table \row - \o \snippet doc/src/snippets/declarative/repeater.qml index + \o \snippet doc/src/snippets/declarative/repeaters/repeater.qml index \o \image repeater-index.png \endtable @@ -115,7 +115,7 @@ QDeclarativeRepeaterPrivate::~QDeclarativeRepeaterPrivate() \table \row - \o \snippet doc/src/snippets/declarative/repeater.qml modeldata + \o \snippet doc/src/snippets/declarative/repeaters/repeater.qml modeldata \o \image repeater-modeldata.png \endtable |