summaryrefslogtreecommitdiffstats
path: root/examples/location/places/views
diff options
context:
space:
mode:
authorMichal Klocek <michal.klocek@theqtcompany.com>2015-05-13 11:47:14 +0200
committerAlex Blasche <alexander.blasche@theqtcompany.com>2015-05-29 14:08:57 +0000
commitf49cff62775b6699a6a2edcdcfe0c9f6b3ecc7d2 (patch)
tree2545df35f0867facc8b96a5c637fa95f4b4aee84 /examples/location/places/views
parente396c1908dd1b06f4139db4179890de3bdb5ab95 (diff)
Fix documenation in 'places' example
Change-Id: Id224d73d2b68a947bc6c7121175a2f83bd0059fa Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
Diffstat (limited to 'examples/location/places/views')
-rw-r--r--examples/location/places/views/CategoryDelegate.qml27
-rw-r--r--examples/location/places/views/CategoryView.qml20
2 files changed, 21 insertions, 26 deletions
diff --git a/examples/location/places/views/CategoryDelegate.qml b/examples/location/places/views/CategoryDelegate.qml
index 2ac0a339..75f7060e 100644
--- a/examples/location/places/views/CategoryDelegate.qml
+++ b/examples/location/places/views/CategoryDelegate.qml
@@ -45,15 +45,14 @@ import QtLocation 5.5
Item {
id: root
- property alias text: textItem.text
+ property alias text: labelItem.text
property bool checked: false
signal searchCategory()
- signal showSubcategory()
+ signal showSubcategories()
width: parent.width
- height: Math.max(icon.height, textItem.height * 2)
+ height: Math.max(icon.height, labelItem.height * 2)
- //! [CategoryModel delegate icon]
Image {
id: icon
anchors.left: parent.left
@@ -61,7 +60,6 @@ Item {
anchors.verticalCenter: parent.verticalCenter
source: category.icon.url()
}
- //! [CategoryModel delegate icon]
Rectangle {
anchors.fill: parent
@@ -71,12 +69,18 @@ Item {
//! [CategoryModel delegate text]
Label {
- id: textItem
+ id: labelItem
text: category.name
anchors.left: icon.right
anchors.verticalCenter: parent.verticalCenter
anchors.right: arrow.left
}
+
+ MouseArea {
+ id: mouse
+ anchors.fill: parent
+ onClicked: root.searchCategory()
+ }
//! [CategoryModel delegate text]
Rectangle {
@@ -86,13 +90,7 @@ Item {
height: 1
color: "#46a2da"
}
-
- MouseArea {
- id: mouse
- anchors.fill: parent
- onClicked: root.searchCategory()
- }
-
+ //! [CategoryModel delegate arrow]
ToolButton {
id: arrow
anchors.right: parent.right
@@ -100,6 +98,7 @@ Item {
anchors.rightMargin: 15
visible: model.hasModelChildren
iconSource: "../../resources/right.png"
- onClicked: root.showSubcategory()
+ onClicked: root.showSubcategories()
}
+ //! [CategoryModel delegate arrow]
}
diff --git a/examples/location/places/views/CategoryView.qml b/examples/location/places/views/CategoryView.qml
index d476300a..b17f3e79 100644
--- a/examples/location/places/views/CategoryView.qml
+++ b/examples/location/places/views/CategoryView.qml
@@ -40,32 +40,28 @@
import QtQuick 2.5
import QtLocation 5.5
+import QtQml.Models 2.1
-//! [CategoryModel view 1]
+//! [CategoryModel view]
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]
+ signal showSubcategories(variant index)
-//! [CategoryModel view 2]
+ snapMode: ListView.SnapToItem
-//! [CategoryModel view 3]
- model: VisualDataModel {
- id: visalDataModel
+ model: DelegateModel {
+ id: delegeteDataModel
model: root.categoryModel
rootIndex: root.rootIndex
delegate: CategoryDelegate {
onSearchCategory: root.searchCategory(category);
- onShowSubcategory: root.enterCategory(visalDataModel.modelIndex(index))
+ onShowSubcategories: root.showSubcategories(delegeteDataModel.modelIndex(index))
}
}
}
-//! [CategoryModel view 3]
+//! [CategoryModel view]