Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. Using Google Maps in an native mobile application
Forum Updated to NodeBB v4.3 + New Features

Using Google Maps in an native mobile application

Scheduled Pinned Locked Moved Mobile and Embedded
19 Posts 5 Posters 4.8k Views 3 Watching
  • 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.
  • S Offline
    S Offline
    simonh5
    wrote on last edited by
    #3

    Thank you. Because I am very new to Qt, is there any full functioning example with google maps on Git or here in Qt forum? -- A kind of minimal example?

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #4

      Hi,

      You have to build and install the plugin first:

      qmake
      make
      make install
      

      Then you can follow the example @kshegunov linked in his answer and change the selected plugin to use the one you just installed.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      2
      • S Offline
        S Offline
        simonh5
        wrote on last edited by simonh5
        #5

        @SGaist

        This means calling in command line:

        1. qmake -o Makefile <Path to File>.pro
        2. make ??
        3. make install ??

        Can you help me with point 2 and 3 again? Thank you!!

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #6

          What OS are you developing on ?

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0
          • S Offline
            S Offline
            simonh5
            wrote on last edited by
            #7

            I develop on Windows 10. Thanks for any help again!

            1 Reply Last reply
            0
            • SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #8

              Visual Studio or MinGW ?

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              1 Reply Last reply
              0
              • S Offline
                S Offline
                simonh5
                wrote on last edited by
                #9

                Hi!
                Sorry for the uncomplete answer.
                I use Windows 10, Qt 5.7 and Visual Studio 2013.

                1 Reply Last reply
                0
                • SGaistS Offline
                  SGaistS Offline
                  SGaist
                  Lifetime Qt Champion
                  wrote on last edited by
                  #10

                  Then replace make with nmake

                  Interested in AI ? www.idiap.ch
                  Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                  1 Reply Last reply
                  3
                  • S Offline
                    S Offline
                    simonh5
                    wrote on last edited by
                    #11

                    Hi everyone!

                    First thanks for all advices, very helpful. The plugin is installed.

                    Now I am facing the problem that I want to integrate Google Maps into the qml code with the help of the QtLocation module.
                    Do you have any kind of a minimal code example?

                    @kshegunov
                    What do you mean by "switch the provider plugin to one supporting google maps"?

                    Kind regards.

                    kshegunovK 1 Reply Last reply
                    0
                    • S simonh5

                      Hi everyone!

                      First thanks for all advices, very helpful. The plugin is installed.

                      Now I am facing the problem that I want to integrate Google Maps into the qml code with the help of the QtLocation module.
                      Do you have any kind of a minimal code example?

                      @kshegunov
                      What do you mean by "switch the provider plugin to one supporting google maps"?

                      Kind regards.

                      kshegunovK Offline
                      kshegunovK Offline
                      kshegunov
                      Moderators
                      wrote on last edited by
                      #12

                      I mean that after you download and compile one of the QtLocation examples, you open the QML file find where the plugin is specified and change the name, thus you load another plugin that provide maps.

                      Read and abide by the Qt Code of Conduct

                      1 Reply Last reply
                      2
                      • S Offline
                        S Offline
                        simonh5
                        wrote on last edited by simonh5
                        #13

                        Now, for all who wants to integrate Google Maps in their application, here is a summary with a minimal code example.
                        Tested system environment: Windows 10, Qt 5.7, Visual Studio Compiler.

                        1. Install the following plugin: https://github.com/vladest/googlemaps by calling the qmake, nmake and nmake install via cmd

                          If struggling with compiling the plugin in cmd regarding the error x86/x64, use the compiler of a real 64bit compiler of Visual Studio (not the Express version of Visual Studio) and call the vcvarsall.bat file with the parameter x64 first.

                        2. Using the following qml code to call the map in your qt application.

                          Plugin {
                              id: myPlugin
                              name: "googlemaps"
                              PluginParameter { name: "googlemaps";
                                  value: "http://maps.googleapis.com/maps/api/js?sensor=false" }
                          }
                        
                          Map {
                              anchors.fill: parent
                              plugin: myPlugin
                              zoomLevel: 0
                        
                              Component.onCompleted: {
                                  for( var i_type in supportedMapTypes ) {
                                      print (supportedMapTypes[i_type].name)
                                      if( supportedMapTypes[i_type].name.localeCompare( "Custom URL Map" ) === 0 ) {
                                          activeMapType = supportedMapTypes[i_type]
                                      }
                                  }
                              }
                          } 
                        
                        

                        Good luck! =)

                        1 Reply Last reply
                        2
                        • D Offline
                          D Offline
                          danielusa
                          wrote on last edited by
                          #14

                          @simonh5 @SGaist
                          I tried to qmake the project, but I get the following error:

                          Project ERROR: Unknown module(s) in QT: positioning-private location-private 
                          

                          I'm on Ubuntu 14.04 and Qt 5.8. I googled that error but could not find a lot...any guess how to fix this? :)

                          1 Reply Last reply
                          0
                          • SGaistS Offline
                            SGaistS Offline
                            SGaist
                            Lifetime Qt Champion
                            wrote on last edited by
                            #15

                            Hi,

                            With which version of Qt are you building that plugin ?

                            Interested in AI ? www.idiap.ch
                            Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                            D 1 Reply Last reply
                            1
                            • SGaistS SGaist

                              Hi,

                              With which version of Qt are you building that plugin ?

                              D Offline
                              D Offline
                              danielusa
                              wrote on last edited by
                              #16

                              @SGaist

                              Hey, that was fast and a good hint, thank you :) My standard qmake was the wrong version. Qmake from Qt 5.8 works, but make (g++ (Ubuntu 4.8.4-2ubuntu1~14.04.3) 4.8.4) throws directly the next errors:

                              g++: error: unrecognized command line option ‘-std=c++1z’
                              g++: error: unrecognized command line option ‘-Wdate-time’
                              

                              For the first one I found this Qt bug-report: https://bugreports.qt.io/browse/QTBUG-51644, for the second one this: https://bugreports.qt.io/browse/QTBUG-53017, but it seems like both should be fixed Qt 5.6...

                              I'm not sure if this a Qt-related problem anymore, but any ideas? I can barely find anything about those on Google.

                              1 Reply Last reply
                              0
                              • SGaistS Offline
                                SGaistS Offline
                                SGaist
                                Lifetime Qt Champion
                                wrote on last edited by
                                #17

                                For a quick solution you can edit the qt_common.prf and modify the logic selecting the date-time warning. As for the std switch IIRC you can use something like CONFIG += c++14.

                                Interested in AI ? www.idiap.ch
                                Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                                D 1 Reply Last reply
                                1
                                • SGaistS SGaist

                                  For a quick solution you can edit the qt_common.prf and modify the logic selecting the date-time warning. As for the std switch IIRC you can use something like CONFIG += c++14.

                                  D Offline
                                  D Offline
                                  danielusa
                                  wrote on last edited by
                                  #18

                                  @SGaist Hi,

                                  I edited the mkspecs/features/qt_common.prf and commented out the warning for the Wdate-time. Also I edited the mkspecs/common/q++-base.conf and replaced every "1z" with "11" (found this suggestion somewhere else, because your CONFIG =+ c++14 seemed not to work). I have to be honest, I don't know exactly what the error was and what I did to fix it, but it works now :D Thank you for your help :)

                                  1 Reply Last reply
                                  0
                                  • SGaistS Offline
                                    SGaistS Offline
                                    SGaist
                                    Lifetime Qt Champion
                                    wrote on last edited by
                                    #19

                                    You changed the standard used to compile your application. 1z is the equivalent of C++17 IIRC.

                                    Interested in AI ? www.idiap.ch
                                    Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                                    1 Reply Last reply
                                    1

                                    • Login

                                    • Login or register to search.
                                    • First post
                                      Last post
                                    0
                                    • Categories
                                    • Recent
                                    • Tags
                                    • Popular
                                    • Users
                                    • Groups
                                    • Search
                                    • Get Qt Extensions
                                    • Unsolved