summaryrefslogtreecommitdiff
path: root/doc/src/snippets
diff options
context:
space:
mode:
authorabcd <amos.choy@nokia.com>2012-02-02 22:00:09 +1000
committerQt by Nokia <qt-info@nokia.com>2012-02-07 06:12:21 +0100
commit118ec5ec8e59d109a52d7c6a9d4740c457a1dc98 (patch)
tree181688a2734d2f498ff322b10d33a6fcb39675d6 /doc/src/snippets
parenta40be66a9fba7e1c3738b848c4dfd8adeeca54f2 (diff)
downloadqtlocation-118ec5ec8e59d109a52d7c6a9d4740c457a1dc98.tar.gz
Places qml overview
Change-Id: Ie9d65c79fa643ef5412e838c262fd9c0cc2687e4 Reviewed-by: Aaron McCarthy <aaron.mccarthy@nokia.com>
Diffstat (limited to 'doc/src/snippets')
-rw-r--r--doc/src/snippets/declarative/places.qml47
1 files changed, 47 insertions, 0 deletions
diff --git a/doc/src/snippets/declarative/places.qml b/doc/src/snippets/declarative/places.qml
index 0fdcdd8b..ed16db0c 100644
--- a/doc/src/snippets/declarative/places.qml
+++ b/doc/src/snippets/declarative/places.qml
@@ -46,9 +46,12 @@ import QtLocation 5.0
//! [QtLocation import]
Item {
+ //! [Initialize Plugin]
Plugin {
id: myPlugin
+ name: "nokia"
}
+ //! [Initialize Plugin]
Place {
id: place
@@ -253,12 +256,56 @@ Item {
}
//! [Place savePlace def]
+
+ //! [Search MapItemView]
+ MapItemView {
+ model: searchModel
+ delegate: MapQuickItem {
+ coordinate: place.location.coordinate
+
+ anchorPoint.x: image.width * 0.5
+ anchorPoint.y: image.height
+
+ sourceItem: Image {
+ id: image
+ source: "marker.png"
+ }
+ }
+ }
+ //! [Search MapItemView]
+
+ function fetchDetails() {
+ //! [Place fetchDetails]
+ if (!place.detailsFetched)
+ place.getDetails();
+ //! [Place fetchDetails]
+ }
+
function savePlace() {
//! [Place savePlace]
myPlace.save();
//! [Place savePlace]
}
+ function createAndSavePlace() {
+ //! [Place createAndSavePlace]
+ //creating and saving a place
+ var place = Qt.createQmlObject('import QtLocation 5.0; Place { }', parent);
+ place.plugin = myPlugin;
+ place.name = "New York";
+ place.location.coordinate.latitude = 40.7
+ place.location.coordinate.longitude = -74.0
+ place.save();
+ //! [Place createAndSavePlace]
+ }
+
+ function removePlace() {
+ //! [Place removePlace]
+ //removing a place
+ place.remove();
+ //! [Place removePlace]
+ }
+
function saveToNewPlugin() {
//! [Place save to different plugin]
place = Qt.createQmlObject('import QtLocation 5.0; Place { }', parent);