Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qgeoareamonitorsource.cpp
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#include <QtCore/private/qobject_p.h>
5#include <QGeoAreaMonitorSource>
8
41
42
43
50
99
106
114{
115 const QList<QCborMap> plugins = QGeoPositionInfoSourcePrivate::pluginsSorted();
116 for (const QCborMap &obj : plugins) {
117 if (obj.value(QStringLiteral("Monitor")).isBool()
118 && obj.value(QStringLiteral("Monitor")).toBool())
119 {
120 QGeoAreaMonitorSource *s = nullptr;
122 if (factory)
123 s = factory->areaMonitor(parent, QVariantMap());
124 if (s)
125 s->d_func()->providerName = obj.value(QStringLiteral("Provider")).toString();
126 return s;
127 }
128 }
129 return nullptr;
130}
131
139{
141 if (plugins.contains(sourceName)) {
142 const auto metaData = plugins.value(sourceName);
143 QGeoAreaMonitorSource *s = nullptr;
145 if (factory)
146 s = factory->areaMonitor(parent, QVariantMap());
147 if (s)
148 s->d_func()->providerName = metaData.value(QStringLiteral("Provider")).toString();
149 return s;
150 }
151
152 return nullptr;
153}
154
160{
161 QStringList plugins;
162 const auto meta = QGeoPositionInfoSourcePrivate::plugins();
163 for (auto it = meta.cbegin(), end = meta.cend(); it != end; ++it) {
164 if (it.value().value(QStringLiteral("Monitor")).isBool()
165 && it.value().value(QStringLiteral("Monitor")).toBool()) {
166 plugins << it.key();
167 }
168 }
169
170 return plugins;
171}
172
180{
181 Q_D(const QGeoAreaMonitorSource);
182 return d->providerName;
183}
184
196{
197 Q_UNUSED(name);
199 return false;
200}
201
215
234
252{
254 d->source = newSource;
255}
256
257
397
398#include "moc_qgeoareamonitorsource.cpp"
\inmodule QtCore\reentrant
Definition qcbormap.h:21
\inmodule QtPositioning
static QGeoAreaMonitorSource * createDefaultSource(QObject *parent)
Creates and returns a monitor source with the given parent that monitors areas using resources on the...
virtual QGeoPositionInfoSource * positionInfoSource() const
Returns the current QGeoPositionInfoSource used by this QGeoAreaMonitorSource object.
virtual ~QGeoAreaMonitorSource()
Destroys the monitor source.
QString sourceName() const
Returns the unique name of the area monitor source implementation in use.
virtual QVariant backendProperty(const QString &name) const
static QGeoAreaMonitorSource * createSource(const QString &sourceName, QObject *parent)
Creates and returns a monitor source with the given parent, by loading the plugin named sourceName.
virtual bool setBackendProperty(const QString &name, const QVariant &value)
virtual void setPositionInfoSource(QGeoPositionInfoSource *source)
Sets the new \l QGeoPositionInfoSource to be used by this QGeoAreaMonitorSource object.
QGeoAreaMonitorSource(QObject *parent)
Creates a monitor source with the given parent.
static QStringList availableSources()
Returns a list of available monitor plugins, including the default system backend if one is available...
static QMultiHash< QString, QCborMap > plugins(bool reload=false)
static QList< QCborMap > pluginsSorted()
static QGeoPositionInfoSourceFactory * loadFactory(const QCborMap &meta)
\inmodule QtPositioning
\inmodule QtCore
Definition qobject.h:103
QObject * parent() const
Returns a pointer to the parent object.
Definition qobject.h:346
const_iterator cbegin() const noexcept
Definition qset.h:138
\inmodule QtCore
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:129
\inmodule QtCore
Definition qvariant.h:65
QSet< QString >::iterator it
Combined button and popup list for selecting options.
QMap< QString, QVariant > QVariantMap
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
GLuint GLuint end
GLuint name
GLhandleARB obj
[2]
GLdouble s
[6]
Definition qopenglext.h:235
#define QStringLiteral(str)
#define Q_UNUSED(x)
QItemEditorFactory * factory