Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Qt Academy Launch in California!

    Solved How to merge the code found in the QGeoRoute class (documentation) with the QML MapViewer example?

    QML and Qt Quick
    2
    8
    367
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • H
      Hass last edited by

      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.

      1 Reply Last reply Reply Quote 0
      • Shrinidhi Upadhyaya
        Shrinidhi Upadhyaya last edited by

        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?

        Shrinidhi Upadhyaya.
        Upvote the answer(s) that helped you to solve the issue.

        1 Reply Last reply Reply Quote 0
        • H
          Hass last edited by

          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.

          1 Reply Last reply Reply Quote 0
          • Shrinidhi Upadhyaya
            Shrinidhi Upadhyaya last edited by Shrinidhi Upadhyaya

            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.
            Upvote the answer(s) that helped you to solve the issue.

            1 Reply Last reply Reply Quote 0
            • H
              Hass last edited by

              @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.

              1 Reply Last reply Reply Quote 0
              • Shrinidhi Upadhyaya
                Shrinidhi Upadhyaya last edited by

                Hi @Hass , you can have a look at this [https://doc.qt.io/qt-5/qtqml-cppintegration-topic.html]

                Shrinidhi Upadhyaya.
                Upvote the answer(s) that helped you to solve the issue.

                1 Reply Last reply Reply Quote 1
                • H
                  Hass last edited by

                  @Shrinidhi-Upadhyaya Great thanks!

                  1 Reply Last reply Reply Quote 0
                  • Shrinidhi Upadhyaya
                    Shrinidhi Upadhyaya last edited by

                    Hi @Hass , can you mark the thread title as [SOLVED]

                    Shrinidhi Upadhyaya.
                    Upvote the answer(s) that helped you to solve the issue.

                    1 Reply Last reply Reply Quote 0
                    • First post
                      Last post