Finding out details of a location or a landmark
In this recipe, you will be prompted to enter a location or landmark whose details you want to know. For example, if you enter Buckingham Palace
, the recipe will display the city and postal code of the location where the palace is situated, along with its longitude and latitude values.
How to do it…
The search method of the GoogleMaps
class is the key player in this recipe. The landmark or location entered by the user is passed to the search method. The city
, postal_code
, lat
, and lng
properties of the object returned from the search method are used to display the city, postal code, latitude, and longitude of the location, respectively. Let's see how it is done through the following step-by-step procedure:Â
- Create an application based on the
Dialog without Buttons
template. - Add six
QLabel
, aQLineEdit
, and aQPushButton
widget to the form by dragging and dropping sixLabel
, oneLine Edit
, and aPush Button
widget onto the form. - Set the
text
property...