In this example, we will learn how to obtain the full address of a specific location by using Google's Geocoding API.
Let's create a program that utilizes the Geocoding API by following these steps:
Next, open up
mainwindow.ui
and add a couple of text labels, input fields, and a button to make your UI to look similar to this:After that, open up your project (
.pro
) file and add the network module to your project. You can do that by simply adding thenetwork
text aftercore
andgui
, like so:QT += core gui network
Then, open up
mainwindow.h
and add the following headers to the source code, right after the line#include <QMainWindow>
:#include <QDebug> #include <QtNetwork/QNetworkAccessManager> #include <QtNetwork/QNetworkReply> #include <QXmlStreamReader>
Next, declare a slot function manually and call it
getAddressFinished()
:private slots: void getAddressFinished(QNetworkReply...