diff options
| author | abcd <qt-info@nokia.com> | 2010-07-02 15:48:59 +1000 |
|---|---|---|
| committer | abcd <qt-info@nokia.com> | 2010-07-02 15:48:59 +1000 |
| commit | e17d69a753fd5336f51d080a77b0bb3990974513 (patch) | |
| tree | 78674c8adfb1252a14025c804eeb89ab22f02f18 /doc/src/snippets/qtlandmarksdocsample/qtlandmarksdocsample.cpp | |
| parent | 6765f2d62f549a2e9c0958f9e24859c0b629d4b0 (diff) | |
Improve QLandmarkManager documentation
Diffstat (limited to 'doc/src/snippets/qtlandmarksdocsample/qtlandmarksdocsample.cpp')
| -rw-r--r-- | doc/src/snippets/qtlandmarksdocsample/qtlandmarksdocsample.cpp | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/doc/src/snippets/qtlandmarksdocsample/qtlandmarksdocsample.cpp b/doc/src/snippets/qtlandmarksdocsample/qtlandmarksdocsample.cpp index d6d9a86012..7cb25fb43b 100644 --- a/doc/src/snippets/qtlandmarksdocsample/qtlandmarksdocsample.cpp +++ b/doc/src/snippets/qtlandmarksdocsample/qtlandmarksdocsample.cpp @@ -319,6 +319,16 @@ void addLandmarkAndCategory(QLandmarkManager *lm) lm->saveLandmark(&monks); //lm is a QLandmarkManager* //! [Add landmark synchronously] + + { + QLandmarkManager *landmarkManager; + //! [Add landmark synchronously simple] + QLandmark monks; + monks.setName("Monk's cafe"); + //.. + landmarkManager->saveLandmark(&monks); + //! [Add landmark synchronously simple] + } } void categoryFetch(QLandmarkManager *lm) @@ -336,6 +346,13 @@ void categoryFetch(QLandmarkManager *lm) qDebug() << "Found category: " << category.name(); } //! [Retrieve categories synchronously] + + { + QLandmarkManager *landmarkManager; + //! [Retrieve categories synchronously simple] + QList<QLandmarkCategory> categories = landmarkManager->categories(); + //! [Retrieve categories synchronously simple] + } } void landmarkFetch(QLandmarkManager *lm) @@ -361,6 +378,30 @@ void landmarkFetch(QLandmarkManager *lm) qDebug() << "Found landmark:" << landmark.name(); } //! [Retrieve landmarks synchronously] + + { + QLandmarkManager *landmarkManager; + //! [Retrieve landmarks by proximity synchronously] + QGeoCoordinate coordinate(54.0, 23.1); + + QLandmarkProximityFilter filter; + filter.setCoordinate(coordinate); + filter.setRadius(5000); + + QLandmarkDistanceSort distanceSort; + distanceSort.setCoordinate(coordinate); + distanceSort.setDirection(Qt::AscendingOrder); + + QLandmarkFetchHint fetchHint; + fetchHint.setMaxItems(5); + + landmarkManager->landmarks(filter, sortOrder, fetchHint); + //! [Retrieve landmarks by proximity synchronously] + + //! [Retrieve all landmarks synchronously] + landmarkManager->landmarks(); + //! [Retrieve all landmarks synchronously] + } } void filterByName(QLandmarkManager *lm) @@ -418,12 +459,34 @@ void deleteLandmarkAndCategory(QLandmarkManager *lm) //landmark is a previously retrieved QLandmark object lm->removeLandmark(landmark.landmarkId()); //! [Remove landmark synchronously] + + { + QLandmarkManager *landmarkManager; + //! [Remove landmark synchronously simple] + landmarkManager->removeLandmark(landmark.landmarkId()); + //! [Remove landmark synchronously simple] + } +} + +void importExportLandmark() { + QLandmarkManager *landmarkManager; + //! [ImportExport landmark simple] + landmarkManager->importLandmarks("places.gpx"); + + landmarkManager->exportLandmarks("myplaces.gpx"); + //! [ImportExport landmark simple] } int main(int argc, char *argv[]) { QCoreApplication app(argc, argv); QLandmarkManager *lm = new QLandmarkManager(); + + //! [Instantiate default QLandmarkManager] + QLandmarkManager *landmarkManager = new QLandmarkManager(); + //! [Instantiate default QLandmarkManager] + Q_UNUSED(landmarkManager); + //Synchronous API examples addLandmarkAndCategory(lm); categoryFetch(lm); |
