QGeoAreaMonitorInfo Class

The QGeoAreaMonitorInfo class describes the parameters of an area or region to be monitored for proximity. 更多...

头: #include <QGeoAreaMonitorInfo>
CMake: find_package(Qt6 REQUIRED COMPONENTS Positioning)
target_link_libraries(mytarget PRIVATE Qt6::Positioning)
qmake: QT += positioning

公共函数

QGeoAreaMonitorInfo (const QString & name = QString())
QGeoAreaMonitorInfo (const QGeoAreaMonitorInfo & other )
(从 6.2 起) QGeoAreaMonitorInfo (QGeoAreaMonitorInfo && other )
~QGeoAreaMonitorInfo ()
QGeoShape area () const
QDateTime expiration () const
QString 标识符 () const
bool isPersistent () const
bool isValid () const
QString name () const
QVariantMap notificationParameters () const
void setArea (const QGeoShape & newShape )
void setExpiration (const QDateTime & expiry )
void setName (const QString & name )
void setNotificationParameters (const QVariantMap & 参数 )
void setPersistent (bool isPersistent )
QGeoAreaMonitorInfo & operator= (const QGeoAreaMonitorInfo & other )
(从 6.2 起) QGeoAreaMonitorInfo & operator= (QGeoAreaMonitorInfo && other )
bool operator!= (const QGeoAreaMonitorInfo & lhs , const QGeoAreaMonitorInfo & rhs )
QDataStream & operator<< (QDataStream & stream , const QGeoAreaMonitorInfo & monitor )
bool operator== (const QGeoAreaMonitorInfo & lhs , const QGeoAreaMonitorInfo & rhs )
QDataStream & operator>> (QDataStream & stream , QGeoAreaMonitorInfo & monitor )

详细描述

The purpose of area monitoring is to inform a user when he/she comes close to an area of interest. In general such an area is described by a QGeoCircle . The circle's center represents the place of interest and the area around it identifies the geographical region within which notifications are sent.

A QGeoAreaMonitorInfo object is valid if it has a non-empty name and a valid area (). Such objects must be registered with a QGeoAreaMonitorSource to start and stop the monitoring process. Note that extensive monitoring can be very resource consuming because the positioning engine must remain active and has to match the current position with each QGeoAreaMonitorInfo instance.

To further reduce the burden on the system there are optional attributes which can set. Each monitored area can have an expiry date which automatically removes the to-be-monitored area from the monitoring source once the expiry date has been reached. Another option is to adjust the persistence of a monitored area. A QGeoAreaMonitorInfo that isPersistent () will remain active beyond the current applications lifetime. If an area is entered while the monitoring application is not running the application will be started. Note that this feature is not available on all platforms. Its availability can be checked via QGeoAreaMonitorSource::supportedAreaMonitorFeatures ().

另请参阅 QGeoAreaMonitorSource .

成员函数文档编制

[explicit] QGeoAreaMonitorInfo:: QGeoAreaMonitorInfo (const QString & name = QString())

Constructs a QGeoAreaMonitorInfo object with the specified name .

另请参阅 name ().

QGeoAreaMonitorInfo:: QGeoAreaMonitorInfo (const QGeoAreaMonitorInfo & other )

Constructs a QGeoAreaMonitorInfo object as a copy of other .

[noexcept, since 6.2] QGeoAreaMonitorInfo:: QGeoAreaMonitorInfo ( QGeoAreaMonitorInfo && other )

Constructs a QGeoAreaMonitorInfo object by moving from other .

Note that a moved-from QGeoAreaMonitorInfo can only be destroyed or assigned to. The effect of calling other functions than the destructor or one of the assignment operators is undefined.

该函数在 Qt 6.2 引入。

[noexcept] QGeoAreaMonitorInfo:: ~QGeoAreaMonitorInfo ()

析构函数

QGeoShape QGeoAreaMonitorInfo:: area () const

Returns the boundaries of the to-be-monitored area. This area must not be empty.

另请参阅 setArea ().

QDateTime QGeoAreaMonitorInfo:: expiration () const

Returns the expiry date.

After an active QGeoAreaMonitorInfo has expired the region is no longer monitored and the QGeoAreaMonitorInfo object is removed from the list of active monitors .

If the expiry QDateTime is invalid the QGeoAreaMonitorInfo object is treated as not having an expiry date. This implies an indefinite monitoring period if the object is persistent or until the current application closes if the object is non-persistent.

另请参阅 setExpiration () 和 QGeoAreaMonitorSource::activeMonitors ().

QString QGeoAreaMonitorInfo:: 标识符 () const

Returns the identifier of the QGeoAreaMonitorInfo object. The identifier is automatically generated upon construction of a new QGeoAreaMonitorInfo 对象。

bool QGeoAreaMonitorInfo:: isPersistent () const

返回 true 若 QGeoAreaMonitorInfo is persistent. The default value for this property is false.

A non-persistent QGeoAreaMonitorInfo will be removed by the system once the application owning the monitor object stops. Persistent objects remain active and can be retrieved once the application restarts.

If the system triggers an event associated to a persistent QGeoAreaMonitorInfo the relevant application will be re-started and the appropriate signal emitted.

另请参阅 setPersistent ().

bool QGeoAreaMonitorInfo:: isValid () const

Returns true, if the monitor is valid. A valid QGeoAreaMonitorInfo has a non-empty name () and the monitored area is not empty (). Otherwise this function returns false.

QString QGeoAreaMonitorInfo:: name () const

Returns the name of the QGeoAreaMonitorInfo object. The name should be used for user-visibility purposes.

另请参阅 setName ().

QVariantMap QGeoAreaMonitorInfo:: notificationParameters () const

Returns the set of platform specific parameters used by this QGeoAreaMonitorInfo .

另请参阅 setNotificationParameters ().

void QGeoAreaMonitorInfo:: setArea (const QGeoShape & newShape )

Sets the to-be-monitored area to newShape .

另请参阅 area ().

void QGeoAreaMonitorInfo:: setExpiration (const QDateTime & expiry )

Sets the expiry date and time to expiry .

另请参阅 expiration ().

void QGeoAreaMonitorInfo:: setName (const QString & name )

Sets the user visibile name .

另请参阅 name ().

void QGeoAreaMonitorInfo:: setNotificationParameters (const QVariantMap & 参数 )

Sets the set of platform specific 参数 used by QGeoAreaMonitorInfo .

另请参阅 notificationParameters ().

void QGeoAreaMonitorInfo:: setPersistent ( bool isPersistent )

设置 QGeoAreaMonitorInfo object's persistence to isPersistent .

Note that setting this flag does not imply that QGeoAreaMonitorSource supports persistent monitoring. QGeoAreaMonitorSource::supportedAreaMonitorFeatures () can be used to check for this feature's availability.

另请参阅 isPersistent ().

QGeoAreaMonitorInfo &QGeoAreaMonitorInfo:: operator= (const QGeoAreaMonitorInfo & other )

赋值 other 到此 QGeoAreaMonitorInfo 对象并返回引用为此 QGeoAreaMonitorInfo 对象。

[noexcept, since 6.2] QGeoAreaMonitorInfo &QGeoAreaMonitorInfo:: operator= ( QGeoAreaMonitorInfo && other )

移动赋值 other 到此 QGeoAreaMonitorInfo 对象并返回引用为此 QGeoAreaMonitorInfo 对象。

Note that a moved-from QGeoAreaMonitorInfo can only be destroyed or assigned to. The effect of calling other functions than the destructor or one of the assignment operators is undefined.

该函数在 Qt 6.2 引入。

相关非成员

bool operator!= (const QGeoAreaMonitorInfo & lhs , const QGeoAreaMonitorInfo & rhs )

返回 true if any of the lhs object's values are not the same as those of rhs object. Otherwise returns false .

QDataStream & operator<< ( QDataStream & stream , const QGeoAreaMonitorInfo & monitor )

写入给定 monitor 到指定 stream .

另请参阅 序列化 Qt 数据类型 .

bool operator== (const QGeoAreaMonitorInfo & lhs , const QGeoAreaMonitorInfo & rhs )

返回 true if all of the lhs object's values are the same as those of rhs object. Otherwise returns false .

QDataStream & operator>> ( QDataStream & stream , QGeoAreaMonitorInfo & monitor )

Reads a area monitoring data from the specified stream 进给定 monitor .

另请参阅 序列化 Qt 数据类型 .