Retrieve Location Using Qt Mobility

From Qt Wiki
Revision as of 17:38, 14 January 2015 by Maintenance script (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

English Български

Retrieve Location Using Qt Mobility

Overview

The provided code snippet shows how to retrieve location using Qt Mobility class QGeoPositionInfoSource [doc.qt.nokia.com]. When the position is retrieved the location coordinates (latitude and longitude) are displayed on the screen. The given example has been tested on Nokia E7 with Symbian^3.

The following positioning methods [doc.qt.nokia.com] can be used:

  • SatellitePositioningMethods – Satellite-based positioning methods such as GPS.
  • NonSatellitePositioningMethods – Other positioning methods.
  • AllPositioningMethods – All positioning methods.

The example application is using NonSatellitePositioningMethods.

Code Snippet

Project File

Qt Mobility should be included at the project file. Additionally if the application is targeting Symbian devices Location should be added as a capability [developer.qt.nokia.com].

Header

Source

Troubleshooting

  • ‘QGeoPositionInfo’ has not been declared

All required header files must be included and the Qt Mobility namespace should be specified.

  • AllPositioningMethods does not work as expected

This is a known critical bug that affects Qt Mobility 1.1.2 [bugreports.qt.io] Please check the provided link for details.

See Also

Getting the location in Qt [developer.nokia.com]

Categories: