summaryrefslogtreecommitdiffstats
path: root/examples/location/places/views
diff options
context:
space:
mode:
authorMichal Klocek <michal.klocek@theqtcompany.com>2015-04-30 11:43:44 +0200
committerAlex Blasche <alexander.blasche@theqtcompany.com>2015-05-27 12:23:28 +0000
commita5d615f5b49b29f91f979b4b338f7febbe445ebf (patch)
treec36c0d873259e0bbf8e0bb8849e6882de196e942 /examples/location/places/views
parent208a3723a02cda6ad1a99736c90bdc538c22a39a (diff)
Rewrite 'places' example to use qtquickcontrols
This is a squash commit of: * add qtquickcontrols window to 'places' example * add MenuBar to 'places' example * replace Slider in 'places' example * add stackView and MessageForm to 'places' example * replace SearchBox in 'places' example * replace SearchCenter dialog in 'places' example * replace SearchBoundingBox dialog in 'places' example * replace SearchBoundingCircle dialog in 'places' example * tune up categoryDelegate in 'places' example * tune up SearchResultDelegate in 'places' example * tune up PlacesDelegate in 'places' example * replace OptionsDialog in 'places' example * remove 'common' controls from location * clean up filenames in 'places' example * update MapComponent in 'places' example * code style formating of places.qml * remove backgroundRect from 'places' example * tune up EditorialPage in 'places' example * tune up ImageView in 'places' example * tune up ReviewPage in 'places' example * tune up SuggestionView in 'places' example * update imports version numbers in 'places' example * change searchBox and busyIndicator * update design in 'places' example Change-Id: I680c8b88f26689cb9728ee61617f7d2d3aa2a172 Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
Diffstat (limited to 'examples/location/places/views')
-rw-r--r--examples/location/places/views/CategoryDelegate.qml105
-rw-r--r--examples/location/places/views/CategoryView.qml71
-rw-r--r--examples/location/places/views/EditorialDelegate.qml86
-rw-r--r--examples/location/places/views/EditorialPage.qml114
-rw-r--r--examples/location/places/views/EditorialView.qml57
-rw-r--r--examples/location/places/views/ImageView.qml151
-rw-r--r--examples/location/places/views/RatingView.qml55
-rw-r--r--examples/location/places/views/ReviewDelegate.qml98
-rw-r--r--examples/location/places/views/ReviewPage.qml123
-rw-r--r--examples/location/places/views/ReviewView.qml57
-rw-r--r--examples/location/places/views/SearchResultDelegate.qml196
-rw-r--r--examples/location/places/views/SearchResultView.qml91
-rw-r--r--examples/location/places/views/SuggestionView.qml67
13 files changed, 1271 insertions, 0 deletions
diff --git a/examples/location/places/views/CategoryDelegate.qml b/examples/location/places/views/CategoryDelegate.qml
new file mode 100644
index 00000000..2ac0a339
--- /dev/null
+++ b/examples/location/places/views/CategoryDelegate.qml
@@ -0,0 +1,105 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** 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 The Qt Company Ltd 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.5
+import QtQuick.Controls 1.4
+import QtLocation 5.5
+
+Item {
+ id: root
+
+ property alias text: textItem.text
+ property bool checked: false
+ signal searchCategory()
+ signal showSubcategory()
+
+ width: parent.width
+ height: Math.max(icon.height, textItem.height * 2)
+
+ //! [CategoryModel delegate icon]
+ Image {
+ id: icon
+ anchors.left: parent.left
+ anchors.leftMargin: 30
+ anchors.verticalCenter: parent.verticalCenter
+ source: category.icon.url()
+ }
+ //! [CategoryModel delegate icon]
+
+ Rectangle {
+ anchors.fill: parent
+ color: "#44ffffff"
+ visible: mouse.pressed
+ }
+
+ //! [CategoryModel delegate text]
+ Label {
+ id: textItem
+ text: category.name
+ anchors.left: icon.right
+ anchors.verticalCenter: parent.verticalCenter
+ anchors.right: arrow.left
+ }
+ //! [CategoryModel delegate text]
+
+ Rectangle {
+ anchors.left: parent.left
+ anchors.right: parent.right
+ anchors.margins: 15
+ height: 1
+ color: "#46a2da"
+ }
+
+ MouseArea {
+ id: mouse
+ anchors.fill: parent
+ onClicked: root.searchCategory()
+ }
+
+ ToolButton {
+ id: arrow
+ anchors.right: parent.right
+ anchors.verticalCenter: parent.verticalCenter
+ anchors.rightMargin: 15
+ visible: model.hasModelChildren
+ iconSource: "../../resources/right.png"
+ onClicked: root.showSubcategory()
+ }
+}
diff --git a/examples/location/places/views/CategoryView.qml b/examples/location/places/views/CategoryView.qml
new file mode 100644
index 00000000..d476300a
--- /dev/null
+++ b/examples/location/places/views/CategoryView.qml
@@ -0,0 +1,71 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** 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 The Qt Company Ltd 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.5
+import QtLocation 5.5
+
+
+//! [CategoryModel view 1]
+ListView {
+ id: root
+ property variant categoryModel
+ property variant rootIndex
+
+ signal searchCategory(variant category)
+ signal enterCategory(variant index)
+//! [CategoryModel view 1]
+ snapMode: ListView.SnapToItem
+
+//! [CategoryModel view 2]
+
+//! [CategoryModel view 2]
+
+//! [CategoryModel view 3]
+ model: VisualDataModel {
+ id: visalDataModel
+ model: root.categoryModel
+ rootIndex: root.rootIndex
+ delegate: CategoryDelegate {
+ onSearchCategory: root.searchCategory(category);
+ onShowSubcategory: root.enterCategory(visalDataModel.modelIndex(index))
+ }
+ }
+}
+//! [CategoryModel view 3]
diff --git a/examples/location/places/views/EditorialDelegate.qml b/examples/location/places/views/EditorialDelegate.qml
new file mode 100644
index 00000000..7d55e02b
--- /dev/null
+++ b/examples/location/places/views/EditorialDelegate.qml
@@ -0,0 +1,86 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** 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 The Qt Company Ltd 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.5
+import QtLocation 5.5
+import QtQuick.Controls 1.4
+
+Item {
+ id: root
+ signal showEditorial()
+
+ width: parent.width
+ height: icon.height + 8
+
+ Image {
+ id: icon
+
+ width: 64
+ height: 64
+
+ anchors.verticalCenter: root.verticalCenter
+ anchors.left: root.left
+ anchors.leftMargin: 4
+
+ source: model.supplier.icon.url(Qt.size(64, 64), Icon.List)
+ fillMode: Image.PreserveAspectFit
+ }
+
+ Label {
+ anchors.top: icon.top
+ anchors.topMargin: 4
+ anchors.left: icon.right
+ anchors.leftMargin: 4
+ anchors.right: root.right
+ anchors.rightMargin: 4
+
+ text: model.title.length > 0 ? model.title : qsTr("Untitled editorial")
+ font.bold: true
+
+ wrapMode: Text.WordWrap
+ elide: Text.ElideRight
+ maximumLineCount: 2
+ }
+
+ MouseArea {
+ anchors.fill: parent
+ onClicked: showEditorial()
+ }
+}
diff --git a/examples/location/places/views/EditorialPage.qml b/examples/location/places/views/EditorialPage.qml
new file mode 100644
index 00000000..42864ef3
--- /dev/null
+++ b/examples/location/places/views/EditorialPage.qml
@@ -0,0 +1,114 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** 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 The Qt Company Ltd 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.5
+import QtLocation 5.5
+import QtQuick.Controls 1.4
+import QtQuick.Layouts 1.2
+
+Item {
+ id: root
+ property variant editorial
+ width: parent.width
+ height: parent.height
+
+ ScrollView {
+ id: scrollView
+ flickableItem.interactive: true
+ anchors.fill: parent
+ anchors.margins: 15
+
+ ColumnLayout {
+ width: scrollView.width - 30
+ spacing: 10
+
+ Rectangle {
+ anchors.left: parent.left
+ anchors.right: parent.right
+ height: 1
+ color: "#46a2da"
+ }
+
+ Label {
+ text: editorial.title
+ Layout.fillWidth: true
+ Layout.alignment: Qt.AlignHCenter
+ wrapMode: Text.WordWrap
+ textFormat: Text.RichText
+ }
+
+ Label {
+ text: editorial.text
+ Layout.fillWidth: true
+ Layout.alignment: Qt.AlignHCenter
+ wrapMode: Text.WordWrap
+ textFormat: Text.RichText
+ }
+
+ Rectangle {
+ anchors.left: parent.left
+ anchors.right: parent.right
+ height: 1
+ color: "#46a2da"
+ }
+
+ Image {
+ Layout.alignment: Qt.AlignHCenter
+ source: editorial.supplier.icon.url(Qt.size(width, height), Icon.List)
+ }
+
+ Label {
+ text: editorial.supplier.name
+ Layout.alignment: Qt.AlignHCenter
+ wrapMode: Text.WordWrap
+ textFormat: Text.RichText
+ }
+
+ Button {
+ id: button
+ text: qsTr("Open url")
+ Layout.alignment: Qt.AlignHCenter
+ onClicked: {
+ Qt.openUrlExternally(editorial.supplier.url)
+ }
+ }
+ }
+ }
+}
diff --git a/examples/location/places/views/EditorialView.qml b/examples/location/places/views/EditorialView.qml
new file mode 100644
index 00000000..e7b580ef
--- /dev/null
+++ b/examples/location/places/views/EditorialView.qml
@@ -0,0 +1,57 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** 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 The Qt Company Ltd 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.5
+import QtLocation 5.5
+
+//! [PlaceEditorialModel view]
+ListView {
+ id:view
+ property Place place
+ signal showEditorial(variant editorial)
+ width: parent.width
+ height: parent.height
+ model: place.editorialModel
+ delegate: EditorialDelegate {
+ onShowEditorial: view.showEditorial(model)
+ }
+}
+//! [PlaceEditorialModel view]
+
diff --git a/examples/location/places/views/ImageView.qml b/examples/location/places/views/ImageView.qml
new file mode 100644
index 00000000..a82a9d1d
--- /dev/null
+++ b/examples/location/places/views/ImageView.qml
@@ -0,0 +1,151 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** 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 The Qt Company Ltd 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.5
+import QtLocation 5.5
+import QtQuick.Controls 1.4
+
+Item {
+ id: root
+ property Place place
+ width: parent.width
+ height: parent.height
+
+ GridView {
+ id: gridView
+
+ anchors.fill: parent
+
+ model: place.imageModel
+
+ cellWidth: width / 3
+ cellHeight: cellWidth
+
+ delegate: Rectangle {
+ width: gridView.cellWidth
+ height: gridView.cellHeight
+
+ color: "#30FFFFFF"
+
+ Image {
+ anchors.fill: parent
+ anchors.margins: 5
+
+ source: url
+
+ fillMode: Image.PreserveAspectFit
+ }
+
+ MouseArea {
+ anchors.fill: parent
+ onClicked: {
+ listView.positionViewAtIndex(index, ListView.Contain);
+ root.state = "list";
+ }
+ }
+ }
+ }
+
+ ListView {
+ id: listView
+
+ anchors.top: parent.top
+ anchors.bottom: position.top
+ width: parent.width
+ spacing: 10
+
+ model: place.imageModel
+ orientation: ListView.Horizontal
+ snapMode: ListView.SnapOneItem
+
+ visible: false
+
+ delegate: Item {
+ width: listView.width
+ height: listView.height
+
+ Image {
+ anchors.fill: parent
+ source: url
+ fillMode: Image.PreserveAspectFit
+
+ MouseArea {
+ anchors.fill: parent
+ onClicked: root.state = ""
+ }
+ }
+
+ Button {
+ id: button
+ text: qsTr("Open url")
+ anchors.bottom: parent.bottom
+ anchors.horizontalCenter: parent.horizontalCenter
+ onClicked: {
+ Qt.openUrlExternally(supplier.url)
+ }
+ }
+ }
+ }
+
+ Label {
+ id: position
+
+ width: parent.width
+ anchors.bottom: parent.bottom
+ visible: listView.visible
+
+ text: (listView.currentIndex + 1) + '/' + listView.model.totalCount
+ horizontalAlignment: Text.AlignRight
+ }
+
+ states: [
+ State {
+ name: "list"
+ PropertyChanges {
+ target: gridView
+ visible: false
+ }
+ PropertyChanges {
+ target: listView
+ visible: true
+ }
+ }
+ ]
+}
diff --git a/examples/location/places/views/RatingView.qml b/examples/location/places/views/RatingView.qml
new file mode 100644
index 00000000..7751f644
--- /dev/null
+++ b/examples/location/places/views/RatingView.qml
@@ -0,0 +1,55 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** 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 The Qt Company Ltd 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.5
+
+Row {
+ property real rating: 0
+ property int size: 0
+
+ Repeater {
+ model: Math.ceil(rating)
+ Image {
+ source: "../../resources/star.png"
+ width: size
+ height: size
+ }
+ }
+}
diff --git a/examples/location/places/views/ReviewDelegate.qml b/examples/location/places/views/ReviewDelegate.qml
new file mode 100644
index 00000000..97991254
--- /dev/null
+++ b/examples/location/places/views/ReviewDelegate.qml
@@ -0,0 +1,98 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** 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 The Qt Company Ltd 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.5
+import QtLocation 5.5
+import QtQuick.Controls 1.4
+
+Item {
+ id: root
+ signal showReview()
+
+ width: parent.width
+ height: icon.height + 8
+
+ Image {
+ id: icon
+
+ width: 64
+ height: 64
+
+ anchors.verticalCenter: root.verticalCenter
+ anchors.left: root.left
+ anchors.leftMargin: 4
+
+ source: model.supplier.icon.url(Qt.size(64, 64), Icon.List)
+ fillMode: Image.PreserveAspectFit
+ }
+
+ Label {
+ anchors.top: icon.top
+ anchors.topMargin: 4
+ anchors.left: icon.right
+ anchors.leftMargin: 4
+ anchors.right: root.right
+ anchors.rightMargin: 4
+
+ text: model.title
+ font.bold: true
+
+ wrapMode: Text.WordWrap
+ elide: Text.ElideRight
+ maximumLineCount: 2
+ }
+
+ RatingView {
+ anchors.bottom: icon.bottom
+ anchors.bottomMargin: 4
+ anchors.left: icon.right
+ anchors.leftMargin: 4
+ anchors.right: root.right
+ anchors.rightMargin: 4
+
+ rating: model.rating
+ size: 16
+ }
+
+ MouseArea {
+ anchors.fill: parent
+ onClicked: showReview()
+ }
+}
diff --git a/examples/location/places/views/ReviewPage.qml b/examples/location/places/views/ReviewPage.qml
new file mode 100644
index 00000000..2fdf3523
--- /dev/null
+++ b/examples/location/places/views/ReviewPage.qml
@@ -0,0 +1,123 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** 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 The Qt Company Ltd 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.5
+import QtLocation 5.5
+import QtQuick.Controls 1.4
+import QtQuick.Layouts 1.2
+
+Item {
+ id: root
+ property variant review
+ width: parent.width
+ height: parent.height
+
+ ScrollView {
+ id: scrollView
+ flickableItem.interactive: true
+ anchors.fill: parent
+ anchors.margins: 15
+
+ ColumnLayout {
+ width: scrollView.width - 30
+ spacing: 10
+
+ Rectangle {
+ anchors.left: parent.left
+ anchors.right: parent.right
+ height: 1
+ color: "#46a2da"
+ }
+
+ Label {
+ text: review.title
+ width: parent.width
+ wrapMode: Text.WordWrap
+ }
+
+ Label {
+ text: Qt.formatDateTime(review.dateTime)
+ width: parent.width
+ Layout.alignment: Qt.AlignHCenter
+ }
+
+ RatingView {
+ size: 16
+ rating: review.rating
+ }
+
+ Label {
+ text: review.text
+ width: parent.width
+ wrapMode: Text.WordWrap
+ Layout.alignment: Qt.AlignHCenter
+ textFormat: Text.RichText
+ }
+
+ Rectangle {
+ anchors.left: parent.left
+ anchors.right: parent.right
+ height: 1
+ color: "#46a2da"
+ }
+
+ Image {
+ Layout.alignment: Qt.AlignHCenter
+ source: review.supplier.icon.url(Qt.size(width, height), Icon.List)
+ }
+
+ Label {
+ text: editorial.supplier.name
+ Layout.alignment: Qt.AlignHCenter
+ wrapMode: Text.WordWrap
+ textFormat: Text.RichText
+ }
+
+ Button {
+ id: button
+ text: qsTr("Open url")
+ Layout.alignment: Qt.AlignHCenter
+ onClicked: {
+ Qt.openUrlExternally(review.supplier.url)
+ }
+ }
+ }
+ }
+}
diff --git a/examples/location/places/views/ReviewView.qml b/examples/location/places/views/ReviewView.qml
new file mode 100644
index 00000000..095f0947
--- /dev/null
+++ b/examples/location/places/views/ReviewView.qml
@@ -0,0 +1,57 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** 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 The Qt Company Ltd 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.5
+import QtLocation 5.5
+
+//! [ReviewModel delegate]
+ListView {
+ id:view
+ property Place place
+ signal showReview(variant review)
+ width: parent.width
+ height: parent.height
+ model: place.reviewModel
+ delegate: ReviewDelegate {
+ onShowReview: view.showReview(model)
+ }
+}
+//! [ReviewModel delegate]
+
diff --git a/examples/location/places/views/SearchResultDelegate.qml b/examples/location/places/views/SearchResultDelegate.qml
new file mode 100644
index 00000000..5d6cb45c
--- /dev/null
+++ b/examples/location/places/views/SearchResultDelegate.qml
@@ -0,0 +1,196 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** 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 The Qt Company Ltd 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.5
+import QtLocation 5.5
+import QtQuick.Controls 1.4
+import QtQuick.Layouts 1.2
+import "../helper.js" as Helper
+
+Item {
+ id: root
+
+ signal showPlaceDetails(variant place,variant distance)
+ signal searchFor(string query)
+
+ width: parent.width
+ height: childrenRect.height
+
+ //! [PlaceSearchModel place delegate]
+ Component {
+ id: placeComponent
+ Item {
+ id: placeRoot
+ width: root.width
+ height: Math.max(icon.height, 3 * placeName.height)
+
+ Rectangle {
+ anchors.fill: parent
+ color: "#44ffffff"
+ visible: mouse.pressed
+ }
+
+ Rectangle {
+ anchors.fill: parent
+ color: "#dbffde"
+ visible: model.sponsored !== undefined ? model.sponsored : false
+
+ Label {
+ text: qsTr("Sponsored result")
+ horizontalAlignment: Text.AlignRight
+ anchors.right: parent.right
+ anchors.bottom: parent.bottom
+ font.pixelSize: 8
+ visible: model.sponsored !== undefined ? model.sponsored : false
+ }
+ }
+
+ GridLayout {
+ rows: 2
+ columns: 2
+ anchors.fill: parent
+ anchors.leftMargin: 30
+ flow: GridLayout.TopToBottom
+
+ Image {
+ // anchors.verticalCenter: parent.verticalCenter
+ id:icon
+ source: place.favorite ? "../../resources/star.png" : place.icon.url()
+ Layout.rowSpan: 2
+ }
+
+ Label {
+ id: placeName
+ text: place.favorite ? place.favorite.name : place.name
+ Layout.fillWidth: true
+ }
+
+ Label {
+ id: distanceText
+ font.italic: true
+ text: Helper.formatDistance(distance)
+ Layout.fillWidth: true
+ }
+ }
+
+ Rectangle {
+ anchors.left: parent.left
+ anchors.right: parent.right
+ anchors.margins: 15
+ height: 1
+ color: "#46a2da"
+ }
+
+ MouseArea {
+ id: mouse
+ anchors.fill: parent
+ onClicked: {
+ if (model.type === undefined || type === PlaceSearchModel.PlaceResult) {
+ if (!place.detailsFetched)
+ place.getDetails();
+ root.showPlaceDetails(model.place, model.distance);
+ }
+ }
+ }
+ }
+ }
+ //! [PlaceSearchModel place delegate]
+
+ Component {
+ id: proposedSearchComponent
+
+ Item {
+ id: proposedSearchRoot
+
+ width: root.width
+ height: Math.max(icon.height, 2 * proposedSearchTitle.height)
+
+ Rectangle {
+ anchors.fill: parent
+ color: "#11ffffff"
+ visible: mouse.pressed
+ }
+
+ RowLayout {
+ anchors.fill: parent
+ anchors.leftMargin: 30
+
+ Image {
+ source: icon.url()
+ }
+
+ Label {
+ id: proposedSearchTitle
+ anchors.verticalCenter: parent.verticalCenter
+ text: "Search for " + title
+ }
+ }
+
+ Rectangle {
+ anchors.left: parent.left
+ anchors.right: parent.right
+ anchors.margins: 15
+ height: 1
+ color: "#46a2da"
+ }
+
+ MouseArea {
+ anchors.fill: parent
+ onClicked: root.ListView.view.model.updateWith(index);
+ }
+ }
+ }
+
+ Loader {
+ anchors.left: parent.left
+ anchors.right: parent.right
+
+ sourceComponent: {
+ switch (model.type) {
+ case PlaceSearchModel.PlaceResult:
+ return placeComponent;
+ case PlaceSearchModel.ProposedSearchResult:
+ return proposedSearchComponent;
+ default:
+ //do nothing, don't assign component if result type not recognized
+ }
+ }
+ }
+}
diff --git a/examples/location/places/views/SearchResultView.qml b/examples/location/places/views/SearchResultView.qml
new file mode 100644
index 00000000..c5151f30
--- /dev/null
+++ b/examples/location/places/views/SearchResultView.qml
@@ -0,0 +1,91 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** 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 The Qt Company Ltd 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.5
+import QtLocation 5.5
+import QtQuick.Controls 1.4
+import QtQuick.Layouts 1.2
+
+//! [PlaceSearchModel place list]
+ListView {
+ id: searchView
+ width: parent.width
+ height: parent.height
+
+ property variant placeSearchModel
+ signal showPlaceDetails(variant place, variant distance)
+ signal showMap()
+
+ model: placeSearchModel
+ delegate: SearchResultDelegate {
+ onShowPlaceDetails: searchView.showPlaceDetails(place, distance)
+ onSearchFor: placeSearchModel.searchForText(query);
+ }
+
+ footer:
+
+ RowLayout {
+ width: parent.width
+
+ Button {
+ text: qsTr("Previous")
+ enabled: placeSearchModel.previousPagesAvailable
+ onClicked: placeSearchModel.previousPage()
+ Layout.alignment: Qt.AlignHCenter
+ }
+
+ Button {
+ text: qsTr("Clear")
+ onClicked: {
+ placeSearchModel.reset()
+ showMap()
+ }
+ Layout.alignment: Qt.AlignHCenter
+ }
+
+ Button {
+ text: qsTr("Next")
+ enabled: placeSearchModel.nextPagesAvailable
+ onClicked: placeSearchModel.nextPage()
+ Layout.alignment: Qt.AlignHCenter
+ }
+ }
+}
+//! [PlaceSearchModel place list]
diff --git a/examples/location/places/views/SuggestionView.qml b/examples/location/places/views/SuggestionView.qml
new file mode 100644
index 00000000..4ae94495
--- /dev/null
+++ b/examples/location/places/views/SuggestionView.qml
@@ -0,0 +1,67 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** 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 The Qt Company Ltd 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.5
+import QtQuick.Controls 1.4
+
+//! [PlaceSearchSuggestionModel view 1]
+ListView {
+ id: suggestionView
+ property variant suggestionModel
+ signal suggestionSelected(string text)
+//! [PlaceSearchSuggestionModel view 1]
+ snapMode: ListView.SnapToItem
+//! [PlaceSearchSuggestionModel view 2]
+ model: suggestionModel
+ delegate: Item {
+ width: parent.width
+ height: label.height * 1.5
+ Label {
+ id: label
+ text: suggestion
+ }
+ MouseArea {
+ anchors.fill: parent
+ onClicked: suggestionSelected(suggestion)
+ }
+ }
+}
+//! [PlaceSearchSuggestionModel view 2]
+