diff options
10 files changed, 42 insertions, 42 deletions
diff --git a/examples/positioning/CMakeLists.txt b/examples/positioning/CMakeLists.txt index a07ff1c5..414fc99a 100644 --- a/examples/positioning/CMakeLists.txt +++ b/examples/positioning/CMakeLists.txt @@ -6,10 +6,9 @@ endif() if(TARGET Qt::Quick) add_subdirectory(satelliteinfo) endif() -# TODO: enable when the XmlListModel is ported -# if(TARGET Qt::Quick AND TARGET Qt::XmlPatterns) -# add_subdirectory(geoflickr) -# endif() +if(TARGET Qt::Quick) + add_subdirectory(geoflickr) +endif() if(TARGET Qt::Network AND TARGET Qt::Quick) add_subdirectory(weatherinfo) endif() diff --git a/examples/positioning/geoflickr/CMakeLists.txt b/examples/positioning/geoflickr/CMakeLists.txt index b9fdeb85..52d020a5 100644 --- a/examples/positioning/geoflickr/CMakeLists.txt +++ b/examples/positioning/geoflickr/CMakeLists.txt @@ -21,7 +21,6 @@ find_package(Qt6 COMPONENTS Qml) find_package(Qt6 COMPONENTS Quick) find_package(Qt6 COMPONENTS Network) find_package(Qt6 COMPONENTS Positioning) -find_package(Qt6 COMPONENTS XmlPatterns) qt_add_executable(geoflickr qmllocationflickr.cpp @@ -37,7 +36,6 @@ target_link_libraries(geoflickr PRIVATE Qt::Positioning Qt::Qml Qt::Quick - Qt::XmlPatterns ) diff --git a/examples/positioning/geoflickr/doc/src/geoflickr.qdoc b/examples/positioning/geoflickr/doc/src/geoflickr.qdoc index 14d6e88a..86ec61f4 100644 --- a/examples/positioning/geoflickr/doc/src/geoflickr.qdoc +++ b/examples/positioning/geoflickr/doc/src/geoflickr.qdoc @@ -39,8 +39,8 @@ Key QML types shown in this example: \list - \li \l{QtPositioning::PositionSource}{PositionSource} - \li \l{XmlListModel}{XmlListModel} + \li \l {QtPositioning::PositionSource} {PositionSource} + \li \l [QML] {XmlListModel} \endlist \image qml-flickr-1.jpg @@ -49,39 +49,40 @@ \section1 Retrieving the Current Position - Retrieving the user's current position is achieved using the PositionSource - type. In this example, we instantiate the PositionSource as part - of the GeoTab component (the floating "window" describing current - position and status). + Retrieving the user's current position is achieved using the + \l PositionSource type. In this example, we instantiate the + \l PositionSource as part of the \c GeoTab component (the floating "window" + describing current position and status). \snippet geoflickr/flickrmobile/GeoTab.qml possrc When the "Locate and update" button is pressed, we first interrogate - the PositionSource to check if it has an available backend for + the \l PositionSource to check if it has an available backend for positioning data. If it does not, we fall back to using a pre-recorded - NMEA log for demonstration. We then instruct the PositionSource to update. + NMEA log for demonstration. We then instruct the \l PositionSource to + request a location \l {QtPositioning::PositionSource::}{update}. \snippet geoflickr/flickrmobile/GeoTab.qml locatebutton-top \snippet geoflickr/flickrmobile/GeoTab.qml locatebutton-clicked To share the new position data with the rest of the application, we - use properties that we have created on the GeoTab component: + use properties that we have created on the \c GeoTab component: \snippet geoflickr/flickrmobile/GeoTab.qml props \section1 Using the Current Position The longitude and latitude values retrieved here are eventually set - in the properties on the RestModel component. The RestModel is an - XmlListModel, which retrieves XML data from a URL and creates a data - model by performing XPath queries on it. + in the properties on the \c RestModel component. The \c RestModel is an + \l [QML] {XmlListModel}, which retrieves XML data from a URL and creates a + data model by parsing it. In this case, it retrieves data from the Flickr REST API online, based on our current position \snippet geoflickr/flickrcommon/RestModel.qml restmodel - This model data is then shown in a variety of Qt Quick views to + This model data is then shown in a variety of \l {Qt Quick} views to produce the example application. */ diff --git a/examples/positioning/geoflickr/flickr.qml b/examples/positioning/geoflickr/flickr.qml index 45cfb440..8c975e38 100644 --- a/examples/positioning/geoflickr/flickr.qml +++ b/examples/positioning/geoflickr/flickr.qml @@ -49,7 +49,7 @@ ****************************************************************************/ import QtQuick 2.0 -import QtQuick.XmlListModel 2.0 +import QtQml.XmlListModel import "flickrcommon" as Common import "flickrmobile" as Mobile @@ -119,7 +119,7 @@ Item { } Connections { target: imageDetails - onClosed: { + function onClosed() { if (background.state == "DetailedView") { background.state = ''; imageDetails.photoUrl = ""; diff --git a/examples/positioning/geoflickr/flickrcommon/Progress.qml b/examples/positioning/geoflickr/flickrcommon/Progress.qml index f8388b5b..36faffbc 100644 --- a/examples/positioning/geoflickr/flickrcommon/Progress.qml +++ b/examples/positioning/geoflickr/flickrcommon/Progress.qml @@ -51,7 +51,7 @@ import QtQuick 2.0 Item { - property variant progress: 0 + property real progress: 0 Rectangle { anchors.fill: parent; smooth: true diff --git a/examples/positioning/geoflickr/flickrcommon/RestModel.qml b/examples/positioning/geoflickr/flickrcommon/RestModel.qml index ad9f4dcf..56cd4e84 100644 --- a/examples/positioning/geoflickr/flickrcommon/RestModel.qml +++ b/examples/positioning/geoflickr/flickrcommon/RestModel.qml @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2017 The Qt Company Ltd. +** Copyright (C) 2021 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the examples of the Qt Toolkit. @@ -48,12 +48,11 @@ ** ****************************************************************************/ -import QtQuick 2.0 -import QtQuick.XmlListModel 2.0 +import QtQml.XmlListModel //! [restmodel] XmlListModel { - property variant coordinate + property var coordinate source: "https://api.flickr.com/services/rest/?" + "min_taken_date=2000-01-01+0:00:00&" + @@ -65,11 +64,11 @@ XmlListModel { "lat=" + coordinate.latitude + "&lon=" + coordinate.longitude; query: "/rsp/photos/photo" - XmlRole { name: "title"; query: "@title/string()" } - XmlRole { name: "datetaken"; query: "@datetaken/string()" } - XmlRole { name: "farm"; query: "@farm/string()" } - XmlRole { name: "server"; query: "@server/string()" } - XmlRole { name: "id"; query: "@id/string()" } - XmlRole { name: "secret"; query: "@secret/string()" } + XmlListModelRole { name: "title"; elementName: ""; attributeName: "title" } + XmlListModelRole { name: "datetaken"; elementName: ""; attributeName: "datetaken" } + XmlListModelRole { name: "farm"; elementName: ""; attributeName: "farm" } + XmlListModelRole { name: "server"; elementName: ""; attributeName: "server" } + XmlListModelRole { name: "id"; elementName: ""; attributeName: "id" } + XmlListModelRole { name: "secret"; elementName: ""; attributeName: "secret" } } //! [restmodel] diff --git a/examples/positioning/geoflickr/flickrcommon/ScrollBar.qml b/examples/positioning/geoflickr/flickrcommon/ScrollBar.qml index f9614681..4c6c21c9 100644 --- a/examples/positioning/geoflickr/flickrcommon/ScrollBar.qml +++ b/examples/positioning/geoflickr/flickrcommon/ScrollBar.qml @@ -53,7 +53,7 @@ import QtQuick 2.0 Item { id: container - property variant flickableArea + property var flickableArea Rectangle { radius: 5 diff --git a/examples/positioning/geoflickr/flickrmobile/GeoTab.qml b/examples/positioning/geoflickr/flickrmobile/GeoTab.qml index 59dacc21..4a9a4aba 100644 --- a/examples/positioning/geoflickr/flickrmobile/GeoTab.qml +++ b/examples/positioning/geoflickr/flickrmobile/GeoTab.qml @@ -49,13 +49,13 @@ ****************************************************************************/ import QtQuick 2.0 -import QtPositioning 5.2 +import QtPositioning Rectangle { id: container property int maxX: parent.width; property int maxY: parent.height //! [props] - property variant coordinate + property var coordinate //! [props] Binding { @@ -105,6 +105,11 @@ Rectangle { onPositionChanged: { planet.source = "images/sun.png"; } onSourceErrorChanged: { + if (sourceError == PositionSource.UpdateTimeoutError) { + activityText.fadeOut = true + return + } + if (sourceError == PositionSource.NoError) return @@ -112,10 +117,6 @@ Rectangle { activityText.fadeOut = true stop() } - - onUpdateTimeout: { - activityText.fadeOut = true - } } //! [possrc] function printableMethod(method) { diff --git a/examples/positioning/geoflickr/flickrmobile/GridDelegate.qml b/examples/positioning/geoflickr/flickrmobile/GridDelegate.qml index 5ed0db57..6d1e39c8 100644 --- a/examples/positioning/geoflickr/flickrmobile/GridDelegate.qml +++ b/examples/positioning/geoflickr/flickrmobile/GridDelegate.qml @@ -83,7 +83,9 @@ Connections { target: toolBar - onButton2Clicked: if (scaleMe.state == 'Details' ) scaleMe.state = 'Show' + function onButton2Clicked() { + if (scaleMe.state == 'Details' ) scaleMe.state = 'Show' + } } states: [ diff --git a/examples/positioning/geoflickr/flickrmobile/ImageDetails.qml b/examples/positioning/geoflickr/flickrmobile/ImageDetails.qml index 58c924b0..10c0dad9 100644 --- a/examples/positioning/geoflickr/flickrmobile/ImageDetails.qml +++ b/examples/positioning/geoflickr/flickrmobile/ImageDetails.qml @@ -54,11 +54,11 @@ import "../flickrcommon" as Common Flipable { id: container - property variant frontContainer: containerFront + property var frontContainer: containerFront property string photoTitle: "" property string photoDate property string photoUrl - property variant prevScale: 1.0 + property real prevScale: 1.0 signal closed |