The QGeoAreaMonitor class enables the detection of proximity changes for a specified set of coordinates. More...
#include <QGeoAreaMonitor>
Inherits: QObject.
This class was introduced in Qt Mobility 1.0.
QGeoAreaMonitor ( QObject * parent ) | |
virtual | ~QGeoAreaMonitor () = 0 |
QGeoCoordinate | center () const |
qreal | radius () const |
virtual void | setCenter ( const QGeoCoordinate & coordinate ) |
virtual void | setRadius ( qreal radius ) |
void | areaEntered ( const QGeoPositionInfo & update ) |
void | areaExited ( const QGeoPositionInfo & update ) |
QGeoAreaMonitor * | createDefaultMonitor ( QObject * parent ) |
The QGeoAreaMonitor class enables the detection of proximity changes for a specified set of coordinates.
A QGeoAreaMonitor emits signals when the current position is in range, or has moved out of range, of a specified circular area. The area is specified by a coordinate (the center point) and a radius (in meters).
For example:
public: MyClass::MyClass() { QGeoAreaMonitor *monitor = QGeoAreaMonitor::createDefaultMonitor(); connect(monitor, SIGNAL(areaEntered(QGeoPositionInfo)), this, SLOT(areaEntered(QGeoPositionInfo))); connect(monitor, SIGNAL(areaExited(QGeoPositionInfo)), this, SLOT(areaExited(QGeoPositionInfo))); QGeoCoordinate bigBenLocation(51.50104, -0.124632); monitor->setCenter(bigBenLocation); monitor->setRadius(100); } public Q_SLOTS: void areaEntered(const QGeoPositionInfo &update) { qDebug() << "Now within 100 meters, current position is" << update.coordinate(); } void areaExited(const QGeoPositionInfo &update) { qDebug() << "No longer within 100 meters, current position is" << update.coordinate(); }
This property holds the center of the area to be monitored.
When the center is set, if the radius has already been set and the current position is within the monitored area, areaEntered() is emitted immediately.
By default, contains an invalid coordinate.
Note: Subclass implementations must call the base implementation of setCenter() so that center() returns the correct value.
This property was introduced in Qt Mobility 1.0.
Access functions:
QGeoCoordinate | center () const |
virtual void | setCenter ( const QGeoCoordinate & coordinate ) |
This property holds the radius of the area to be monitored, in meters.
If the specified radius is less than the minimum supported radius, the radius is set to the minimum radius.
When this property is set, if the center coordinate has already been set and the current position is within the monitored area, areaEntered() is emitted immediately.
By default, this property is 0.
Note: Subclass implementations must call the base implementation of setRadius() so that radius() returns the correct value.
This property was introduced in Qt Mobility 1.0.
Access functions:
qreal | radius () const |
virtual void | setRadius ( qreal radius ) |
Creates a monitor with the given parent.
Destroys the monitor.
Emitted when the current position has moved from a position outside the monitored area to a position within the monitored area.
The update holds the new position.
This function was introduced in Qt Mobility 1.0.
Emitted when the current position has moved from a position within the monitored area to a position outside the monitored area.
The update holds the new position.
This function was introduced in Qt Mobility 1.0.
Creates and returns a monitor with the given parent that monitors areas using resources on the underlying system.
Returns 0 if the system has no support for position monitoring.
Note: Symbian applications will need to have the Location capability otherwise this will return 0.
This function was introduced in Qt Mobility 1.0.
© 2008-2011 Nokia Corporation and/or its subsidiaries. Nokia, Qt and their respective logos are trademarks of Nokia Corporation in Finland and/or other countries worldwide.
All other trademarks are property of their respective owners. Privacy Policy
Licensees holding valid Qt Commercial licenses may use this document in accordance with the Qt Commercial License Agreement provided with the Software or, alternatively, in accordance with the terms contained in a written agreement between you and Nokia.
Alternatively, this document may be used under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation.