1/**************************************************************************** 2** 3** Copyright (C) 2019 The Qt Company Ltd. 4** Contact: https://www.qt.io/licensing/ 5** 6** This file is part of the documentation of the Qt Toolkit. 7** 8** $QT_BEGIN_LICENSE:FDL$ 9** Commercial License Usage 10** Licensees holding valid commercial Qt licenses may use this file in 11** accordance with the commercial license agreement provided with the 12** Software or, alternatively, in accordance with the terms contained in 13** a written agreement between you and The Qt Company. For licensing terms 14** and conditions see https://www.qt.io/terms-conditions. For further 15** information use the contact form at https://www.qt.io/contact-us. 16** 17** GNU Free Documentation License Usage 18** Alternatively, this file may be used under the terms of the GNU Free 19** Documentation License version 1.3 as published by the Free Software 20** Foundation and appearing in the file included in the packaging of 21** this file. Please review the following information to ensure 22** the GNU Free Documentation License version 1.3 requirements 23** will be met: https://www.gnu.org/licenses/fdl-1.3.html. 24** $QT_END_LICENSE$ 25** 26****************************************************************************/ 27 28/*! 29 \example geoflickr 30 \title GeoFlickr (QML) 31 \ingroup qtpositioning-examples 32 33 \brief The GeoFlickr example shows how to use the user's current 34 position to fetch local content from a web service. 35 36 This is a small example, illustrating one of the very core parts 37 of the \l{Qt Positioning} API: the ability to retrieve and use the 38 user's current geographic position. 39 40 Key QML types shown in this example: 41 \list 42 \li \l{QtPositioning::PositionSource}{PositionSource} 43 \li \l{XmlListModel}{XmlListModel} 44 \endlist 45 46 \image qml-flickr-1.jpg 47 48 \include examples-run.qdocinc 49 50 \section1 Retrieving the Current Position 51 52 Retrieving the user's current position is achieved using the PositionSource 53 type. In this example, we instantiate the PositionSource as part 54 of the GeoTab component (the floating "window" describing current 55 position and status). 56 57 \snippet geoflickr/flickrmobile/GeoTab.qml possrc 58 59 When the "Locate and update" button is pressed, we first interrogate 60 the PositionSource to check if it has an available backend for 61 positioning data. If it does not, we fall back to using a pre-recorded 62 NMEA log for demonstration. We then instruct the PositionSource to update. 63 64 \snippet geoflickr/flickrmobile/GeoTab.qml locatebutton-top 65 \snippet geoflickr/flickrmobile/GeoTab.qml locatebutton-clicked 66 67 To share the new position data with the rest of the application, we 68 use properties that we have created on the GeoTab component: 69 70 \snippet geoflickr/flickrmobile/GeoTab.qml props 71 72 \section1 Using the Current Position 73 74 The longitude and latitude values retrieved here are eventually set 75 in the properties on the RestModel component. The RestModel is an 76 XmlListModel, which retrieves XML data from a URL and creates a data 77 model by performing XPath queries on it. 78 79 In this case, it retrieves data from the Flickr REST API online, 80 based on our current position 81 82 \snippet geoflickr/flickrcommon/RestModel.qml restmodel 83 84 This model data is then shown in a variety of Qt Quick views to 85 produce the example application. 86 87*/ 88