diff options
| author | Jens Bache-Wiig <jens.bache-wiig@digia.com> | 2013-01-17 12:51:58 +0100 |
|---|---|---|
| committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-01-17 15:29:40 +0100 |
| commit | 9aedf5d06e470e3079b3996d9addb42d0115ba5b (patch) | |
| tree | 992df35278f8822fb8739fe9918a5d79f0cf2ca4 /examples/gallery/content/ModelView.qml | |
| parent | 033f9ab794b7411943f8cb973968952bbfbe052e (diff) | |
Clean up examples
I moved all the examples into subdirectories and added a
qmlproject for each.
Change-Id: I080182a43c3a518efc5f65b43460624bbb45e226
Reviewed-by: Thomas Zander <zander@kde.org>
Reviewed-by: Jens Bache-Wiig <jens.bache-wiig@digia.com>
Diffstat (limited to 'examples/gallery/content/ModelView.qml')
| -rw-r--r-- | examples/gallery/content/ModelView.qml | 92 |
1 files changed, 92 insertions, 0 deletions
diff --git a/examples/gallery/content/ModelView.qml b/examples/gallery/content/ModelView.qml new file mode 100644 index 000000000..babb70308 --- /dev/null +++ b/examples/gallery/content/ModelView.qml @@ -0,0 +1,92 @@ +/**************************************************************************** +** +** Copyright (C) 2012 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 QtDesktop 1.0 +//import QtQuick.XmlListModel 2.0 + +Item { + id: root + width: 600 + height: 300 + anchors.fill: parent + anchors.margins: styleitem.style == "mac" ? 12 : 0 + +// XmlListModel { +// id: flickerModel +// source: "http://api.flickr.com/services/feeds/photos_public.gne?format=rss2&tags=" + "Cat" +// query: "/rss/channel/item" +// namespaceDeclarations: "declare namespace media=\"http://search.yahoo.com/mrss/\";" +// XmlRole { name: "title"; query: "title/string()" } +// XmlRole { name: "imagesource"; query: "media:thumbnail/@url/string()" } +// XmlRole { name: "credit"; query: "media:credit/string()" } +// } + + ListModel { + id: dummyModel + Component.onCompleted: { + for (var i = 0 ; i < 100 ; ++i) { + append({"title": "A title " + i, "imagesource" :"http://someurl.com", "credit" : "N/A"}) + } + } + } + + TableView{ + model: dummyModel + anchors.fill: parent + + TableColumn { + role: "title" + title: "Title" + width: 120 + } + TableColumn { + role: "credit" + title: "Credit" + width: 120 + } + TableColumn { + role: "imagesource" + title: "Image source" + width: 200 + visible: true + } + } +} |
