From 20d33b96acf95fc1e162c4e8ed00d4b0b20806d9 Mon Sep 17 00:00:00 2001 From: Sze Howe Koh Date: Wed, 24 Apr 2013 22:20:30 +0800 Subject: Doc: Replace some references to Nokia Link to internal QDoc pages, or to qt-project.org Change-Id: I5d9adae711213873ab57ccfc5bb2d8f74cf5689b Reviewed-by: Jerome Pasion --- src/qml/doc/snippets/qml/imports/merged-named-imports.qml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/qml/doc/snippets') diff --git a/src/qml/doc/snippets/qml/imports/merged-named-imports.qml b/src/qml/doc/snippets/qml/imports/merged-named-imports.qml index c95d9e66eb..c37ac5e48d 100644 --- a/src/qml/doc/snippets/qml/imports/merged-named-imports.qml +++ b/src/qml/doc/snippets/qml/imports/merged-named-imports.qml @@ -39,8 +39,8 @@ ****************************************************************************/ //! [imports] -import QtQuick 2.0 as Nokia -import Ovi 1.0 as Nokia +import QtQuick 2.0 as Project +import QtMultimedia 5.0 as Project //! [imports] Item { -- cgit v1.2.3 From f823842afba3c3bf023ad68ed46761cfc9beadd2 Mon Sep 17 00:00:00 2001 From: Sze Howe Koh Date: Wed, 24 Apr 2013 22:31:41 +0800 Subject: Doc: Expand example (importing multiple modules into 1 namespace) Snippet is for the Qt QML "Import Statements" page. Show how to use the namespace to reference types from different modules Change-Id: I8c49703194a18657439afdef75e47ff7e97be653 Reviewed-by: Jerome Pasion Reviewed-by: Alan Alpert --- src/qml/doc/snippets/qml/imports/merged-named-imports.qml | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'src/qml/doc/snippets') diff --git a/src/qml/doc/snippets/qml/imports/merged-named-imports.qml b/src/qml/doc/snippets/qml/imports/merged-named-imports.qml index c37ac5e48d..65e2bfd4ce 100644 --- a/src/qml/doc/snippets/qml/imports/merged-named-imports.qml +++ b/src/qml/doc/snippets/qml/imports/merged-named-imports.qml @@ -41,7 +41,14 @@ //! [imports] import QtQuick 2.0 as Project import QtMultimedia 5.0 as Project -//! [imports] -Item { +Project.Rectangle { + width: 100; height: 50 + + Project.Audio { + source: "music.wav" + autoPlay: true + } } +//! [imports] + -- cgit v1.2.3 From d3852ae731ff3a32b3063b049101a7ee7f92ae8b Mon Sep 17 00:00:00 2001 From: Nico Vertriest Date: Thu, 18 Apr 2013 12:07:04 +0200 Subject: Doc: corrected snippet issue by changing extension snippet file. Task-number: QTBUG-30746 Changed in deployment.qdoc Deleted example.qrc Created example.qdoc Added license text to example.qdoc Change-Id: I9699dcdb4977506c0a62d1a9e952c98babfaf03d Reviewed-by: Jerome Pasion --- .../snippets/qml/qtbinding/resources/example.qdoc | 51 ++++++++++++++++++++++ .../snippets/qml/qtbinding/resources/example.qrc | 10 ----- 2 files changed, 51 insertions(+), 10 deletions(-) create mode 100644 src/qml/doc/snippets/qml/qtbinding/resources/example.qdoc delete mode 100644 src/qml/doc/snippets/qml/qtbinding/resources/example.qrc (limited to 'src/qml/doc/snippets') diff --git a/src/qml/doc/snippets/qml/qtbinding/resources/example.qdoc b/src/qml/doc/snippets/qml/qtbinding/resources/example.qdoc new file mode 100644 index 0000000000..c3b85ce15a --- /dev/null +++ b/src/qml/doc/snippets/qml/qtbinding/resources/example.qdoc @@ -0,0 +1,51 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc 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] + + + + + main.qml + images/background.png + + + +//![0] diff --git a/src/qml/doc/snippets/qml/qtbinding/resources/example.qrc b/src/qml/doc/snippets/qml/qtbinding/resources/example.qrc deleted file mode 100644 index 5e4941512b..0000000000 --- a/src/qml/doc/snippets/qml/qtbinding/resources/example.qrc +++ /dev/null @@ -1,10 +0,0 @@ - - - - - main.qml - images/background.png - - - - -- cgit v1.2.3 From 166249325432912ea7135427c0b8a600f70c5f4f Mon Sep 17 00:00:00 2001 From: Jerome Pasion Date: Fri, 19 Apr 2013 16:01:37 +0200 Subject: Doc: Moved "QML Application Developer Resources" to qtdoc repository. The guide is more relevant to Qt, not just Qt QML and Qt Quick. It would need to include information about the tools and other Qt modules which provide QML types. Change-Id: I0cab0db015022dd27f08811a88ea4a6c3c6e917d Reviewed-by: Sze Howe Koh Reviewed-by: Geir Vattekar --- .../doc/snippets/qml/qtbinding/resources/main.cpp | 57 ---------------------- .../doc/snippets/qml/qtbinding/resources/main.qml | 46 ----------------- .../snippets/qml/qtbinding/resources/resources.pro | 4 -- 3 files changed, 107 deletions(-) delete mode 100644 src/qml/doc/snippets/qml/qtbinding/resources/main.cpp delete mode 100644 src/qml/doc/snippets/qml/qtbinding/resources/main.qml delete mode 100644 src/qml/doc/snippets/qml/qtbinding/resources/resources.pro (limited to 'src/qml/doc/snippets') diff --git a/src/qml/doc/snippets/qml/qtbinding/resources/main.cpp b/src/qml/doc/snippets/qml/qtbinding/resources/main.cpp deleted file mode 100644 index 844c850366..0000000000 --- a/src/qml/doc/snippets/qml/qtbinding/resources/main.cpp +++ /dev/null @@ -1,57 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia Plc 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$ -** -****************************************************************************/ - -#include -#include -#include - -//![0] -int main(int argc, char *argv[]) -{ - QApplication app(argc, argv); - - QQuickView view; - view.setSource(QUrl("qrc:/main.qml")); - view.show(); - - return app.exec(); -} -//![0] - diff --git a/src/qml/doc/snippets/qml/qtbinding/resources/main.qml b/src/qml/doc/snippets/qml/qtbinding/resources/main.qml deleted file mode 100644 index 410b3f68d1..0000000000 --- a/src/qml/doc/snippets/qml/qtbinding/resources/main.qml +++ /dev/null @@ -1,46 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia Plc 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] -// main.qml -import QtQuick 2.0 - -Image { source: "images/background.png" } -//![0] diff --git a/src/qml/doc/snippets/qml/qtbinding/resources/resources.pro b/src/qml/doc/snippets/qml/qtbinding/resources/resources.pro deleted file mode 100644 index 5aee288a6e..0000000000 --- a/src/qml/doc/snippets/qml/qtbinding/resources/resources.pro +++ /dev/null @@ -1,4 +0,0 @@ -QT += qml - -SOURCES += main.cpp -RESOURCES += example.qrc -- cgit v1.2.3 From cec16f1e67aeec0e8a82a06cda6aaca5d95f4d94 Mon Sep 17 00:00:00 2001 From: Jan Arve Saether Date: Tue, 7 May 2013 15:08:17 +0200 Subject: Move xmlrole.qml to the correct location The snippets that qqmlxmllistmodel.cpp referred to could not be found. xmlrole.qml is only referenced from src/imports/xmllistmodel/qqmlxmllistmodel.cpp Change-Id: I95f962927097cd9d3295fbc2b376a9ab27ae6e5c Reviewed-by: Jerome Pasion --- src/qml/doc/snippets/qml/xmlrole.qml | 81 ------------------------------------ 1 file changed, 81 deletions(-) delete mode 100644 src/qml/doc/snippets/qml/xmlrole.qml (limited to 'src/qml/doc/snippets') diff --git a/src/qml/doc/snippets/qml/xmlrole.qml b/src/qml/doc/snippets/qml/xmlrole.qml deleted file mode 100644 index 0f75135da2..0000000000 --- a/src/qml/doc/snippets/qml/xmlrole.qml +++ /dev/null @@ -1,81 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia Plc 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 -import QtQuick.XmlListModel 2.0 - -Rectangle { - width: 300; height: 200 - -//![0] -XmlListModel { - id: model -//![0] - source: "xmlrole.xml" - -//![1] - // XmlRole queries will be made on elements - query: "/catalogue/book" - - // query the book title - XmlRole { name: "title"; query: "title/string()" } - - // query the book's year - XmlRole { name: "year"; query: "year/number()" } - - // query the book's type (the '@' indicates 'type' is an attribute, not an element) - XmlRole { name: "type"; query: "@type/string()" } - - // query the book's first listed author (note in XPath the first index is 1, not 0) - XmlRole { name: "first_author"; query: "author[1]/string()" } -} -//![1] - -ListView { - width: 300; height: 200 - model: model - delegate: Column { - Text { text: title + " (" + type + ")"; font.bold: true } - Text { text: first_author } - Text { text: year } - } -} - -} -- cgit v1.2.3 From ec57778b5d500bb12cc4ec678745f764a33f129d Mon Sep 17 00:00:00 2001 From: Jerome Pasion Date: Mon, 13 May 2013 13:11:05 +0200 Subject: Doc: Fixed a bunch of missing snippets. -moved delegate model related snippets from Qt Quick to Qt QML. -corrected snippet paths Change-Id: If688f97fb9317def16f343d5502a6a54d6761e95 Reviewed-by: Geir Vattekar --- .../doc/snippets/delegatemodel/visualdatagroup.qml | 81 ++++++++++++++++++++++ .../doc/snippets/delegatemodel/visualdatamodel.qml | 64 +++++++++++++++++ .../visualdatamodel_rootindex/main.cpp | 62 +++++++++++++++++ .../visualdatamodel_rootindex/view.qml | 65 +++++++++++++++++ 4 files changed, 272 insertions(+) create mode 100644 src/qml/doc/snippets/delegatemodel/visualdatagroup.qml create mode 100644 src/qml/doc/snippets/delegatemodel/visualdatamodel.qml create mode 100644 src/qml/doc/snippets/delegatemodel/visualdatamodel_rootindex/main.cpp create mode 100644 src/qml/doc/snippets/delegatemodel/visualdatamodel_rootindex/view.qml (limited to 'src/qml/doc/snippets') diff --git a/src/qml/doc/snippets/delegatemodel/visualdatagroup.qml b/src/qml/doc/snippets/delegatemodel/visualdatagroup.qml new file mode 100644 index 0000000000..4254b50e63 --- /dev/null +++ b/src/qml/doc/snippets/delegatemodel/visualdatagroup.qml @@ -0,0 +1,81 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc 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 + +Rectangle { + width: 200; height: 100 + + VisualDataModel { + id: visualModel + model: ListModel { + ListElement { name: "Apple" } + ListElement { name: "Orange" } + } + + groups: [ + VisualDataGroup { name: "selected" } + ] + + delegate: Rectangle { + id: item + height: 25 + width: 200 + Text { + text: { + var text = "Name: " + name + if (item.VisualDataModel.inSelected) + text += " (" + item.VisualDataModel.selectedIndex + ")" + return text; + } + } + MouseArea { + anchors.fill: parent + onClicked: item.VisualDataModel.inSelected = !item.VisualDataModel.inSelected + } + } + } + + ListView { + anchors.fill: parent + model: visualModel + } +} +//![0] diff --git a/src/qml/doc/snippets/delegatemodel/visualdatamodel.qml b/src/qml/doc/snippets/delegatemodel/visualdatamodel.qml new file mode 100644 index 0000000000..0513c5b5f2 --- /dev/null +++ b/src/qml/doc/snippets/delegatemodel/visualdatamodel.qml @@ -0,0 +1,64 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc 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 + +Rectangle { + width: 200; height: 100 + + VisualDataModel { + id: visualModel + model: ListModel { + ListElement { name: "Apple" } + ListElement { name: "Orange" } + } + delegate: Rectangle { + height: 25 + width: 100 + Text { text: "Name: " + name} + } + } + + ListView { + anchors.fill: parent + model: visualModel + } +} +//![0] diff --git a/src/qml/doc/snippets/delegatemodel/visualdatamodel_rootindex/main.cpp b/src/qml/doc/snippets/delegatemodel/visualdatamodel_rootindex/main.cpp new file mode 100644 index 0000000000..da1086146c --- /dev/null +++ b/src/qml/doc/snippets/delegatemodel/visualdatamodel_rootindex/main.cpp @@ -0,0 +1,62 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the QtQml 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 Digia Plc 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$ +** +****************************************************************************/ +#include +#include + +#include +#include + +//![0] +int main(int argc, char ** argv) +{ + QApplication app(argc, argv); + + QQuickView view; + + QDirModel model; + view.rootContext()->setContextProperty("dirModel", &model); + + view.setSource(QUrl::fromLocalFile("view.qml")); + view.show(); + + return app.exec(); +} +//![0] + diff --git a/src/qml/doc/snippets/delegatemodel/visualdatamodel_rootindex/view.qml b/src/qml/doc/snippets/delegatemodel/visualdatamodel_rootindex/view.qml new file mode 100644 index 0000000000..1e8cfade96 --- /dev/null +++ b/src/qml/doc/snippets/delegatemodel/visualdatamodel_rootindex/view.qml @@ -0,0 +1,65 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc 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 + +ListView { + id: view + width: 300 + height: 400 + + model: VisualDataModel { + model: dirModel + + delegate: Rectangle { + width: 200; height: 25 + Text { text: filePath } + + MouseArea { + anchors.fill: parent + onClicked: { + if (model.hasModelChildren) + view.model.rootIndex = view.model.modelIndex(index) + } + } + } + } +} +//![0] -- cgit v1.2.3 From 116a9893f1f333ee7a06d14d7a285345887b6eb3 Mon Sep 17 00:00:00 2001 From: Sze Howe Koh Date: Wed, 15 May 2013 22:10:08 +0800 Subject: Doc: Move snippet into correct module The snippet belongs to Qt Quick's "QML Basic Type: color" (src/quick/doc/src/qmltypereference.qdoc) Change-Id: I47defee04c34f9c98ec57d840c377c680d114d71 Reviewed-by: Jerome Pasion --- src/qml/doc/snippets/qml/colors.qml | 125 ------------------------------------ 1 file changed, 125 deletions(-) delete mode 100644 src/qml/doc/snippets/qml/colors.qml (limited to 'src/qml/doc/snippets') diff --git a/src/qml/doc/snippets/qml/colors.qml b/src/qml/doc/snippets/qml/colors.qml deleted file mode 100644 index 2885f13c81..0000000000 --- a/src/qml/doc/snippets/qml/colors.qml +++ /dev/null @@ -1,125 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia Plc 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 - -Rectangle { - width: 160; height: 250 - - Image { - width: 160; height: 200 - source: "pics/checker.svg" - fillMode: Image.Tile - - //! [colors] - Rectangle { - color: "steelblue" - width: 40; height: 40 - } - Rectangle { - color: "transparent" - y: 40; width: 40; height: 40 - } - Rectangle { - color: "#FF0000" - y: 80; width: 40; height: 40 - } - Rectangle { - color: "#800000FF" - y: 120; width: 40; height: 40 - } - Rectangle { - color: "#00000000" // ARGB fully transparent - y: 160 - width: 40; height: 40 - } - //! [colors] - - Rectangle { - x: 40 - width: 120; height: 200 - - Text { - font.pixelSize: 16 - text: "steelblue" - x: 10; height: 40 - verticalAlignment: Text.AlignVCenter - } - Text { - font.pixelSize: 16 - text: "transparent" - x: 10; y: 40; height: 40 - verticalAlignment: Text.AlignVCenter - } - Text { - font.pixelSize: 16 - text: "FF0000" - x: 10; y: 80; height: 40 - verticalAlignment: Text.AlignVCenter - } - Text { - font.pixelSize: 16 - text: "800000FF" - x: 10; y: 120; height: 40 - verticalAlignment: Text.AlignVCenter - } - Text { - font.pixelSize: 16 - text: "00000000" - x: 10; y: 160; height: 40 - verticalAlignment: Text.AlignVCenter - } - } - } - - Image { - y: 210 - width: 40; height: 40 - source: "pics/checker.svg" - fillMode: Image.Tile - } - - Text { - font.pixelSize: 16 - text: "(background)" - x: 50; y: 210; height: 40 - verticalAlignment: Text.AlignVCenter - } -} -- cgit v1.2.3 From ec68450161ca7ce7c3d9bc531bdcda1d14eb12e9 Mon Sep 17 00:00:00 2001 From: Sze Howe Koh Date: Wed, 15 May 2013 21:16:31 +0800 Subject: Doc: Inline a short snippet An indirect way of fixing a broken snippet path. The entire (but very short) file is included as a snippet in only one place, and the license text takes far more space than the snippet. Change-Id: I6f4bf588b8701b655d418a71f83a2f9263d6b532 Reviewed-by: Jerome Pasion --- src/qml/doc/snippets/qml/folderlistmodel.qml | 61 ---------------------------- 1 file changed, 61 deletions(-) delete mode 100644 src/qml/doc/snippets/qml/folderlistmodel.qml (limited to 'src/qml/doc/snippets') diff --git a/src/qml/doc/snippets/qml/folderlistmodel.qml b/src/qml/doc/snippets/qml/folderlistmodel.qml deleted file mode 100644 index b43949c487..0000000000 --- a/src/qml/doc/snippets/qml/folderlistmodel.qml +++ /dev/null @@ -1,61 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia Plc 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 -import Qt.labs.folderlistmodel 1.0 - -ListView { - width: 200; height: 400 - - FolderListModel { - id: folderModel - nameFilters: ["*.qml"] - } - - Component { - id: fileDelegate - Text { text: fileName } - } - - model: folderModel - delegate: fileDelegate -} -//![0] -- cgit v1.2.3