aboutsummaryrefslogtreecommitdiffstats
path: root/examples/quick/views
diff options
context:
space:
mode:
authorVenugopal Shivashankar <Venugopal.Shivashankar@qt.io>2018-10-03 13:50:13 +0200
committerVenugopal Shivashankar <Venugopal.Shivashankar@qt.io>2018-10-11 12:36:36 +0000
commitb6f7fe1f80e6beed62ef47691fae6aa9f4a851b8 (patch)
tree92055e528215632ee4872c1f87793f535746e656 /examples/quick/views
parentb8f4005f132c26b842387e1ae5f492594dc03d86 (diff)
Examples: Use XmlHttpRequest to fetch flickr public photos
This change is to facilite moving the XmlListModel code to the qtxmlpatterns repo, but still keep all the Particles examples together. Also fixed: - the old TODO about darkening images according to depth, and make it generally look a bit better. - move the visualdatamodel examples to a directory called delegatemodel, since that's how they work now. And add them to the main "views" example launcher so that they become more visible to users. Change-Id: I78f9f19e1e110608580adedcf4cd3be554222515 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Diffstat (limited to 'examples/quick/views')
-rw-r--r--examples/quick/views/delegatemodel/delegatemodel.qmlproject (renamed from examples/quick/views/visualdatamodel/visualdatamodel.qmlproject)0
-rw-r--r--examples/quick/views/delegatemodel/dragselection.qml (renamed from examples/quick/views/visualdatamodel/dragselection.qml)0
-rw-r--r--examples/quick/views/delegatemodel/slideshow.qml (renamed from examples/quick/views/visualdatamodel/slideshow.qml)25
-rw-r--r--examples/quick/views/views.qml2
-rw-r--r--examples/quick/views/views.qrc4
5 files changed, 14 insertions, 17 deletions
diff --git a/examples/quick/views/visualdatamodel/visualdatamodel.qmlproject b/examples/quick/views/delegatemodel/delegatemodel.qmlproject
index 2bb4016996..2bb4016996 100644
--- a/examples/quick/views/visualdatamodel/visualdatamodel.qmlproject
+++ b/examples/quick/views/delegatemodel/delegatemodel.qmlproject
diff --git a/examples/quick/views/visualdatamodel/dragselection.qml b/examples/quick/views/delegatemodel/dragselection.qml
index 15fd2654c2..15fd2654c2 100644
--- a/examples/quick/views/visualdatamodel/dragselection.qml
+++ b/examples/quick/views/delegatemodel/dragselection.qml
diff --git a/examples/quick/views/visualdatamodel/slideshow.qml b/examples/quick/views/delegatemodel/slideshow.qml
index 369b5a46ac..b252519bbf 100644
--- a/examples/quick/views/visualdatamodel/slideshow.qml
+++ b/examples/quick/views/delegatemodel/slideshow.qml
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2017 The Qt Company Ltd.
+** Copyright (C) 2018 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the examples of the Qt Toolkit.
@@ -48,9 +48,9 @@
**
****************************************************************************/
-import QtQuick 2.0
-import QtQuick.XmlListModel 2.0
-import QtQml.Models 2.1
+import QtQuick 2.12
+import QtQml.Models 2.12
+import "../../shared" as Shared
Rectangle {
id: root
@@ -61,18 +61,14 @@ Rectangle {
color: "black"
+ Shared.FlickrRssModel {
+ id: flickrModel
+ tags: "fjords,mountains"
+ }
DelegateModel {
id: visualModel
- model: XmlListModel {
- source: "http://api.flickr.com/services/feeds/photos_public.gne?format=rss2"
- query: "/rss/channel/item"
- namespaceDeclarations: "declare namespace media=\"http://search.yahoo.com/mrss/\";"
-
- XmlRole { name: "imagePath"; query: "media:thumbnail/@url/string()" }
- XmlRole { name: "url"; query: "media:content/@url/string()" }
- }
-
+ model: flickrModel
delegate: Item {
id: delegateItem
@@ -90,9 +86,8 @@ Rectangle {
anchors.leftMargin: 1
anchors.topMargin: 1
- source: imagePath
+ source: thumbnail
fillMode: Image.PreserveAspectFit
-
}
MouseArea {
diff --git a/examples/quick/views/views.qml b/examples/quick/views/views.qml
index 87f85856ff..bdf05269ae 100644
--- a/examples/quick/views/views.qml
+++ b/examples/quick/views/views.qml
@@ -69,6 +69,8 @@ Item {
addExample("PathView", "A simple PathView", Qt.resolvedUrl("pathview/pathview-example.qml"))
addExample("ObjectModel", "Using a ObjectModel", Qt.resolvedUrl("objectmodel/objectmodel.qml"))
addExample("Display Margins", "A ListView with display margins", Qt.resolvedUrl("listview/displaymargin.qml"))
+ addExample("DelegateModel", "A PathView using DelegateModel to instantiate delegates", Qt.resolvedUrl("delegatemodel/slideshow.qml"))
+ addExample("Draggable Selections", "Enabling drag-and-drop on DelegateModel delegates", Qt.resolvedUrl("delegatemodel/dragselection.qml"))
}
}
}
diff --git a/examples/quick/views/views.qrc b/examples/quick/views/views.qrc
index 547dbea992..1646c49e81 100644
--- a/examples/quick/views/views.qrc
+++ b/examples/quick/views/views.qrc
@@ -41,8 +41,8 @@
<file>pathview/pics/EMail_48.png</file>
<file>pathview/pics/TodoList_48.png</file>
<file>pathview/pics/VideoPlayer_48.png</file>
- <file>visualdatamodel/slideshow.qml</file>
- <file>visualdatamodel/dragselection.qml</file>
+ <file>delegatemodel/slideshow.qml</file>
+ <file>delegatemodel/dragselection.qml</file>
<file>objectmodel/objectmodel.qml</file>
<file>views.qml</file>
<file>listview/displaymargin.qml</file>