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
qdeclarativegeoserviceprovider_p.h
Go to the documentation of this file.
1// Copyright (C) 2022 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#ifndef QDECLARATIVEQGEOSERVICEPROVIDER_H
5#define QDECLARATIVEQGEOSERVICEPROVIDER_H
6
7//
8// W A R N I N G
9// -------------
10//
11// This file is not part of the Qt API. It exists purely as an
12// implementation detail. This header file may change from version to
13// version without notice, or even be removed.
14//
15// We mean it.
16//
17
18#include <QtLocation/private/qlocationglobal_p.h>
19
20#include <QtCore/QMap>
21#include <QtCore/QString>
22#include <QtCore/QStringList>
23#include <QtCore/QVariant>
24#include <QtQml/qqml.h>
25#include <QtQml/QQmlParserStatus>
26#include <QtQml/QQmlListProperty>
27#include <QtLocation/QGeoServiceProvider>
28#include <QtPositioningQuick/private/qdeclarativepluginparameter_p.h>
29
31
33
34// From QtPositioning, needs to be registered in the Location module as well.
35// Can probably just be a QVariantMap?
42
43class Q_LOCATION_EXPORT QDeclarativeGeoServiceProvider : public QObject, public QQmlParserStatus
44{
46 QML_NAMED_ELEMENT(Plugin)
52
53 Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged)
54 Q_PROPERTY(QStringList availableServiceProviders READ availableServiceProviders CONSTANT)
56 Q_PROPERTY(QDeclarativeGeoServiceProviderRequirements *required READ requirements WRITE setRequirements)
57 Q_PROPERTY(QStringList locales READ locales WRITE setLocales NOTIFY localesChanged)
58 Q_PROPERTY(QStringList preferred READ preferred WRITE setPreferred NOTIFY preferredChanged)
59 Q_PROPERTY(bool allowExperimental READ allowExperimental WRITE setAllowExperimental NOTIFY allowExperimentalChanged)
60 Q_PROPERTY(bool isAttached READ isAttached NOTIFY attached)
61
62 Q_CLASSINFO("DefaultProperty", "parameters")
64
65public:
68
79
88
96
112
119
120 Q_DECLARE_FLAGS(RoutingFeatures, RoutingFeature)
121 Q_FLAGS(RoutingFeatures)
122
123 Q_DECLARE_FLAGS(GeocodingFeatures, GeocodingFeature)
124 Q_FLAGS(GeocodingFeatures)
125
126 Q_DECLARE_FLAGS(MappingFeatures, MappingFeature)
127 Q_FLAGS(MappingFeatures)
128
129 Q_DECLARE_FLAGS(PlacesFeatures, PlacesFeature)
130 Q_FLAGS(PlacesFeatures)
131
132 Q_DECLARE_FLAGS(NavigationFeatures, NavigationFeature)
133 Q_FLAGS(NavigationFeatures)
134
135 // From QQmlParserStatus
136 void classBegin() override {}
137 void componentComplete() override;
138
139 void setName(const QString &name);
140 QString name() const;
141
142 QQmlListProperty<QDeclarativePluginParameter> parameters();
143 QVariantMap parameterMap() const;
144
146
147 QDeclarativeGeoServiceProviderRequirements *requirements() const;
148 void setRequirements(QDeclarativeGeoServiceProviderRequirements *req);
149
150 QStringList preferred() const;
151 void setPreferred(const QStringList &val);
152
153 QGeoServiceProvider *sharedGeoServiceProvider() const;
154
155 Q_INVOKABLE bool supportsRouting(const RoutingFeatures &feature = AnyRoutingFeatures) const;
156 Q_INVOKABLE bool supportsGeocoding(const GeocodingFeatures &feature = AnyGeocodingFeatures) const;
157 Q_INVOKABLE bool supportsMapping(const MappingFeatures &feature = AnyMappingFeatures) const;
158 Q_INVOKABLE bool supportsPlaces(const PlacesFeatures &feature = AnyPlacesFeatures) const;
159 Q_REVISION(11) Q_INVOKABLE bool supportsNavigation(const NavigationFeature &feature = AnyNavigationFeatures) const;
160
161 QStringList locales() const;
162 void setLocales(const QStringList &locales);
163
164 bool isAttached() const;
165
166 void setAllowExperimental(bool allow);
167 bool allowExperimental() const;
168
170 void nameChanged(const QString &name);
171 void localesChanged();
172 void attached();
173 void preferredChanged(const QStringList &preferences);
174 void allowExperimentalChanged(bool allow);
175
176private:
177 bool parametersReady();
178 void tryAttach();
179 static void parameter_append(QQmlListProperty<QDeclarativePluginParameter> *prop, QDeclarativePluginParameter *mapObject);
180 static qsizetype parameter_count(QQmlListProperty<QDeclarativePluginParameter> *prop);
182 static void parameter_clear(QQmlListProperty<QDeclarativePluginParameter> *prop);
183
184 std::unique_ptr<QGeoServiceProvider> sharedProvider_;
185 QString name_;
186 QList<QDeclarativePluginParameter *> parameters_;
187 std::unique_ptr<QDeclarativeGeoServiceProviderRequirements> required_;
188 bool complete_ = false;
189 bool experimental_ = false;
190 QStringList locales_;
191 QStringList prefer_;
192 Q_DISABLE_COPY(QDeclarativeGeoServiceProvider)
193};
194
196{
198 QML_NAMED_ELEMENT(PluginRequirements)
199 QML_UNCREATABLE("PluginRequirements is not intended instantiable by developer.")
202 READ mappingRequirements WRITE setMappingRequirements
203 NOTIFY mappingRequirementsChanged)
205 READ routingRequirements WRITE setRoutingRequirements
206 NOTIFY routingRequirementsChanged)
207 Q_PROPERTY(QDeclarativeGeoServiceProvider::GeocodingFeatures geocoding
208 READ geocodingRequirements WRITE setGeocodingRequirements
209 NOTIFY geocodingRequirementsChanged)
211 READ placesRequirements WRITE setPlacesRequirements
212 NOTIFY placesRequirementsChanged)
213 Q_PROPERTY(QDeclarativeGeoServiceProvider::NavigationFeatures navigation
214 READ navigationRequirements WRITE setNavigationRequirements
215 NOTIFY navigationRequirementsChanged)
216
217public:
220
221 QDeclarativeGeoServiceProvider::MappingFeatures mappingRequirements() const;
222 void setMappingRequirements(const QDeclarativeGeoServiceProvider::MappingFeatures &features);
223
224 QDeclarativeGeoServiceProvider::RoutingFeatures routingRequirements() const;
225 void setRoutingRequirements(const QDeclarativeGeoServiceProvider::RoutingFeatures &features);
226
227 QDeclarativeGeoServiceProvider::GeocodingFeatures geocodingRequirements() const;
228 void setGeocodingRequirements(const QDeclarativeGeoServiceProvider::GeocodingFeatures &features);
229
230 QDeclarativeGeoServiceProvider::PlacesFeatures placesRequirements() const;
231 void setPlacesRequirements(const QDeclarativeGeoServiceProvider::PlacesFeatures &features);
232
233 QDeclarativeGeoServiceProvider::NavigationFeatures navigationRequirements() const;
234 void setNavigationRequirements(const QDeclarativeGeoServiceProvider::NavigationFeatures &features);
235
236 Q_INVOKABLE bool matches(const QGeoServiceProvider *provider) const;
237
238 bool operator == (const QDeclarativeGeoServiceProviderRequirements &rhs) const;
239
241 void mappingRequirementsChanged(const QDeclarativeGeoServiceProvider::MappingFeatures &features);
242 void routingRequirementsChanged(const QDeclarativeGeoServiceProvider::RoutingFeatures &features);
243 void geocodingRequirementsChanged(const QDeclarativeGeoServiceProvider::GeocodingFeatures &features);
244 void placesRequirementsChanged(const QDeclarativeGeoServiceProvider::PlacesFeatures &features);
245 void navigationRequirementsChanged(const QDeclarativeGeoServiceProvider::NavigationFeatures &features);
246
247 void requirementsChanged();
248
249private:
250 QDeclarativeGeoServiceProvider::MappingFeatures mapping_ = QDeclarativeGeoServiceProvider::NoMappingFeatures;
251 QDeclarativeGeoServiceProvider::RoutingFeatures routing_ = QDeclarativeGeoServiceProvider::NoRoutingFeatures;
252 QDeclarativeGeoServiceProvider::GeocodingFeatures geocoding_ = QDeclarativeGeoServiceProvider::NoGeocodingFeatures;
253 QDeclarativeGeoServiceProvider::PlacesFeatures places_ = QDeclarativeGeoServiceProvider::NoPlacesFeatures;
254 QDeclarativeGeoServiceProvider::NavigationFeatures navigation_ = QDeclarativeGeoServiceProvider::NoNavigationFeatures;
255};
256
258
261
262#endif
Q_REVISION(11) Q_INVOKABLE bool supportsNavigation(const NavigationFeature &feature
QStringList availableServiceProviders()
QQmlListProperty< QDeclarativePluginParameter > parameters()
\inmodule QtLocation
Definition qlist.h:75
\inmodule QtCore
Definition qobject.h:103
The QQmlListProperty class allows applications to expose list-like properties of QObject-derived clas...
Definition qqmllist.h:24
The QQmlParserStatus class provides updates on the QML parser state.
\inmodule QtCore
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:129
employee setName("Richard Schmit")
Combined button and popup list for selecting options.
DBusConnection const char DBusError DBusBusType DBusError return DBusConnection DBusHandleMessageFunction void DBusFreeFunction return DBusConnection return DBusConnection return const char DBusError return DBusConnection DBusMessage dbus_uint32_t return DBusConnection dbus_bool_t DBusConnection DBusAddWatchFunction DBusRemoveWatchFunction DBusWatchToggledFunction void DBusFreeFunction return DBusConnection DBusDispatchStatusFunction void DBusFreeFunction DBusTimeout return DBusTimeout return DBusWatch return DBusWatch unsigned int return DBusError const DBusError return const DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessageIter int const void return DBusMessageIter DBusMessageIter return DBusMessageIter void DBusMessageIter void int return DBusMessage DBusMessageIter return DBusMessageIter return DBusMessageIter DBusMessageIter const char const char const char const char return DBusMessage return DBusMessage const char return DBusMessage dbus_bool_t return DBusMessage dbus_uint32_t return DBusMessage void
#define Q_DECLARE_FLAGS(Flags, Enum)
Definition qflags.h:174
static bool matches(const QJsonObject &object, const QString &osName, const QVersionNumber &kernelVersion, const QString &osRelease, const QOpenGLConfig::Gpu &gpu)
Definition qopengl.cpp:270
GLuint index
[2]
GLuint name
GLuint GLfloat * val
GLenum GLenum GLenum GLenum mapping
#define QML_DECLARE_TYPE(TYPE)
Definition qqml.h:19
#define QML_UNCREATABLE(REASON)
#define QML_NAMED_ELEMENT(NAME)
#define QML_FOREIGN(FOREIGN_TYPE)
#define QML_ADDED_IN_VERSION(MAJOR, MINOR)
#define Q_PROPERTY(...)
#define Q_OBJECT
#define Q_CLASSINFO(name, value)
#define Q_INVOKABLE
#define Q_FLAGS(x)
#define Q_INTERFACES(x)
#define Q_GADGET
#define Q_ENUMS(x)
#define Q_SIGNALS
ptrdiff_t qsizetype
Definition qtypes.h:165
#define explicit