Please note that as of October 24, 2014, the Nokia Developer Wiki will no longer be accepting user contributions, including new entries, edits and comments, as we begin transitioning to our new home, in the Windows Phone Development Wiki. We plan to move over the majority of the existing entries. Thanks for all your past and future contributions.

Qt sample application: Google maps

From Wiki
Jump to: navigation, search

In this article we will see how can we display location on Map using Qt and Google Map API

Article Metadata
Code Example
Source file:
Created: liuxg (15 Dec 2009)
Last edited: hamishwillee (29 Oct 2012)

Idea and Implementation

We will create an application using Qt Webkit and Google Map API to point a location and show it on the map.The application also has a Zoom In and Zoom Out feature. The application can also send the current searched coordinate information to a given number on Symbian platform S60 phones. Currently, it does not use the Mobility API to do so, but rather it directly uses Symbian APIs to send the short messages.

The application can also be successfully deployed to Maemo N900 devices as well. Attached please find the debian file for installation as well.

The application demos how to do a hybrid application using Qt C++, Javascript, html, jQuery etc.

The example code be easily compiled to a mini-Browser by defining the macro BROWSER the following line in the file "config.pri".

DEFINES+='''BROWSER'''     <=== if it is defined, the app is compiled to be a browser
DEFINES+='''PHONE_EMU''' <=== on Windows, the size is resized to 640x360 to mimic the N97 phone size.

Please be noted that the following API:


only exists from Qt 4.6.0 onwards. If the app runs within a network without a proxy, the line could be commented out. As such, it could be compiled with Qt 4.5.2 and Qt 4.5.3 releases.

Meanwhile, you are free to replace the line with:

 QList<QNetworkProxy> list = QNetworkProxyFactory::systemProxyForQuery ( QNetworkProxyQuery ( QUrl("") ) );
if( list.count() >= 1)
QNetworkProxy::setApplicationProxy ( );

As such, it could be successfully compiled using Qt releases prior to Qt 4.6.0.

Here are some of the captured pictures for the application:

Maps3.jpg Maps4.jpg Maps5.jpg Mapps2.jpgMaemo5.jpg

If the application is compiled to be a browser (BROWSER macro should be defined), the screen shot is shown as follows:


A user is able to rotate the .gif pictures in the website by clicking the rotate icon. It is accomplished using jQuery. Meanwhile, a user may also go back and forward, zoom in/out of the web contents.

The sample code can be found at

This page was last modified on 29 October 2012, at 03:45.
103 page views in the last 30 days.