How to merge the code found in the QGeoRoute class (documentation) with the QML MapViewer example?
-
I have a project where I have to find the shortest route between two points & calculate the ETA depending on the traffic. I found all I needed in the QGeoRoute class, where I found an easy code in the QGeoRoutingManager that I would like to merge with the code in the QML MapViewer found in "Welcome". I'm new to these classes so I would appreciate any help. I don't know if it's even doable.
-
Hi @Hass , actually what you want to achieve using QML MapViewer, as you have told in your project you need to find the shortest route, do you want to display that in QML using MapViwer?
-
Hey @Shrinidhi-Upadhyaya , yeah exactly plus I need to show the ETA(estimated time of arrival), I saw other features that I may use too in the QGeoRouteRequest class like Feature Types & Feature weights. I want to use this class in the QML Map Viewer code because of the previously mentioned info that I'd to include.
-
Hi @Hass , you can use RouteModel to show the distance between the 2 points and for the ETA you can just calculate it and display the value using Text in QML. I dont actually know what are Feature Weights and Feature Types, and you cant use the QGeoRequest directly in MapViewer i guess,you need to create your own seperate class with the implemented functionalites, and expose that class to QML and use it.
-
@Shrinidhi-Upadhyaya Well my question was basically this one, how can I expose that class to QML? In other words, how can I merge them together?I already created my own separate class for the QGeoRoute & QGeoRouteRequest classes.
-
Hi @Hass , you can have a look at this [https://doc.qt.io/qt-5/qtqml-cppintegration-topic.html]
-
@Shrinidhi-Upadhyaya Great thanks!
-
Hi @Hass , can you mark the thread title as [SOLVED]