P. 1
Qt for Symbian

Qt for Symbian

|Views: 1,456|Likes:
Published by burhay

More info:

Published by: burhay on Sep 10, 2010
Copyright:Attribution Non-commercial

Availability:

Read on Scribd mobile: iPhone, iPad and Android.
download as PDF, TXT or read online from Scribd
See more
See less

05/24/2012

pdf

text

original

The code example below gets registers for getting notifications on changes in user location. The
QGeoPositionInfoSource class is used to get the default positioning source of the device.
If the source exists, it can use either satellite data or some other positioning method. The user
class must create the source and request updates by calling the startUpdates() method. The
positioning info is then eventually passed through the positioningUpdated() signal with a
parameter containing latitude, longitude, altitude, etc., as location information. This is realized with
the following code:

1 // Get the default positioning source. If exists, then request updates.

2 QGeoPositionInfoSource *source = QGeoPositionInfoSource::

createDefaultSource();

3 if (source) {

4

connect(source, SIGNAL(positionUpdated(QGeoPositionInfo)), this, SLOT
(handlePositionUpdated(QGeoPositionInfo)));

5

source->startUpdates();

6 }

7

8 // Custom slot for getting the updates

9 void handlePositionUpdated(const QGeoPositionInfo &info)

10

{

11

double latitude = info.coordinate().latitude();

12

double longitude = info.coordinate().longitude();

Qt Mobility APIs 71

13

double altitude = info.coordinate().altitude();

14

};

You're Reading a Free Preview

Download
scribd
/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->