aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml
diff options
context:
space:
mode:
authorVenu <venugopal.shivashankar@digia.com>2013-12-10 13:44:36 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-12-13 15:50:06 +0100
commit470ba767663e4ad9d3183fb56ee89361354dfefb (patch)
tree84049af0c87463501de10ce61bc1230ca9d0dd8c /src/qml
parent2602b4402f3c8d867d11ea62b613b03dacc8a232 (diff)
Doc: Made copy of the QML files in the snippets directory
The Delegate.qml and view.qml files were not in the scope of Qt QML exampledirs. These files were in the example directory under quick, so had to make of copy of them in the snippets directory and update the snippet path to get the snippets in the html output. Task-number: QTBUG-35445 Change-Id: Ic3fa19dbd36b91d76fbc497ab524f5c0ff91325f Reviewed-by: J-P Nurmi <jpnurmi@digia.com> Reviewed-by: Nico Vertriest <nico.vertriest@digia.com> Reviewed-by: Topi Reiniƶ <topi.reinio@digia.com>
Diffstat (limited to 'src/qml')
-rw-r--r--src/qml/doc/snippets/package/Delegate.qml78
-rw-r--r--src/qml/doc/snippets/package/view.qml93
-rw-r--r--src/qml/types/qquickpackage.cpp6
3 files changed, 174 insertions, 3 deletions
diff --git a/src/qml/doc/snippets/package/Delegate.qml b/src/qml/doc/snippets/package/Delegate.qml
new file mode 100644
index 0000000000..641de67a62
--- /dev/null
+++ b/src/qml/doc/snippets/package/Delegate.qml
@@ -0,0 +1,78 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the examples 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
+
+//! [0]
+Package {
+ Text { id: listDelegate; width: parent.width; height: 25; text: 'Empty'; Package.name: 'list' }
+ Text { id: gridDelegate; width: parent.width / 2; height: 50; text: 'Empty'; Package.name: 'grid' }
+
+ Rectangle {
+ id: wrapper
+ width: parent.width; height: 25
+ color: 'lightsteelblue'
+
+ Text { text: display; anchors.centerIn: parent }
+ state: root.upTo > index ? 'inGrid' : 'inList'
+ states: [
+ State {
+ name: 'inList'
+ ParentChange { target: wrapper; parent: listDelegate }
+ },
+ State {
+ name: 'inGrid'
+ ParentChange {
+ target: wrapper; parent: gridDelegate
+ x: 0; y: 0; width: gridDelegate.width; height: gridDelegate.height
+ }
+ }
+ ]
+
+ transitions: [
+ Transition {
+ ParentAnimation {
+ NumberAnimation { properties: 'x,y,width,height'; duration: 300 }
+ }
+ }
+ ]
+ }
+}
+//! [0]
diff --git a/src/qml/doc/snippets/package/view.qml b/src/qml/doc/snippets/package/view.qml
new file mode 100644
index 0000000000..820eb4068c
--- /dev/null
+++ b/src/qml/doc/snippets/package/view.qml
@@ -0,0 +1,93 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the examples 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 QtQml.Models 2.1
+
+Rectangle {
+ id: root
+ color: "white"
+ width: 320
+ height: 480
+ property int upTo: 0
+ SequentialAnimation on upTo {
+ loops: -1
+ NumberAnimation { to: 8; duration: 3500 }
+ NumberAnimation { to: 0; duration: 3500 }
+ }
+
+ ListModel {
+ id: myModel
+ ListElement { display: "One" }
+ ListElement { display: "Two" }
+ ListElement { display: "Three" }
+ ListElement { display: "Four" }
+ ListElement { display: "Five" }
+ ListElement { display: "Six" }
+ ListElement { display: "Seven" }
+ ListElement { display: "Eight" }
+ }
+ //![0]
+ DelegateModel {
+ id: visualModel
+ delegate: Delegate {}
+ model: myModel
+ }
+
+ ListView {
+ id: lv
+ height: parent.height/2
+ width: parent.width
+
+ model: visualModel.parts.list
+ }
+ GridView {
+ y: parent.height/2
+ height: parent.height/2
+ width: parent.width
+ cellWidth: width / 2
+ cellHeight: 50
+ model: visualModel.parts.grid
+ }
+ //![0]
+ Text {
+ anchors.bottom: parent.bottom
+ }
+}
diff --git a/src/qml/types/qquickpackage.cpp b/src/qml/types/qquickpackage.cpp
index 1fed95eb85..f44be9d4b4 100644
--- a/src/qml/types/qquickpackage.cpp
+++ b/src/qml/types/qquickpackage.cpp
@@ -65,15 +65,15 @@ QT_BEGIN_NAMESPACE
delegate it should appear in. This allows an item to move
between views.
- \snippet quick/views/package/Delegate.qml 0
+ \snippet package/Delegate.qml 0
These named items are used as the delegates by the two views who
reference the special \l{VisualDataModel::parts} property to select
a model which provides the chosen delegate.
- \snippet quick/views/package/view.qml 0
+ \snippet package/view.qml 0
- \sa {quick/views/package}{Package example}, {Qt Quick Demo - Photo Viewer}, {Qt QML}
+ \sa {Qt Quick Examples - Views}, {Qt Quick Demo - Photo Viewer}, {Qt QML}
*/
/*!