5#include <QtQml/QQmlInfo>
6#include <QtQml/QQmlEngine>
88bool QDeclarativeGeoServiceProvider::parametersReady() {
90 if (!
p->isInitialized())
99void QDeclarativeGeoServiceProvider::tryAttach()
101 if (!parametersReady())
104 sharedProvider_.reset();
110 sharedProvider_->setQmlEngine(
qmlEngine(
this));
111 sharedProvider_->setLocale(
QLocale(locales_.at(0)));
112 sharedProvider_->setAllowExperimental(experimental_);
144 if (!
p->isInitialized()) {
146 this, &QDeclarativeGeoServiceProvider::tryAttach);
152 }
else if (!prefer_.isEmpty()
162 for (
const QString &
name : std::as_const(prefer_)) {
163 if (providers.contains(
name)) {
165 providers.removeAll(
name);
168 if (required_->matches(&
sp)) {
176 for (
const QString &
name : std::as_const(providers)) {
178 if (required_->matches(&
sp)) {
184 qmlWarning(
this) <<
"Could not find a plugin with the required features to attach to";
223 QGeoServiceProvider::GeocodingFeatures
f =
228 return (
sp && (
sp->geocodingFeatures() &
f) ==
f);
263 QGeoServiceProvider::MappingFeatures
f =
268 return (
sp && (
sp->mappingFeatures() &
f) ==
f);
312 QGeoServiceProvider::RoutingFeatures
f =
317 return (
sp && (
sp->routingFeatures() &
f) ==
f);
370 QGeoServiceProvider::PlacesFeatures
f =
375 return (
sp && (
sp->placesFeatures() &
f) ==
f);
407 QGeoServiceProvider::NavigationFeatures
f =
412 return (
sp && (
sp->navigationFeatures() &
f) ==
f);
436 return required_.get();
441 if (!
name().isEmpty() || !req)
444 if (required_ && *required_ == *req)
447 required_.reset(req);
476 return (sharedProvider_ != 0);
486 return experimental_;
491 if (experimental_ == allow)
494 experimental_ = allow;
496 sharedProvider_->setAllowExperimental(allow);
506 return sharedProvider_.get();
551 if (locales_.isEmpty())
555 sharedProvider_->setLocale(
QLocale(locales_.at(0)));
582 p->parameters_.
append(parameter);
583 if (
p->sharedProvider_)
584 p->sharedProvider_->setParameters(
p->parameterMap());
610 if (
p->sharedProvider_)
611 p->sharedProvider_->setParameters(
p->parameterMap());
621 for (
const auto *parameter : parameters_)
652 if (mapping_ == features)
673 if (routing_ == features)
694 if (geocoding_ == features)
697 geocoding_ = features;
716 if (places_ == features)
737 if (navigation_ == features)
740 navigation_ = features;
750 QGeoServiceProvider::MappingFeatures
mapping =
751 static_cast<QGeoServiceProvider::MappingFeatures
>(int(mapping_));
763 QGeoServiceProvider::RoutingFeatures
routing =
764 static_cast<QGeoServiceProvider::RoutingFeatures
>(int(routing_));
774 QGeoServiceProvider::GeocodingFeatures
geocoding =
775 static_cast<QGeoServiceProvider::GeocodingFeatures
>(int(geocoding_));
785 QGeoServiceProvider::PlacesFeatures
places =
786 static_cast<QGeoServiceProvider::PlacesFeatures
>(int(places_));
796 QGeoServiceProvider::NavigationFeatures
navigation =
797 static_cast<QGeoServiceProvider::NavigationFeatures
>(int(navigation_));
812 return (mapping_ == rhs.mapping_ && routing_ == rhs.routing_
813 && geocoding_ == rhs.geocoding_ && places_ == rhs.places_
814 && navigation_ == rhs.navigation_);
Q_INVOKABLE bool matches(const QGeoServiceProvider *provider) const
void requirementsChanged()
void placesRequirementsChanged(const QDeclarativeGeoServiceProvider::PlacesFeatures &features)
QDeclarativeGeoServiceProvider::GeocodingFeatures geocodingRequirements() const
void setMappingRequirements(const QDeclarativeGeoServiceProvider::MappingFeatures &features)
void setGeocodingRequirements(const QDeclarativeGeoServiceProvider::GeocodingFeatures &features)
void mappingRequirementsChanged(const QDeclarativeGeoServiceProvider::MappingFeatures &features)
void geocodingRequirementsChanged(const QDeclarativeGeoServiceProvider::GeocodingFeatures &features)
void setPlacesRequirements(const QDeclarativeGeoServiceProvider::PlacesFeatures &features)
void setNavigationRequirements(const QDeclarativeGeoServiceProvider::NavigationFeatures &features)
bool operator==(const QDeclarativeGeoServiceProviderRequirements &rhs) const
void navigationRequirementsChanged(const QDeclarativeGeoServiceProvider::NavigationFeatures &features)
QDeclarativeGeoServiceProvider::RoutingFeatures routing
~QDeclarativeGeoServiceProviderRequirements()
void setRoutingRequirements(const QDeclarativeGeoServiceProvider::RoutingFeatures &features)
QDeclarativeGeoServiceProvider::NavigationFeatures navigation
QDeclarativeGeoServiceProvider::NavigationFeatures navigationRequirements() const
QDeclarativeGeoServiceProvider::PlacesFeatures places
QDeclarativeGeoServiceProvider::RoutingFeatures routingRequirements() const
QDeclarativeGeoServiceProvider::GeocodingFeatures geocoding
void routingRequirementsChanged(const QDeclarativeGeoServiceProvider::RoutingFeatures &features)
QDeclarativeGeoServiceProviderRequirements(QObject *parent=nullptr)
QDeclarativeGeoServiceProvider::MappingFeatures mapping
QDeclarativeGeoServiceProvider::MappingFeatures mappingRequirements() const
QDeclarativeGeoServiceProvider::PlacesFeatures placesRequirements() const
void setRequirements(QDeclarativeGeoServiceProviderRequirements *req)
QStringList availableServiceProviders
\qmlproperty stringlist Plugin::availableServiceProviders
Q_INVOKABLE bool supportsRouting(const RoutingFeatures &feature=AnyRoutingFeatures) const
\qmlmethod bool Plugin::supportsRouting(RoutingFeatures features)
void setPreferred(const QStringList &val)
~QDeclarativeGeoServiceProvider()
void componentComplete() override
Q_INVOKABLE bool supportsMapping(const MappingFeatures &feature=AnyMappingFeatures) const
\qmlmethod bool Plugin::supportsMapping(MappingFeatures features)
QDeclarativeGeoServiceProvider(QObject *parent=nullptr)
The Plugin type describes a Location based services plugin.
void setAllowExperimental(bool allow)
QDeclarativeGeoServiceProviderRequirements * requirements() const
\qmlproperty enumeration Plugin::required
void preferredChanged(const QStringList &preferences)
void nameChanged(const QString &name)
QQmlListProperty< QDeclarativePluginParameter > parameters
\qmlproperty list<PluginParameter> Plugin::parameters \qmldefault
void setName(const QString &name)
\qmlproperty string Plugin::name
Q_INVOKABLE bool supportsPlaces(const PlacesFeatures &feature=AnyPlacesFeatures) const
\qmlmethod bool Plugin::supportsPlaces(PlacesFeatures features)
void allowExperimentalChanged(bool allow)
void setLocales(const QStringList &locales)
QVariantMap parameterMap() const
Q_INVOKABLE bool supportsGeocoding(const GeocodingFeatures &feature=AnyGeocodingFeatures) const
\qmlmethod bool Plugin::supportsGeocoding(GeocodingFeatures features)
QGeoServiceProvider * sharedGeoServiceProvider() const
RoutingFeature
Describes the routing features supported by the geo service provider.
MappingFeatures mappingFeatures() const
Returns the mapping features supported by the geo service provider.
MappingFeature
Describes the mapping features supported by the geo service provider.
PlacesFeature
Describes the places features supported by the geo service provider.
GeocodingFeature
Describes the geocoding features supported by the geo service provider.
PlacesFeatures placesFeatures() const
Returns the places features supported by the geo service provider.
RoutingFeatures routingFeatures() const
Returns the routing features supported by the geo service provider.
static QStringList availableServiceProviders()
GeocodingFeatures geocodingFeatures() const
Returns the geocoding features supported by the geo service provider.
NavigationFeatures navigationFeatures() const
Returns the navigation features supported by the geo service provider.
NavigationFeature
Describes the navigation features supported by the geo service provider.
static void setObjectOwnership(QObject *, ObjectOwnership)
Sets the ownership of object.
qsizetype count() const noexcept
void append(parameter_type t)
iterator insert(const Key &key, const T &value)
static QMetaObject::Connection connect(const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
\threadsafe
The QQmlListProperty class allows applications to expose list-like properties of QObject-derived clas...
\macro QT_RESTRICTED_CAST_FROM_ASCII
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
QMap< QString, QString > map
[6]
Combined button and popup list for selecting options.
GLenum GLenum GLenum GLenum mapping
QQmlEngine * qmlEngine(const QObject *obj)
Q_QML_EXPORT QQmlInfo qmlWarning(const QObject *me)
IUIAutomationTreeWalker __RPC__deref_out_opt IUIAutomationElement ** parent