diff options
Diffstat (limited to 'src/location/declarativemaps')
-rw-r--r-- | src/location/declarativemaps/qdeclarativegeoserviceprovider.cpp | 20 | ||||
-rw-r--r-- | src/location/declarativemaps/qdeclarativegeoserviceprovider_p.h | 5 |
2 files changed, 24 insertions, 1 deletions
diff --git a/src/location/declarativemaps/qdeclarativegeoserviceprovider.cpp b/src/location/declarativemaps/qdeclarativegeoserviceprovider.cpp index 54f70c11..4b8b2d7c 100644 --- a/src/location/declarativemaps/qdeclarativegeoserviceprovider.cpp +++ b/src/location/declarativemaps/qdeclarativegeoserviceprovider.cpp @@ -36,6 +36,7 @@ #include "qdeclarativegeoserviceprovider_p.h" #include <QtQml/QQmlInfo> +#include <QtQml/QQmlEngine> QT_BEGIN_NAMESPACE @@ -399,6 +400,19 @@ QDeclarativeGeoServiceProviderRequirements *QDeclarativeGeoServiceProvider::requ return required_; } +void QDeclarativeGeoServiceProvider::setRequirements(QDeclarativeGeoServiceProviderRequirements *req) +{ + if (!name().isEmpty() || !req) + return; + + if (required_ && *required_ == *req) + return; + + delete required_; + required_ = req; + QQmlEngine::setObjectOwnership(req, QQmlEngine::CppOwnership); // To prevent the engine from making this object disappear +} + /*! \qmlproperty stringlist Plugin::preferred @@ -732,6 +746,12 @@ bool QDeclarativeGeoServiceProviderRequirements::matches(const QGeoServiceProvid return true; } +bool QDeclarativeGeoServiceProviderRequirements::operator == (const QDeclarativeGeoServiceProviderRequirements &rhs) const +{ + return (mapping_ == rhs.mapping_ && routing_ == rhs.routing_ + && geocoding_ == rhs.geocoding_ && places_ == rhs.places_); +} + /******************************************************************************* *******************************************************************************/ diff --git a/src/location/declarativemaps/qdeclarativegeoserviceprovider_p.h b/src/location/declarativemaps/qdeclarativegeoserviceprovider_p.h index bcf67124..426c6b4d 100644 --- a/src/location/declarativemaps/qdeclarativegeoserviceprovider_p.h +++ b/src/location/declarativemaps/qdeclarativegeoserviceprovider_p.h @@ -100,7 +100,7 @@ class Q_LOCATION_PRIVATE_EXPORT QDeclarativeGeoServiceProvider : public QObject, Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged) Q_PROPERTY(QStringList availableServiceProviders READ availableServiceProviders CONSTANT) Q_PROPERTY(QQmlListProperty<QDeclarativeGeoServiceProviderParameter> parameters READ parameters) - Q_PROPERTY(QDeclarativeGeoServiceProviderRequirements *required READ requirements) + Q_PROPERTY(QDeclarativeGeoServiceProviderRequirements *required READ requirements WRITE setRequirements) Q_PROPERTY(QStringList locales READ locales WRITE setLocales NOTIFY localesChanged) Q_PROPERTY(QStringList preferred READ preferred WRITE setPreferred NOTIFY preferredChanged) Q_PROPERTY(bool allowExperimental READ allowExperimental WRITE setAllowExperimental NOTIFY allowExperimentalChanged) @@ -182,6 +182,7 @@ public: QStringList availableServiceProviders(); QDeclarativeGeoServiceProviderRequirements *requirements() const; + void setRequirements(QDeclarativeGeoServiceProviderRequirements *req); QStringList preferred() const; void setPreferred(const QStringList &val); @@ -259,6 +260,8 @@ public: Q_INVOKABLE bool matches(const QGeoServiceProvider *provider) const; + bool operator == (const QDeclarativeGeoServiceProviderRequirements &rhs) const; + Q_SIGNALS: void mappingRequirementsChanged(const QDeclarativeGeoServiceProvider::MappingFeatures &features); void routingRequirementsChanged(const QDeclarativeGeoServiceProvider::RoutingFeatures &features); |