summaryrefslogtreecommitdiff
path: root/src/location/declarativemaps/qdeclarativegeoroute.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Register QGeoRoute as QML value type, remove QDeclarativeGeoRouteVolker Hilsheimer2022-10-041-298/+0
| | | | | | | | Adapt model and tests accordingly. Fixes: QTBUG-106482 Change-Id: Ie5a36e4fef17ae7bc4ecfab9187a325fb025e283 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Simplify declarative wrapper of QGeoRouteVolker Hilsheimer2022-09-221-44/+15
| | | | | | | | | | | | | | | | | | | | | Move the logic of counting, and assembling a list of segments into the QGeoRoute implementation, using a generic function that iterates the linked list of segments and calls a functor. Remove the (premature - how many legs are there - 5?) optimization of caching the list of legs and segments. For extended attributes, return the QVariantMap from QGeoRoute rather than building a declarative map (that is then supposed to be CONSTANT). Make the getters const. The only thing stopping QGeoRoute to be directly exposed to QML and the declarative wrapper to be removed is now the access to the routeQuery object. Change-Id: Ie9b86c3b235a75f3bbea086697a6eda02b060264 Reviewed-by: Ivan Solovev <ivan.solovev@qt.io> Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* Merge QGeoRouteLeg into QGeoRouteVolker Hilsheimer2022-09-161-45/+16
| | | | | | | | | | | | | | | | | | | | | | QGeoRouteLeg was a subclass of QGeoRoute. Since QGeoRoute is a value type, subclassing is problematic, even though QGeoRouteLeg had no data of its own and only added public getters for data already carried by QGeoRoutePrivate. But if every leg is a route, with documentation pointing out that some route-specific getters never return anything, then it's easier to just add leg-specific APIs to QGeoRoute. A route is then a group of other routes. Those route legs point back at the overall route, and know of index within the overall route. Those leg-specific APIs return -1 for the index and an empty overall route if the route is not a leg within an overall route. This saves a separate type with its own QDeclarative* wrapper, without losing any expressiveness. Task-number: QTBUG-105206 Change-Id: I8844290d245ed79215e6c7893d972e0da96ed197 Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
* Use QVariant support for converting to a QGeoCoordinateVolker Hilsheimer2022-09-151-1/+0
| | | | | | | | This gets rid of the rest of the locationvaluetypehelper usages, so those files can go completely now. Change-Id: Ieaa543578ef35a8887c04c24352e72ba931badb9 Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
* Change QJSValue properties to QList<QGeoCoordinate/Rectangle>Volker Hilsheimer2022-09-151-9/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The QML engine is able to operate on lists of gadgets, there is no need for using private APIs to operate on QJSValue. For the time being, this breaks a QML construct like path[0].longitude = 0 This no longer changes the value of path[0].latitude in place. Instead, use var path0 = path[0] path0.longitude = ... path[0] = path0 This is consistent with other properties that have type list<gadget>, as QML operates on copies of values, not on references. Adapt the test case accordingly. Since support for value-initializing properties of type list<gadget> requires plumbing in the QML engine, and registration of conversion routines from QVariantMap to QGeoCoordinate, augment the test. Remove the now unnecessary toList/fromList conversion functions, and the dependency to private QtQml libraries. Fixes: QTBUG-105241 Change-Id: I8f248c457a6de27a3b2680bdc948c5683ebc7fa0 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
* Refactor: remove duplicated codeVolker Hilsheimer2022-09-131-32/+2
| | | | | | | | | | | | Use the existing helper implementation to convert QJSValue to QList<QGeoCoordinate>. Remove parseCircle helper function that is not used anywhere, and unexport the helper function that is only used by another helper. Pick-to: 6.2 Change-Id: Ie01cca3e5a7bd09a88be67225185b54e0f28e773 Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
* Make QDeclarativeGeoRoute::legs type safeVolker Hilsheimer2022-09-091-1/+1
| | | | | | | | | We can use a QList property with a forward-declared type, so do that instead of using QList<QObject *>. Pick-to: 6.2 Change-Id: I20d8ebbf4aa2d9ca18ae0ce7b3e6b2698dd069f2 Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
* Remove QDeclarativeGeoRouteSegment wrapperVolker Hilsheimer2022-09-091-74/+8
| | | | | | | | | | | | | | | | | | | Register the QGeoRouteSegment gadget type directly as the routeSegment QML type (via a Foreign), and use it in QDeclarativeGeoRoute. The type is now uncreatable. It wasn't in 5.15, but since there is no setter-API that is exposed to QML, there is no reason to have it be a creatable type. Adjust the QML test to declare a property of type routeSegment instead. Move the QML type documentation into QGeoRouteSegment, and document the corresponding C++ properties via \property. Unify the language a bit, and follow up on the rename from RouteSegment to routeSegment. Pick-to: 6.2 Change-Id: I1ebae0c1a9d056aa59510a3ab539b1d8bce8c6c7 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Reduce includes of private headers from upstream modulesVolker Hilsheimer2022-07-261-2/+0
| | | | | | | | | | | Removing includes that don't seem to be needed for building the code. No effort made yet in reviewing usage of private APIs to see if there are public alternatives. Pick-to: 6.2 Change-Id: I6a41a3488aa6c2bbe6098a0ff6424627ab353686 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
* Use up-to date LGPL license headerKai Köhne2021-12-021-11/+14
| | | | | | | | Remove usages of outdated LGPL3 header that references LICENSES.LGPLv3 instead of LICENSES.LGPL3. Change-Id: Ied647fc10d2bf051cccc8b38d75570b7caef1f28 Reviewed-by: Jani Heikkinen <jani.heikkinen@qt.io>
* replace int by qsizetypeLauri Laanmets2021-11-091-2/+2
| | | | | | | | | | | For "count" and "at" methods, the parameter or return type int was replaced by qsizetype. This patch adapts the code to this change. Task-number: QTBUG-96795 Change-Id: Id409ab573cce886649a72538584dfa57264e7dac Reviewed-by: Ivan Solovev <ivan.solovev@qt.io> Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* Merge 5.15 to dev and fix resulting compile issuesQt Forward Merge Bot2020-04-021-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/imports/location/location.cpp The change fixes the bare minimum of what needs to be done to compile and run. This includes the following issues: 1. Fix build failures as a result of QMetaType changes in qtbase moc now stores the QMetaType of properties as a result of 46f407126ef3e94d59254012cdc34d6a4ad2faf2 in qtbase, which requires full type information about the property type inside the moc generated source file. Many of the property types were forward-declared, and this resulted in build errors like: "invalid application of 'sizeof' to an incomplete type 'QDeclarativeGeoMap'" 2. Adopts QtQML API changes. A private QJSValue ctor was removed. The "replacement" is QJSValuePrivate::fromReturnedValue(..). 3. The mapboxgl 3rdparty backend does not compile at this point in time and seems unmaintained. For the time being, the mapboxgl backend is disabled in the interest of keeping qtlocation closer to dev HEAD of other Qt modules. Change-Id: I756e1c2effb29eaaf96a61a28c1c17338774b77c
* Merge remote-tracking branch 'origin/5.13' into 5.14Qt Forward Merge Bot2019-10-011-3/+3
|\ | | | | | | Change-Id: Id543d32c49c8efd1d7798d41bbee0e28c1742e12
| * Doc: Fix link errors and complete parameter specsNico Vertriest2019-09-301-3/+3
| | | | | | | | | | Change-Id: I786ab35a0e9c8dfa2c8124692289d98e8eee4a8d Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
* | Fix compilation after recent declarative internal header changesSimon Hausmann2019-07-171-0/+2
|/ | | | | | | | | | Some types of the private declarative API became visible through implicit header file inclusion from qqmlengine_p.h. This was changed in declarative and requires fixing here, but it's backwards build compatible to before the changes in declarative. Change-Id: I3553fada4363e88191c127f9cabae2169916ae46 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Doc: Fix documentation issuesTopi Reinio2019-05-161-1/+3
| | | | | | | | | | | Fix various documentation-related issues, including missing parameter documentation, broken links, and typos. Do some minor language editing. Change-Id: I0a8f8457e0d1ab56b4fc4670376509adf1fd26a3 Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* Add extended attributes to QGeoRoute/QDeclarativeGeoRoutePaolo Angelelli2018-09-241-0/+29
| | | | | | | | | This to be able to push plugin-specific data for which an API is not yet available in these classes. Task-number: QTBUG-70502 Change-Id: Ie7d715a545f1174ae7c118bd1b269dca51282301 Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* Add support for route legsPaolo Angelelli2018-08-241-2/+89
| | | | | | | | | | | | | | | | | | This patch adds support for route legs, that are the portions of a route between one waypoint and the next. QGeoRouteLeg in particular can be seen as an API addition to QGeoRoute in that it uses and exposes additional methods added to QGeoRoutePrivate but not used in QGeoRoute. Currently the request for legs is set to be the same as the request for the entire route. Finding the related bounding waypoints has to be done programmatically using the legIndex property. Change-Id: If462b1dc6348be16dc96b167db5500f079fe0a64 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* Remove usage of deprecated, internal QML APILars Knoll2018-08-031-4/+0
| | | | | Change-Id: I4c9a27532f96a885d8baa7a790b2b983b2eb3bb3 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Adjust to internal API changes in qtdeclarativeLars Knoll2018-07-031-0/+4
| | | | | | Change-Id: I37fd81cfaf2599859581e2a359f87f15b772db98 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io> Reviewed-by: Paolo Angelelli <paolo.angelelli@qt.io>
* Add QDeclarativeGeoRoute::equalsPaolo Angelelli2018-06-261-0/+12
| | | | | | | So that deep comparisons can be performed in QML too Change-Id: I484644d4ddf3334c16321e5fc361504e9de105b2 Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* Doc: Fix all documentation warningsTopi Reinio2018-03-271-2/+2
| | | | | | | | | | | | | | | | | | | | Fix multiple warnings caused by invalid documentation configuration, missing QML module specifiers, wrong QML type names, incorrect arguments for the \fn command, and missing documentation. Remove incorrect statement from the example usage of the Waypoint QML type. Use 'QtLocation' as the name for the module throughout the docs. Clang (used as the parser for QDoc in Qt 5.11) was unable to resolve the path for qlocation.h, causing QDoc to omit the QLocation namespace documentation. Fix this by including the file explicitly from qlocationglobal.h for documentation builds. Change-Id: I2bd790db1ff5ad96f0cdb415a682b97593b3a6dc Reviewed-by: Martin Smith <martin.smith@qt.io>
* API Fix: expose the RouteQuery used to produce a RoutePaolo Angelelli2018-03-191-0/+15
| | | | | | | | | | | | | | Currently, Route is intended to be a one-way interface to push data into a route request. With the upcoming navigation support, there is need for this to become also a way to report to the user the updated request info, for example when, Navigator.currentRoute changes. This patch introduces a RouteQuery read-only qml property so it would be possible to access the related query data in a route, and use it in the UI. Change-Id: Ibea8cb724313606feae614c61736ee14105d1045 Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* Add QDeclarativeGeoRoute::route getterPaolo Angelelli2018-01-241-0/+5
| | | | | | | | To allow private classes to access the embedded QGeoRoute without the need to be friend. Change-Id: I7184e1a9fd038af3b82d71671667cd5b2e3449a7 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* Make QGeoRoute extensiblePaolo Angelelli2017-08-241-12/+41
| | | | | | | | | | | | | | This change makes it possible to subclass QGeoRoute, QGeoRouteSegment or QGeoRouteManeuver, with custom private implementations. It also attempts to minimize the cost that creating a QDeclarativeGeoRoute currently has, by deferring the initialization of QDeclarativeGeoRoute::segments_ to the first access, and also populating the list only to the requested point. Change-Id: I4c87391bcc380ddca6523c748ebb97d2a44ed9d2 Reviewed-by: BogDan Vatra <bogdan@kdab.com>
* Fix documentation for return types from QJSValue to the actual QML typePaolo Angelelli2017-05-311-1/+1
| | | | | Change-Id: I6db1f0db07de3bb9446f0b04ea95f34b56acf805 Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* Remove moc_* inclusions from source filesPaolo Angelelli2017-02-141-2/+0
| | | | | | Change-Id: I7385348d7b6ec22fa92ed1be65f89e262c38b5c0 Reviewed-by: Michal Klocek <michal.klocek@qt.io> Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* Moving location qml implementation to location/declarative*Paolo Angelelli2017-01-261-0/+277
QtLocation quick classes and headers are moved out of the import directory. The location quick classes are now in a subdirectory inside the main qtlocation module. This is necessary in order to privately export certain classes, such as Map Items classes, and create an API to inject these objects into QGeoMap to let plugins render the Map Items directly Change-Id: Ia6ba5f07c4eddd3c4c2ce54bf34f1afcd42c2558 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>