summaryrefslogtreecommitdiff
path: root/examples
Commit message (Collapse)AuthorAgeFilesLines
* Polygons/lines can now be rendered following the shortest path on the globeMatthias Rauter2023-04-116-7/+30
| | | | | | | | | | | | | | | | | | | | | | This is enabled by interpolating the lines of polygons and paths. The interpolating is done following the greater circle navigation and the connection between corners of the polygon appear curved on the projected map. This behavior can be turned on by setting a new property, called referenceSurface. It can be set to ReferenceSurface.Map, drawing paths as lines on the map or to ReferenceSurface.Globe, drawing path on the globe leading to curves on the map. It is set to ReferenceSurface.Map on default, reproducing the old implementation for polygons, polylines and rectangles. The circle item was already using the great circle path before this change. Its standard implementation was changed to draw a circle in map coordinates with approximated radius. This should be sufficient for many cases. To get the old implementation, referenceSurface has to be set to ReferenceSurface.Map. Fixes: QTBUG-94785 Change-Id: Ifdd1597a7116c3d220462f063656b04becb6422f Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Allow zoom/pan/tilt with mouse on WaylandShawn Rutledge2023-04-061-2/+3
| | | | | | | | | | | | | | This is redundant when you're using a touchpad that can provide the pinch-zoom feature; but so far we are not distinguishing mice and touchpads on Wayland. So in case the device that claims to be a touchpad is actually just a mouse, the user needs some way to zoom, pan and tilt. This can be reverted when QTBUG-112432 is fixed. Pick-to: 6.5 Task-number: QTBUG-112394 Task-number: QTBUG-112432 Change-Id: Ie339e3c1d7d0b1d5b6383d8e7f8fd1cdcb462db6 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* MapView: add bearing / tilt wheel functionality; also with Magic MouseBen Fletcher2023-04-061-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | In Qt 5, Map had bearing / tilt mouse wheel functionality with keyboard modifiers; that feature is now restored. We allow the wheel to zoom, to change the bearing if the Shift key is held, or to change the tilt if the Control key is held. This is redundant when you're using a touchpad that can provide the pinch-zoom feature; but we need it with the Magic Mouse on macOS, because the cocoa plugin can't distinguish it from a trackpad, even though it can't provide the pinch gesture. So we enable these features for both mouse and touchpad devices on macOS. Also allow mouse and touchpad with the minimal_map example. There's a similar issue on Wayland, but let's try to fix the Wayland plugin to distinguish these devices properly. Pick-to: 6.5 Task-number: QTBUG-87646 Task-number: QTBUG-112394 Change-Id: I9e516a52e941b0b05cd0114afafde2767d80f4ff Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* map viewer/places examples: Brush up the codeFriedemann Kleint2023-03-075-93/+83
| | | | | | | | | | | | | | | | | | | | - Use modern string literals - Use the variadic template version of QMetaObject::invokeMethod() - Use modern connect syntax - Reorder includes - Trim newlines in QML Fix minor bugs: - Skip empty elements of library path (namely when variable is not set) - Fix the check for osm.useragent to operate on the map - Exit cleanly on QML loading errors Since places uses similar code, apply the changes there as well. Pick-to: 6.5 6.5.0 Change-Id: Ibaeffc6e003c55c458137458c5017584e0c072f1 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Examples: Fix qmake buildFriedemann Kleint2023-03-075-5/+4
| | | | | | | | | Fix the resources and remove C++ 11. Pick-to: 6.5 6.5.0 Change-Id: I1141594eae239b32b3c00663f2e0d78ec00421fd Reviewed-by: Matthias Rauter <matthias.rauter@qt.io> Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Doc: Fix links and snippetsVolker Hilsheimer2023-03-064-10/+5
| | | | | | | | | | | | | | | Add modules in which linked-to types live to the qdoc dependencies, fix links, and adapt snippets to changes in the examples (and add tags to quoted files as needed). This makes the documentation generate without warnings, so set the warninglimit to 0 as well to block future regressions. Pick-to: 6.5 6.5.0 Change-Id: I43fdfce1087c2a35212f91b41bba1ff9481e609d Reviewed-by: Matthias Rauter <matthias.rauter@qt.io> Reviewed-by: Andreas Eliasson <andreas.eliasson@qt.io> Reviewed-by: <safiyyah.moosa@qt.io>
* Update Mapviewer exampleMatthias Rauter2023-03-0116-327/+68
| | | | | | | | | | | | Removed MapItems and argument parsing for old plugins. Replaced some circles with markers. Updated documentation and resources. Pick-to: 6.5 Change-Id: I2c33d33d52ba2f5c1c81f444e8b414a4349dc505 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Add documentation for GeoJson Viewer exampleMatthias Rauter2023-03-019-62/+308
| | | | | | | | Some code has been changed to make the documentation clearer. Pick-to: 6.5 Change-Id: Icae03a7babc7e40d10cbdca5bfa81d3ab8efbd86 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Minimal updates to Places Map example documentationMatthias Rauter2023-03-012-2/+2
| | | | | | Pick-to: 6.5 Change-Id: Ie3d18d1f9ac4beed2ec3e00f171a5fc80404455f Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Remove unsupported plugin parameters from places exampleMatthias Rauter2023-03-011-18/+0
| | | | | | Pick-to: 6.5 Change-Id: I31641784ecc06711a06fafa650631fb3e4da8f45 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Replace MouseArea with TapHandler in Planespotter exampleMatthias Rauter2023-03-012-7/+5
| | | | | | Pick-to: 6.5 Change-Id: Ib5e02e914090a22183230cdd128fbcba608d82fc Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Add drawing of mapItems to GeoJson viewer exampleMatthias Rauter2023-02-228-5/+279
| | | | | | Pick-to: 6.5 Change-Id: I362acbb6a428e83c3490742824b54aa68890c47f Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Improve documentation and fix warnings and examplesVolker Hilsheimer2023-02-212-11/+2
| | | | | | | | | | | | | - Waypoint was removed in bf12a34712d14d382b410b5ba5154eba90963675, so remove the documentation for the QML type - document the icon QML type from the Places module - remove dead code from example - adjust snippet quoting to changes - fix some qdoc warnings Pick-to: 6.5 Change-Id: I8ee2b55d8a48afa6f700be1edab06f2364c6ff04 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Update location examples to work with MapView/HandlersShawn Rutledge2023-02-2023-505/+470
| | | | | | | | | | | | | | | | MapView replaces Map in the examples to reintroduce event handling. Some of the functionality is still in mapview.map and the code has to be adjusted respectivly. The following examples are affected: mapviewer, places, places_map. The mapviewer example has a new menu to draw mapitems. The places example draws places icons instead of a fixed marker. Fixes: QTBUG-111005 Change-Id: I15ca2b3d3ecb7c35684b9fd4c2b7a86249add11c Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Use new handler API in GeoJson Viewer exampleMatthias Rauter2023-02-141-5/+36
| | | | | | Pick-to: 6.5 Change-Id: I8408c37a2692e93dd420c558147071d07d85523f Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Use SPDX license identifiersVolker Hilsheimer2023-02-0285-4007/+173
| | | | | | | Task-number: QTBUG-67283 Pick-to: 6.5 Change-Id: I4b8f877cc355c7c6cd410b3b1683defa58486381 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Fix small inconsistencies in the example places_mapMatthias Rauter2023-01-312-19/+12
| | | | | | | | | | Change the search radius in example places_map to get a reasonable amount of results. Replace search term pizza with food to get a reasonable amount of results within 1km radius. Cleaned up some code and replaced static values with bindings. Pick-to: 6.5 Change-Id: I51aedadaf46a1576d033178ec8c0b94222dffca7 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Fix small inconsistencies in the example places_listMatthias Rauter2023-01-312-3/+3
| | | | | | | | | Chang the search radius in example places_list to match the comment. Replace search term pizza with food to get a reasonable amount of results within 5km radius. Pick-to: 6.5 Change-Id: Ibf8a97afb85c80e8cd9b646f2c82d41a836359d2 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Add MapViewShawn Rutledge2023-01-282-13/+59
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This has nearly complete functionality now. A couple of approaches were possible: one way is to have the Map larger than the MapView, so that the MapView defines a viewport. This allows the handlers to function more "normally": DragHandler already knows how to move the Map in the viewport, etc. But then you can pan off the edge of the Map; so we needed a recenter() function to calculate and set the map.center property, and call that at the right times. This needs to be done when the MapView is resized too, and that turned out to be tricky to get right. Another advantage though would be that we could ensure Map doesn't re-generate geometry any more often than necessary: small changes to the center and scale of the map would often merely change one QSGTransformNode. We could still try this approach again later on, but perhaps Map should be doing more of the work to make it possible; and the new ItemObservesViewport flag ought to be useful. But for now, we do it the existing way: Map does its own viewporting. Thus, we assume that Map is optimized to limit geometry re-generation internally. In practice, redrawing while executing a pinch gesture feels fast enough. One of the main reasons we needed the recent changes in handlers is to get deltas. We cannot use bindings directly from handler properties to Map properties, because there are multiple ways to modify each property (you can zoom by pinch or wheel in MapView, and probably via a keyboard shortcut in the application), so we need to increment the zoomLevel and bearing properties rather than binding them. When it comes to panning: instead of a property, Map has a pan(dx, dy) invokable function; so we call that in response to the DragHandler.translationChanged signal, which now carries a delta-vector argument. The alignCoordinateToPoint() function turned out to be ideal to make the pinch gesture zoom into and rotate the map around the centroid (the point between the touchpoints). Since we call that function when either the rotation or scale changes, we do not need an onTranslationChanged(), because you can't do a pinch gesture that only pans without also changing scale and rotation slightly. All three signals are firing constantly, so handling two of them is enough. The Vector3dAnimation turned out to be a good fit to get flicking momentum (let the panning continue a little while after the finger is released); needing to use the pan() function here is a little clumsy, but we can live with it. Handlers and Animations would both prefer to set properties directly. But if there were a property, it would tend to have type QVector2D or QPointF, and the Vector3dAnimation wouldn't know how to set it anyway (but that could be hacked in, or we could write a Vector2dAnimation). Calculating the limits for zooming seems to be tricky: Map.minimumZoomLevel is zero, but in practice the minimum zoom depends on the size (because we cannot zoom out so far that the map no longer fills the viewport, but if the viewport is smaller, then you can zoom out further). So PinchHandler currently limits the max zoom fairly well, but when you try to zoom out too far, it is Map rather than PinchHandler that applies its own runtime limit. That makes PinchHandler.persistentScale useless; but now PinchHandler applies only incremental zoom deltas, so it doesn't matter. But WheelHandler cannot apply limits on its own, so currently it lets you zoom in too far. Map stops you from zooming past level 30, which is strange, since it already knows that OSM maps are limited to level 18. So either we need to figure out how to calculate both the min and max accurately so that we can apply BoundaryRule (which will also replace the use of PinchHandler's own limits, and will depend on a fix for PinchHandler to work with BoundaryRule), or we can get Map to enforce the lower limit: 18 instead of 30. A little bit of zooming beyond 18 is ok (for example to 20), but if you go even further, the rendering suddenly disappears. This could be done in a followup patch, and a couple of autotests need fixing then. The incremental zooming is treated as base-2-logarithmmic, although that's an approximation: https://wiki.openstreetmap.org/wiki/Zoom_levels tells us that sometimes one zoom level corresponds exactly to zooming 2X, but going from zoom level 16 to 15 is an 8:15 ratio. It's close enough to feel smooth anyway; and it turns out that Map is rendering fractional zoom levels well enough already. If that were not the case, we'd need to bring the Item.scale property into play. Now that the Map is the same size as the MapView, we have a choice whether the root of MapView should be a wrapper Item or not. The root could be Map itself, with handlers inside; the upside would be that all Map properties are left exposed. The downsides would be losing the opportunity to go back to the other architecture later on (with the root defining a viewport, and rendering a larger map inside, but re-rendering less often), and losing the opportunity to make the view's minimumZoomLevel and maximumZoomLevel different than those in Map itself. As explained above, minimumZoomLevel should depend on viewport size. So perhaps it's better to keep it like this: we have control over which Map properties to expose directly, and for the rest, the user can bind to things like mapview.map.center instead of mapview.center. The geojson example is updated to use MapView, whereas minimal_map applies its own handlers to the Map. Other examples still need updating. [ChangeLog][MapView] MapView is the interactive replacement for the Map item in earlier releases. It wraps a Map instance with pointer handlers to make it interactive. Pick-to: 6.5 Fixes: QTBUG-68108 Change-Id: Ibf6bcf71fa7588fcf8cf117e213f35cebd105639 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Remove map item backend switchLaszlo Agocs2022-11-302-11/+0
| | | | | Change-Id: Ic1ed064269ac73e68d0358b373ea1e8048a1c241 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Documentation fixesVolker Hilsheimer2022-11-282-6/+5
| | | | | | | | | | | | Correct spelling of and links to QML value types and to properties of value types. Remove some documentation and snippets that are mostly outdated, and links to specific plugin providers. Silence some warnings. Task-number: QTBUG-96795 Change-Id: Ifba3ae8144e0d949f1c72a4ea230e7f84fa28bd4 Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* Remove missing file from geojson exampleVolker Hilsheimer2022-11-241-1/+0
| | | | | Change-Id: Ib5b7466cfd3ae20ebfb8615b7f9b10323b2fc1b7 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Polyline: Remove unused backend enum valuesLaszlo Agocs2022-11-151-1/+1
| | | | | | | Have just what is in the other items (Software, OpenGL). Change-Id: I3a8b387fb7a98c9e5580a22cb8af3568c1849434 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Get the geojson example working againShawn Rutledge2022-11-156-193/+9
| | | | | | | | | | | | | | | | | | fdbbfa4a6723b816478ee011ab4098e5332dc2f5 removed MapObjectView, but this example continued to depend on it. This reverts parts of commit be7cbed7411d024d178377bd327d5916c80e02a0. Also: - use QtCore.StandardPaths rather than Qt.labs.platform - remove the widgets dependency - use FileDialog.nameFilters to read and write geojson files Let's assume that FileDialog.selectedFile will actually output a QUrl to save the file to, as opposed to a plain path, since the dumpGeoJSON() function is calling toLocalFile() on it. At least that works with native dialogs. Task-number: QTBUG-108455 Change-Id: I1f14c6425115aa95ac2080438ff0c3a24b1b7196 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Android: use string based location permission callsAssam Boudjelthia2022-11-141-1/+3
| | | | | | | | | Amends ef935f6e37a24f52255e6696b85a0fa9aaa7361a. Go back to string based calls until the new permissions API is fully used. Change-Id: If3c1d63ac0267e820fec89dc63cf801022c1f84a Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
* Fix typo in exampleVolker Hilsheimer2022-10-101-1/+1
| | | | | | | | Amend d8f03e5e71de3d951f86f0b0413fd75d554b2039. Change-Id: I4b2c652f73d1fd5fb5ffecc621f0a7e94fb70498 Reviewed-by: Santhosh Kumar <santhosh.kumar.selvaraj@qt.io> Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
* GeoJSON: don't crash when operating on empty dataVolker Hilsheimer2022-09-221-1/+4
| | | | | | | | | Fix crashes in "geojson_viewer" example when trying to print or store debug data without loading a file first. Change-Id: I7b2955d072af8d2a1f39bfca196ffc309e9b4234 Reviewed-by: Alex Blasche <alexander.blasche@qt.io> Reviewed-by: Santhosh Kumar <santhosh.kumar.selvaraj@qt.io>
* Port place example from qtquick1 to qtquick2Santhosh Kumar2022-09-2124-183/+195
| | | | | | | | | Modified places (location/examples/location/place) example to use qtquick control 2 and its properties. Fixes: QTBUG-105827 Change-Id: I78ddd50655bc914fdc10002caed154ee5aa19bcf Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Fix mapviewer example issues and modernize codeVolker Hilsheimer2022-09-2011-131/+159
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Move the example away from imperative coding style, and fix code that didn't following Qt 6 practices or caused warnings to be emitted to the console: Populate all menus consistently through items that bind their enabled state to relevant properties. This avoids that we have to clear and recreate the menus when switching provider. Don't print debug output when updating the position of the minimap. Capture parameters of signals correctly in the handlers. Fix some UI issues: We cannot replace the background of a styled button, so use AbstractButton instead, otherwise the example will generate runtime warnings with some styles, e.g. qrc:/qt-project.org/imports/QtQuick/Controls/macOS/Button.qml:44: TypeError: Property 'styleFont' of object QQuickRectangle(0x7fdfaa4e7bd0) is not a function Also don't squeeze the sliders by setting the spacing to -10, styled sliders will overlap, and don't use anchors on items managed by layouts. Change-Id: I118a52ae3d2ece77c662fd42bb868c9bbcf30e7a Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Don't use deprecated APIs in examplesVolker Hilsheimer2022-09-022-2/+0
| | | | | | | | | AA_EnableHighDpiScaling has no effect, High-DPI scaling is always enabled in Qt 6. Pick-to: 6.2 Change-Id: If96d9fa94b1248ab5bd6b7800e92df82aaec6ac9 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Remove all qmake .pro files, except for examplesVolker Hilsheimer2022-07-262-17/+0
| | | | | | | Task-number: QTBUG-96795 Pick-to: 6.2 Change-Id: Ia5e73baff832eda7807d0ee7a70a10aeb5d5e830 Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
* Build "places" example with cmakeVolker Hilsheimer2022-07-261-1/+1
| | | | | | | | | | The example doesn't work, but that's not a result of the build system. It doens't work when built with qmake/make either. Task-number: QTBUG-96795 Pick-to: 6.2 Change-Id: Ibdb73ee31bf232d45fefb068d12e0a99c871d45f Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
* Small improvements and fixes in different examples projectsLauri Laanmets2022-07-264-12/+12
| | | | | | | | | All examples except 'places' are ported now and work as much as I could test manually. Task-number: QTBUG-96795 Pick-to: 6.2 Change-Id: Icebe6b1c222c68ee2a2881ae442b255360af2fae Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Migrate mapviewer to Qt 6Ivan Solovev2022-07-2629-146/+174
| | | | | | | Task-number: QTBUG-96795 Pick-to: 6.2 Change-Id: Iac955b1018d7092a7d684718bf89bb2908ee3c16 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Migrate geojson_viewer example to Qt 6Ivan Solovev2022-07-265-43/+58
| | | | | | | | | | This includes using QuickControls2 instead of QC1 and also refactoring of the code for android permission requests. Task-number: QTBUG-96795 Pick-to: 6.2 Change-Id: I2986d5f1572d5889b15ee6b5d031d51a7b6a3da9 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Manual fixes in CMake files for examplesLauri Laanmets2022-07-263-18/+12
| | | | | | | | | | | Improvements in CMake files after they have been generated from .pro files by script. All examples except 'places' are included because 'places' example doesn't start (not ported yet). Task-number: QTBUG-96795 Pick-to: 6.2 Change-Id: I1fab82821f499f51337440274d0b66082f614fca Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Porting Examples: use CMake replace qmakeZhang Hao2022-07-2246-107/+653
| | | | | | | | | | | | | | | | | | | | This commit re-enables follow examples: * places * places_list * places_map * minimal_map * itemview_transitions * planespotter Since mapviewer and geojson_viewer example need refactoring for Qt6,so this patch ignore them, but this patch will create them's CMakeList.txt file. Task-number: QTBUG-96795 Done-with: Lauri Laanmets <lauri.laanmets@eesti.ee> Pick-to: 6.2 Change-Id: Ib1385b978b243165163729668ca5d5504e81d9f9 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Silence build warnings, fix build errorsVolker Hilsheimer2022-06-161-2/+1
| | | | | | | | | | Replace various deprecated APIs with their supported Qt 6 versions. Most notably, replace QScopedPointer with std::unique_ptr, as the code frequently use deprecated QScopedPointer::swap. Change-Id: If9cb0be89423fd310073709eb390401d74240153 Reviewed-by: Ivan Solovev <ivan.solovev@qt.io> Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* Switch examples to build as isolated sub-builds part 2Alexandru Croitor2022-02-111-1/+1
| | | | | | | | | | | | | | | qt_examples_build_begin needs the EXTERNAL_BUILD flag to know that it's safe to build examples as ExternalProjects. It still won't do it in CI until we enable building examples as ExternalProjects for prefix builds. This is preparation for that. Pick-to: 6.2 6.3 Task-number: QTBUG-90820 Change-Id: I4851a3d8b1b23d2aa1ef7135c08ae83c5276e737 Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
* Build minimal subset of QtLocation with unit-testsIvan Solovev2021-11-091-1/+2
| | | | | | | | | | | | Build src/location/maps and src/location/places with a minimum subset of required src/location/declarativemaps files. Also build all plugins except mapbox-gl. Enable all non-QML unit-tests. Task-number: QTBUG-97769 Change-Id: I7c70584376c688efd2e1d046186732a7399e12d9 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* Remove QtPositioning module from qtlocation.gitIvan Solovev2021-10-2790-7359/+1
| | | | | | | | | | | | | | | Turns out that our CI does not support repos without any tests. This is treated like an error and leads to integration failure. This patch fixes it by disabling tests in coin/module_config.yaml. This config should be fixed when QtLocation tests are enabled Pick-to: 6.2 Task-number: QTBUG-97084 Change-Id: Ib06e865fe2836806bbbee34345f06b471dd48660 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* Fix weatherinfo example not requesting location permissions on iOSØystein Heskestad2021-10-073-0/+48
| | | | | | | Fixes: QTBUG-91377 Change-Id: Id159cd63102269edeebc9096974830d263e18348 Reviewed-by: Lauri Laanmets <lauri.laanmets@eesti.ee> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Fix Geoflickr example not building with qmakeTamás Martinec2021-10-011-1/+1
| | | | | | | | | | Removed xmlpatterns from the qmake dependencies as it not part of Qt 6. Pick-to: 6.2 Task-number: QTBUG-91534 Change-Id: I99923c34c09cf865c15e97c6bcaf43bc653ac50b Reviewed-by: Ivan Solovev <ivan.solovev@qt.io> Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* QtLocation: Fix position not updating after accepting location dialog on macOSTamás Martinec2021-09-221-8/+6
| | | | | | | | | | | | | Removed the deletion of the location manager if location authorization status is not known. Results in AppModel::positionError at the moment. This happens on macOS before the location authorization dialog is answered. Task-number: QTBUG-91534 Pick-to: 6.2 Change-Id: I62acc61bfd1318fc0c91ae2dbba4915ca5029275 Reviewed-by: Ivan Solovev <ivan.solovev@qt.io> Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* Weatherinfo: update documentationIvan Solovev2021-08-242-7/+25
| | | | | | | | | | | | | | Mention multiple data providers and the related limitations. As a drive-by: update the example image, because the previous one was showing the temperature in Fahrenheit, while the application currently uses Celsius. Task-number: QTBUG-60467 Pick-to: 6.2 Change-Id: I47f3c118a47e840ff048bfa273b80c0b13a50808 Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io> Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* Introduce WeatherApi backendIvan Solovev2021-08-2414-133/+480
| | | | | | | | | | | | | | | | | | | | | | | | This patch introduces the weather backend from weatherapi.com and provides the means to switch between backends at runtime. This will be done automatically in case one of the backends does not respond. As we currently use different backends, we had to update the QML part that is responsible for showing the icons. We no longer use the icons from web-site for the forecast, but use the same icon set as for the current weather. This required introducing methods to convert backend-specific weather icon information to a common format used in the application. While on it, a new type of weather icon was introduced (taken from the same icon set). Different weather backends provide weather forecast for different amount of days (due to license restrictions), so the QML code now makes use of the Repeater that dynamically changes the amount of shown days. Task-number: QTBUG-60467 Pick-to: 6.2 Change-Id: Ic9aa3a97ec440dddb38f06edfff8a8434724d118 Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* Introduce weather data cacheIvan Solovev2021-08-245-48/+164
| | | | | | | | | | | | | | | | This patch introduces weather data cache. Before sending a request to weather provider, the cache is checked, and if the corresponding weather information exists in the cache and is not outdated, then it's used in the application. While working with GPS location, the cache does not perform a direct comparison of coordinates. Instead it checks if the new coordinate is in the specified area around the cached one, or not. Task-number: QTBUG-60467 Pick-to: 6.2 Change-Id: I150a1023587be656ee8b190d1c2bce667c6301e2 Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* Move OpenWeatherMap support to separate backend classIvan Solovev2021-08-248-275/+545
| | | | | | | | | | | | | | | | | | | | | | | | | The idea is to provide support for multiple backends in the weatherinfo application. This patch introduces class hierarchy for the backends and moves current OpenWeatherMap support to a separate class, so that it can later be replaced at runtime. During the refactoring the number of requests is also optimized (we now perform 2 requests instead of 3 to get the information about one city). Currently the OpenWeatherMap backend is used directly as a property of AppModelPrivate. More backends will be added in the following patches, and a mechanism to switch between them will be provided. The code for limiting the amount of the requests is currently removed. It will be replaced by a weather data cache in the following patches. As a drive-by: fixed a memory leak in the AppModel. Task-number: QTBUG-60467 Pick-to: 6.2 Change-Id: I90daac9451e4c14749a1725c4a04afce0d4b7467 Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* Use the new QML CMake API for examples, tests and docsCraig Scott2021-08-234-57/+31
| | | | | | | | | | | The qt6_qml_type_registration() command will become internal. Update the examples, tests and docs to no longer call this command and use the new QML CMake API available from Qt 6.2 instead. Task-number: QTBUG-95093 Pick-to: 6.2 Change-Id: Ibd62ccb4e2723a64d8a2c4418982037419d19855 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Raise cmake_minimum_required to VERSION 3.16 in examplesJoerg Bornemann2021-08-174-4/+4
| | | | | | | Pick-to: 6.2 Task-number: QTBUG-95636 Change-Id: I821f412f9dbe11ae99ffd888a7ab2ba415ed9379 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>