QGeoAreaMonitor Class Reference
The QGeoAreaMonitor class enables the detection of proximity changes for a specified set of coordinates. More...
#include <QGeoAreaMonitor>
Properties
Public Functions
QGeoAreaMonitor ( QObject * parent ) | |
virtual | ~QGeoAreaMonitor () = 0 |
QGeoCoordinate | center () const |
qreal | radius () const |
virtual void | setCenter ( const QGeoCoordinate & coordinate ) |
virtual void | setRadius ( qreal radius ) |
Signals
void | areaEntered ( const QGeoPositionInfo & update ) |
void | areaExited ( const QGeoPositionInfo & update ) |
Static Public Members
QGeoAreaMonitor * | createDefaultMonitor ( QObject * parent ) |
Detailed Description
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(); }