![]() |
Qt 6.x
The Qt SDK
|
#include <qgeoareamonitor_polling.h>
Public Member Functions | |
QGeoAreaMonitorPolling (QObject *parent=0) | |
~QGeoAreaMonitorPolling () | |
void | setPositionInfoSource (QGeoPositionInfoSource *source) override |
Sets the new \l QGeoPositionInfoSource to be used by this QGeoAreaMonitorSource object. | |
QGeoPositionInfoSource * | positionInfoSource () const override |
Returns the current QGeoPositionInfoSource used by this QGeoAreaMonitorSource object. | |
Error | error () const override |
Returns the type of error that last occurred. | |
bool | startMonitoring (const QGeoAreaMonitorInfo &monitor) override |
Returns true if the monitoring of monitor could be successfully started; otherwise returns false . | |
bool | requestUpdate (const QGeoAreaMonitorInfo &monitor, const char *signal) override |
Enables single shot area monitoring. | |
bool | stopMonitoring (const QGeoAreaMonitorInfo &monitor) override |
Returns true if monitor was successfully removed from the list of \l activeMonitors(); otherwise returns false. | |
QList< QGeoAreaMonitorInfo > | activeMonitors () const override |
Returns the list of all active monitors known to the QGeoAreaMonitorSource object. | |
QList< QGeoAreaMonitorInfo > | activeMonitors (const QGeoShape ®ion) const override |
Returns the list of all active monitors known to the QGeoAreaMonitorSource object whose center lies within lookupArea. | |
QGeoAreaMonitorSource::AreaMonitorFeatures | supportedAreaMonitorFeatures () const override |
Returns the area monitoring features available to this source. | |
bool | isValid () |
![]() | |
QGeoAreaMonitorSource (QObject *parent) | |
Creates a monitor source with the given parent. | |
virtual | ~QGeoAreaMonitorSource () |
Destroys the monitor source. | |
virtual void | setPositionInfoSource (QGeoPositionInfoSource *source) |
Sets the new \l QGeoPositionInfoSource to be used by this QGeoAreaMonitorSource object. | |
virtual QGeoPositionInfoSource * | positionInfoSource () const |
Returns the current QGeoPositionInfoSource used by this QGeoAreaMonitorSource object. | |
QString | sourceName () const |
Returns the unique name of the area monitor source implementation in use. | |
virtual Error | error () const =0 |
Returns the type of error that last occurred. | |
virtual AreaMonitorFeatures | supportedAreaMonitorFeatures () const =0 |
Returns the area monitoring features available to this source. | |
virtual bool | startMonitoring (const QGeoAreaMonitorInfo &monitor)=0 |
Returns true if the monitoring of monitor could be successfully started; otherwise returns false . | |
virtual bool | stopMonitoring (const QGeoAreaMonitorInfo &monitor)=0 |
Returns true if monitor was successfully removed from the list of \l activeMonitors(); otherwise returns false. | |
virtual bool | requestUpdate (const QGeoAreaMonitorInfo &monitor, const char *signal)=0 |
Enables single shot area monitoring. | |
virtual QList< QGeoAreaMonitorInfo > | activeMonitors () const =0 |
Returns the list of all active monitors known to the QGeoAreaMonitorSource object. | |
virtual QList< QGeoAreaMonitorInfo > | activeMonitors (const QGeoShape &lookupArea) const =0 |
Returns the list of all active monitors known to the QGeoAreaMonitorSource object whose center lies within lookupArea. | |
virtual bool | setBackendProperty (const QString &name, const QVariant &value) |
virtual QVariant | backendProperty (const QString &name) const |
![]() | |
Q_INVOKABLE | QObject (QObject *parent=nullptr) |
Constructs an object with parent object parent. | |
virtual | ~QObject () |
Destroys the object, deleting all its child objects. | |
virtual bool | event (QEvent *event) |
This virtual function receives events to an object and should return true if the event e was recognized and processed. | |
virtual bool | eventFilter (QObject *watched, QEvent *event) |
Filters events if this object has been installed as an event filter for the watched object. | |
QString | objectName () const |
Q_WEAK_OVERLOAD void | setObjectName (const QString &name) |
Sets the object's name to name. | |
void | setObjectName (QAnyStringView name) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
QBindable< QString > | bindableObjectName () |
bool | isWidgetType () const |
Returns true if the object is a widget; otherwise returns false . | |
bool | isWindowType () const |
Returns true if the object is a window; otherwise returns false . | |
bool | isQuickItemType () const |
Returns true if the object is a QQuickItem; otherwise returns false . | |
bool | signalsBlocked () const noexcept |
Returns true if signals are blocked; otherwise returns false . | |
bool | blockSignals (bool b) noexcept |
If block is true, signals emitted by this object are blocked (i.e., emitting a signal will not invoke anything connected to it). | |
QThread * | thread () const |
Returns the thread in which the object lives. | |
void | moveToThread (QThread *thread) |
Changes the thread affinity for this object and its children. | |
int | startTimer (int interval, Qt::TimerType timerType=Qt::CoarseTimer) |
This is an overloaded function that will start a timer of type timerType and a timeout of interval milliseconds. | |
int | startTimer (std::chrono::milliseconds time, Qt::TimerType timerType=Qt::CoarseTimer) |
void | killTimer (int id) |
Kills the timer with timer identifier, id. | |
template<typename T > | |
T | findChild (const QString &aName=QString(), Qt::FindChildOptions options=Qt::FindChildrenRecursively) const |
Returns the child of this object that can be cast into type T and that is called name, or \nullptr if there is no such object. | |
template<typename T > | |
QList< T > | findChildren (const QString &aName, Qt::FindChildOptions options=Qt::FindChildrenRecursively) const |
Returns all children of this object with the given name that can be cast to type T, or an empty list if there are no such objects. | |
template<typename T > | |
QList< T > | findChildren (Qt::FindChildOptions options=Qt::FindChildrenRecursively) const |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
const QObjectList & | children () const |
Returns a list of child objects. | |
void | setParent (QObject *parent) |
Makes the object a child of parent. | |
void | installEventFilter (QObject *filterObj) |
Installs an event filter filterObj on this object. | |
void | removeEventFilter (QObject *obj) |
Removes an event filter object obj from this object. | |
QMetaObject::Connection | connect (const QObject *sender, const char *signal, const char *member, Qt::ConnectionType type=Qt::AutoConnection) const |
bool | disconnect (const char *signal=nullptr, const QObject *receiver=nullptr, const char *member=nullptr) const |
bool | disconnect (const QObject *receiver, const char *member=nullptr) const |
void | dumpObjectTree () const |
Dumps a tree of children to the debug output. | |
void | dumpObjectInfo () const |
Dumps information about signal connections, etc. | |
bool | setProperty (const char *name, const QVariant &value) |
Sets the value of the object's name property to value. | |
bool | setProperty (const char *name, QVariant &&value) |
QVariant | property (const char *name) const |
Returns the value of the object's name property. | |
QList< QByteArray > | dynamicPropertyNames () const |
QBindingStorage * | bindingStorage () |
const QBindingStorage * | bindingStorage () const |
QObject * | parent () const |
Returns a pointer to the parent object. | |
bool | inherits (const char *classname) const |
Returns true if this object is an instance of a class that inherits className or a QObject subclass that inherits className; otherwise returns false . | |
Private Member Functions | |
void | connectNotify (const QMetaMethod &signal) override |
void | disconnectNotify (const QMetaMethod &signal) override |
Friends | |
class | QGeoAreaMonitorPollingPrivate |
Additional Inherited Members | |
![]() | |
enum | Error { AccessError = 0 , InsufficientPositionInfo = 1 , UnknownSourceError = 2 , NoError = 3 } |
Defines the types of positioning methods. More... | |
enum | AreaMonitorFeature { PersistentAreaMonitorFeature = 0x00000001 , AnyAreaMonitorFeature = 0xffffffff } |
Defines the types of area monitoring capabilities. More... | |
![]() | |
void | deleteLater () |
\threadsafe | |
![]() | |
void | areaEntered (const QGeoAreaMonitorInfo &monitor, const QGeoPositionInfo &update) |
Emitted when the current position has moved from a position outside of the active monitor to a position within the monitored area. | |
void | areaExited (const QGeoAreaMonitorInfo &monitor, const QGeoPositionInfo &update) |
Emitted when the current position has moved from a position within the active monitor to a position outside the monitored area. | |
void | monitorExpired (const QGeoAreaMonitorInfo &monitor) |
Emitted when monitor has expired. | |
void | errorOccurred (QGeoAreaMonitorSource::Error error) |
This signal is emitted after an error occurred. | |
![]() | |
void | destroyed (QObject *=nullptr) |
This signal is emitted immediately before the object obj is destroyed, after any instances of QPointer have been notified, and cannot be blocked. | |
void | objectNameChanged (const QString &objectName, QPrivateSignal) |
This signal is emitted after the object's name has been changed. | |
![]() | |
static QGeoAreaMonitorSource * | createDefaultSource (QObject *parent) |
Creates and returns a monitor source with the given parent that monitors areas using resources on the underlying system. | |
static QGeoAreaMonitorSource * | createSource (const QString &sourceName, QObject *parent) |
Creates and returns a monitor source with the given parent, by loading the plugin named sourceName. | |
static QStringList | availableSources () |
Returns a list of available monitor plugins, including the default system backend if one is available. | |
![]() | |
static QMetaObject::Connection | connect (const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection) |
\threadsafe | |
static QMetaObject::Connection | connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type=Qt::AutoConnection) |
template<typename Func1 , typename Func2 > | |
static QMetaObject::Connection | connect (const typename QtPrivate::FunctionPointer< Func1 >::Object *sender, Func1 signal, const typename QtPrivate::ContextTypeForFunctor< Func2 >::ContextType *context, Func2 &&slot, Qt::ConnectionType type=Qt::AutoConnection) |
template<typename Func1 , typename Func2 > | |
static QMetaObject::Connection | connect (const typename QtPrivate::FunctionPointer< Func1 >::Object *sender, Func1 signal, Func2 &&slot) |
static bool | disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *member) |
\threadsafe | |
static bool | disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &member) |
static bool | disconnect (const QMetaObject::Connection &) |
Disconnect a connection. | |
template<typename Func1 , typename Func2 > | |
static bool | disconnect (const typename QtPrivate::FunctionPointer< Func1 >::Object *sender, Func1 signal, const typename QtPrivate::FunctionPointer< Func2 >::Object *receiver, Func2 slot) |
template<typename Func1 > | |
static bool | disconnect (const typename QtPrivate::FunctionPointer< Func1 >::Object *sender, Func1 signal, const QObject *receiver, void **zero) |
![]() | |
QObject * | sender () const |
Returns a pointer to the object that sent the signal, if called in a slot activated by a signal; otherwise it returns \nullptr. | |
int | senderSignalIndex () const |
int | receivers (const char *signal) const |
Returns the number of receivers connected to the signal. | |
bool | isSignalConnected (const QMetaMethod &signal) const |
virtual void | timerEvent (QTimerEvent *event) |
This event handler can be reimplemented in a subclass to receive timer events for the object. | |
virtual void | childEvent (QChildEvent *event) |
This event handler can be reimplemented in a subclass to receive child events. | |
virtual void | customEvent (QEvent *event) |
This event handler can be reimplemented in a subclass to receive custom events. | |
virtual void | connectNotify (const QMetaMethod &signal) |
virtual void | disconnectNotify (const QMetaMethod &signal) |
QObject (QObjectPrivate &dd, QObject *parent=nullptr) | |
![]() | |
QScopedPointer< QObjectData > | d_ptr |
![]() | |
QString | objectName |
the name of this object | |
![]() | |
template< class T > T | qobject_cast (const QObject *object) |
Returns the given object cast to type T if the object is of type T (or of a subclass); otherwise returns \nullptr. | |
template< typename T > T | qFindChildqFindChildren (const QObject *obj, const QString &name)() |
template< typename T > QList< T > | qFindChildrenqFindChildren (const QObject *obj, const QString &name)() |
QObjectList | |
\macro Q_CLASSINFO(Name, Value) | |
Definition at line 17 of file qgeoareamonitor_polling.h.
|
explicit |
Definition at line 285 of file qgeoareamonitor_polling.cpp.
References QGeoPositionInfoSource::createDefaultSource(), and d.
QGeoAreaMonitorPolling::~QGeoAreaMonitorPolling | ( | ) |
Definition at line 294 of file qgeoareamonitor_polling.cpp.
References QGeoAreaMonitorPollingPrivate::deregisterClient().
|
overridevirtual |
Returns the list of all active monitors known to the QGeoAreaMonitorSource object.
An active monitor was started via startMonitoring(). For every active monitor the source object will emit the required signals, such as areaEntered() or areaExited(). Multiple \l QGeoAreaMonitorSource instances within the same application share the same active monitor objects.
Unless an active QGeoAreaMonitorInfo \l {QGeoAreaMonitorInfo::isPersistent()}{isPersistent()} an active QGeoAreaMonitorInfo will be stopped once the current application terminates.
Implements QGeoAreaMonitorSource.
Definition at line 391 of file qgeoareamonitor_polling.cpp.
References QGeoAreaMonitorPollingPrivate::activeMonitors(), and QHash< Key, T >::values().
|
overridevirtual |
Returns the list of all active monitors known to the QGeoAreaMonitorSource object whose center lies within lookupArea.
If lookupArea is empty the returned list will be empty.
An active monitor was started via startMonitoring(). For every active monitor the source object will emit the required signals, such as areaEntered() or areaExited(). Multiple \l QGeoAreaMonitorSource instances within the same application share the same active monitor objects.
Unless an active QGeoAreaMonitorInfo \l {QGeoAreaMonitorInfo::isPersistent()}{isPersistent()} an active QGeoAreaMonitorInfo will be stopped once the current application terminates.
Implements QGeoAreaMonitorSource.
Definition at line 396 of file qgeoareamonitor_polling.cpp.
References QGeoAreaMonitorPollingPrivate::activeMonitors(), QList< T >::append(), QGeoAreaMonitorInfo::area(), QGeoShape::center, QGeoShape::contains(), QGeoShape::isEmpty, list, and results.
|
overrideprivatevirtual |
This virtual function is called when something has been connected to signal in this object.
If you want to compare signal with a specific signal, you can use QMetaMethod::fromSignal() as follows:
Reimplemented from QObject.
Definition at line 416 of file qgeoareamonitor_polling.cpp.
References areaEnteredSignal(), areaExitedSignal(), QGeoAreaMonitorPollingPrivate::checkStartStop(), and signal.
|
overrideprivatevirtual |
This virtual function is called when something has been disconnected from signal in this object.
See connectNotify() for an example of how to compare signal with a specific signal.
If all signals were disconnected from this object (e.g., the signal argument to disconnect() was \nullptr), disconnectNotify() is only called once, and the signal will be an invalid QMetaMethod (QMetaMethod::isValid() returns false
).
Reimplemented from QObject.
Definition at line 427 of file qgeoareamonitor_polling.cpp.
References areaEnteredSignal(), areaExitedSignal(), QGeoAreaMonitorPollingPrivate::checkStartStop(), and signal.
|
overridevirtual |
Returns the type of error that last occurred.
Implements QGeoAreaMonitorSource.
Definition at line 309 of file qgeoareamonitor_polling.cpp.
|
inline |
Definition at line 39 of file qgeoareamonitor_polling.h.
References positionInfoSource().
|
overridevirtual |
Returns the current QGeoPositionInfoSource used by this QGeoAreaMonitorSource object.
The function will return \l QGeoPositionInfoSource::createDefaultSource() if no other object has been set.
The function returns nullptr
if not even a default QGeoPositionInfoSource exists.
Any usage of the returned \l QGeoPositionInfoSource instance should account for the fact that it may reside in a different thread.
Reimplemented from QGeoAreaMonitorSource.
Definition at line 299 of file qgeoareamonitor_polling.cpp.
References QGeoAreaMonitorPollingPrivate::positionSource().
Referenced by isValid().
|
overridevirtual |
Enables single shot area monitoring.
Area monitoring for monitor will be performed until this QGeoAreaMonitorSource instance emits signal for the first time. Once the signal was emitted, monitor is automatically removed from the list of \l activeMonitors(). If monitor is invalid or has an expiry date that has been passed, this function returns false
.
The above singleShotMonitor
object will cease to send updates once the \l areaExited() signal was emitted for the first time. Until this point in time any other signal may be emitted zero or more times depending on the area context.
It is not possible to simultanously request updates for more than one signal of the same monitor object. The last call to this function determines the signal upon which the updates cease to continue. At this stage only the \l areaEntered() and \l areaExited() signals can be used to terminate the monitoring process.
Requesting persistent monitoring on a QGeoAreaMonitorSource instance fails if the area monitoring backend doesn't support \l QGeoAreaMonitorSource::PersistentAreaMonitorFeature.
If monitor was already registered via \l startMonitoring() it is converted to a single shot behavior.
Implements QGeoAreaMonitorSource.
Definition at line 350 of file qgeoareamonitor_polling.cpp.
References areaEnteredSignal(), areaExitedSignal(), QDateTime::currentDateTime(), QGeoAreaMonitorInfo::expiration(), QGeoAreaMonitorInfo::isPersistent(), QDateTime::isValid(), QGeoAreaMonitorInfo::isValid(), QGeoAreaMonitorSource::NoError, QGeoAreaMonitorPollingPrivate::requestUpdate(), and signal.
|
overridevirtual |
Sets the new \l QGeoPositionInfoSource to be used by this QGeoAreaMonitorSource object.
The area monitoring backend becomes the new QObject parent for newSource. The previous \l QGeoPositionInfoSource object will be deleted. All QGeoAreaMonitorSource instances based on the same \l sourceName() share the same QGeoPositionInfoSource instance.
This may be useful when it is desirable to manipulate the positioning system used by the area monitoring engine.
Note that ownership must be taken care of by subclasses of QGeoAreaMonitorSource. Due to the singleton pattern behind this class newSource may be moved to a new thread.
Reimplemented from QGeoAreaMonitorSource.
Definition at line 304 of file qgeoareamonitor_polling.cpp.
References QGeoAreaMonitorPollingPrivate::setPositionSource().
|
overridevirtual |
Returns true
if the monitoring of monitor could be successfully started; otherwise returns false
.
A reason for not being able to start monitoring could be the unavailability of an appropriate default position info source while no alternative QGeoPositionInfoSource has been set via \l setPositionInfoSource().
If monitor is already active, the existing monitor object will be replaced by the new monitor reference. The identification of QGeoAreaMonitorInfo instances happens via \l QGeoAreaMonitorInfo::identifier(). Therefore this function can also be used to update active monitors.
If monitor has an expiry date that has been passed this function returns false. Calling this function for an already via \l requestUpdate() registered single shot monitor switches the monitor to a permanent monitoring mode.
Requesting persistent monitoring on a QGeoAreaMonitorSource instance fails if the area monitoring backend doesn't support \l QGeoAreaMonitorSource::PersistentAreaMonitorFeature.
Implements QGeoAreaMonitorSource.
Definition at line 314 of file qgeoareamonitor_polling.cpp.
References QDateTime::currentDateTime(), QGeoAreaMonitorInfo::expiration(), QGeoAreaMonitorInfo::isPersistent(), QDateTime::isValid(), QGeoAreaMonitorInfo::isValid(), QGeoAreaMonitorSource::NoError, and QGeoAreaMonitorPollingPrivate::startMonitoring().
|
overridevirtual |
Returns true if monitor was successfully removed from the list of \l activeMonitors(); otherwise returns false.
This behavior is independent on whether monitor was registered via \l startMonitoring() or \l requestUpdate().
Implements QGeoAreaMonitorSource.
Definition at line 384 of file qgeoareamonitor_polling.cpp.
References info, and QGeoAreaMonitorPollingPrivate::stopMonitoring().
|
overridevirtual |
Returns the area monitoring features available to this source.
Implements QGeoAreaMonitorSource.
Definition at line 411 of file qgeoareamonitor_polling.cpp.
|
friend |
Definition at line 49 of file qgeoareamonitor_polling.h.