From 118ec5ec8e59d109a52d7c6a9d4740c457a1dc98 Mon Sep 17 00:00:00 2001 From: abcd Date: Thu, 2 Feb 2012 22:00:09 +1000 Subject: Places qml overview Change-Id: Ie9d65c79fa643ef5412e838c262fd9c0cc2687e4 Reviewed-by: Aaron McCarthy --- doc/src/snippets/declarative/places.qml | 47 +++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) (limited to 'doc/src/snippets/declarative/places.qml') 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); -- cgit v1.2.1