Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. How can I get my address location with qt ?
Forum Updated to NodeBB v4.3 + New Features

How can I get my address location with qt ?

Scheduled Pinned Locked Moved Unsolved General and Desktop
9 Posts 5 Posters 3.3k Views 2 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.
  • T Offline
    T Offline
    takoo
    wrote on last edited by
    #1

    How can I get my adress location with qt? I want to get my home location.

    I just write code ------- (-_-) ----------

    L 1 Reply Last reply
    0
    • VRoninV Offline
      VRoninV Offline
      VRonin
      wrote on last edited by
      #2

      QDir::homepath()

      "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
      ~Napoleon Bonaparte

      On a crusade to banish setIndexWidget() from the holy land of Qt

      1 Reply Last reply
      0
      • T Offline
        T Offline
        takoo
        wrote on last edited by
        #3

        my home as really :D

        I just write code ------- (-_-) ----------

        1 Reply Last reply
        0
        • T Offline
          T Offline
          takoo
          wrote on last edited by
          #4

          like gps,google-maps

          I just write code ------- (-_-) ----------

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

            Do you mean the QtLocation module ?

            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
            • T Offline
              T Offline
              takoo
              wrote on last edited by
              #6

              thanks for reply :D

              I just write code ------- (-_-) ----------

              1 Reply Last reply
              0
              • T Offline
                T Offline
                takoo
                wrote on last edited by
                #7

                @SGaist can you give me simple example code? or how can i get example this api ?

                I just write code ------- (-_-) ----------

                ? 1 Reply Last reply
                0
                • T takoo

                  @SGaist can you give me simple example code? or how can i get example this api ?

                  ? Offline
                  ? Offline
                  A Former User
                  wrote on last edited by
                  #8

                  Here are some code snippets from a GPS tracker. For API details see QGeoPositionInfoSource and QGeoPositionInfo.

                  // setup GPS
                  m_gps = QGeoPositionInfoSource::createDefaultSource(this);
                  if (m_gps) {
                    connect(m_gps, SIGNAL(positionUpdated(QGeoPositionInfo)), this, SLOT(positionUpdated(QGeoPositionInfo)));
                    m_gps->startUpdates();
                  }
                  
                  void MainWindow::positionUpdated(const QGeoPositionInfo &info)
                  {
                      if (!info.isValid()) {
                          ui->mainPage->setStatusText( "Invalid GPS data" );
                          return;
                      }
                  
                      if (m_appState == AppState::NoGps) {
                          ready();
                      }
                  
                      // set current data on main page
                      ui->mainPage->currentSetLatitude( QString("%1").arg(info.coordinate().latitude(), 0, 'f', 5) );
                      ui->mainPage->currentSetLongitude( QString("%1").arg(info.coordinate().longitude(), 0, 'f', 5) );
                      ui->mainPage->currentSetAltitude( QString("%1").arg(info.coordinate().altitude(), 0, 'f', 0 ) );
                  
                      if (m_appState == AppState::Running) {
                          const int pointsCount = m_sessionInfo->path.size();
                          if (pointsCount == 0) {
                              m_sessionInfo->path << info;
                          } else {
                              const double lat1 = m_sessionInfo->path.at( pointsCount-1 ).coordinate().latitude();
                              const double lon1 = m_sessionInfo->path.at( pointsCount-1 ).coordinate().longitude();
                              const double lat2 = info.coordinate().latitude();
                              const double lon2 = info.coordinate().longitude();
                              double distance = gpsDistance(lat1, lon1, lat2, lon2);
                              if (distance > DISTANCETHRESHOLD) {
                                  m_sessionInfo->distance += distance;
                                  m_sessionInfo->path << info;
                              }
                          }
                      }
                  
                  }
                  
                  1 Reply Last reply
                  1
                  • T takoo

                    How can I get my adress location with qt? I want to get my home location.

                    L Offline
                    L Offline
                    ldanzinger
                    wrote on last edited by
                    #9

                    @takoo If you are using the ArcGIS SDK, you can do it with geocoding. It is discussed here - https://developers.arcgis.com/qt/qml/guide/search-for-coordinates.htm

                    Otherwise, does the example in Qt Location not give you what you need (sounds like you need to Geocode) - http://doc.qt.io/qt-5/qtlocation-mapviewer-example.html

                    1 Reply Last reply
                    0

                    • Login

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