Plugin QML Type

The Plugin type describes a Location based services plugin. More...

Import Statement: import QtLocation 5.12
Since: QtLocation 5.5

Properties

Methods

Detailed Description

The Plugin type is used to declaratively specify which available GeoServices plugin should be used for various tasks in the Location API. Plugins are used by Map, RouteModel, and GeocodeModel types, as well as a variety of others.

Plugins recognized by the system have a name property, a simple string normally indicating the name of the service that the Plugin retrieves data from. They also have a variety of features, which can be test for using the supportsRouting(), supportsGeocoding(), supportsMapping(), supportsPlaces() and supportsNavigation() methods.

When a Plugin object is created, it is "detached" and not associated with any actual service plugin. Once it has received information via setting its name, preferred, or required properties, it will choose an appropriate service plugin to attach to. Plugin objects can only be attached once; to use multiple plugins, create multiple Plugin objects.

Example Usage

The following snippet shows a Plugin object being created with the required and preferred properties set. This Plugin will attach to the first found plugin that supports both mapping and geocoding, and will prefer plugins named "here" or "osm" to any others.

Plugin {
    id: plugin
    preferred: ["here", "osm"]
    required: Plugin.AnyMappingFeatures | Plugin.AnyGeocodingFeatures
}

Property Documentation

allowExperimental : bool

This property indicates if experimental plugins can be used.


availableServiceProviders : stringlist

This property holds a list of all available service plugins' names. This can be used to manually enumerate the available plugins if the control provided by name and required is not sufficient for your needs.


isAttached : bool

This property indicates if the Plugin item is attached to a geoservice provider plugin.


locales : stringlist

This property contains an ordered list of preferred plugin locales. If the first locale cannot be accommodated, then the backend falls back to using the second, and so on. By default the locales property contains the system locale.

The locales are specified as strings which have the format "language[_script][_country]" or "C", where:

  • language is a lowercase, two-letter, ISO 639 language code,
  • script is a titlecase, four-letter, ISO 15924 script code,
  • country is an uppercase, two- or three-letter, ISO 3166 country code (also "419" as defined by United Nations),
  • the "C" locale is identical in behavior to English/UnitedStates as per QLocale

If the first specified locale cannot be accommodated, the Plugin falls back to the next and so forth. Some Plugin backends may not support a set of locales which are rigidly defined. An arbitrary example is that some Place's in France could have French and English localizations, while certain areas in America may only have the English localization available. In the above scenario, the set of supported locales is context dependent on the search location.

If the Plugin cannot accommodate any of the preferred locales, the manager falls back to using a supported language that is backend specific.

For Plugin's that do not support locales, the locales list is always empty.

The following code demonstrates how to set a single and multiple locales:

//single locale
Plugin {
    locales: "en_US"
}

//multiple locales
Plugin {
    locales: ["fr_FR","en_US"]
}

name : string

This property holds the name of the plugin. Setting this property will cause the Plugin to only attach to a plugin with exactly this name. The value of required will be ignored.


[default] parameters : list<PluginParameter>

This property holds the list of plugin parameters.


preferred : stringlist

This property contains an ordered list of preferred plugin names, which will be checked for the required features set in required before any other available plugins are checked.


required : enumeration

This property contains the set of features that will be required by the Plugin object when choosing which service plugin to attach to. If the name property is set, this has no effect.

Any of the following values or a bitwise combination of multiple values may be set:

  • Plugin.NoFeatures
  • Plugin.GeocodingFeature
  • Plugin.ReverseGeocodingFeature
  • Plugin.RoutingFeature
  • Plugin.MappingFeature
  • Plugin.AnyPlacesFeature

Method Documentation

bool supportsGeocoding(GeocodingFeatures features)

This method returns a boolean indicating whether the specified set of features are supported by the geo service provider plugin. True is returned if all specified features are supported; otherwise false is returned.

The features parameter can be any flag combination of:

FeatureDescription
Plugin.NoGeocodingFeaturesNo geocoding features are supported.
Plugin.OnlineGeocodingFeatureOnline geocoding is supported.
Plugin.OfflineGeocodingFeatureOffline geocoding is supported.
Plugin.ReverseGeocodingFeatureReverse geocoding is supported.
Plugin.LocalizedGeocodingFeatureSupports returning geocoding results with localized addresses.
Plugin.AnyGeocodingFeaturesMatches a geo service provider that provides any geocoding features.

bool supportsMapping(MappingFeatures features)

This method returns a boolean indicating whether the specified set of features are supported by the geo service provider plugin. True is returned if all specified features are supported; otherwise false is returned.

The features parameter can be any flag combination of:

FeatureDescription
Plugin.NoMappingFeaturesNo mapping features are supported.
Plugin.OnlineMappingFeatureOnline mapping is supported.
Plugin.OfflineMappingFeatureOffline mapping is supported.
Plugin.LocalizedMappingFeatureSupports returning localized map data.
Plugin.AnyMappingFeaturesMatches a geo service provider that provides any mapping features.

bool supportsNavigation(NavigationFeatures features)

This method returns a boolean indicating whether the specified set of features are supported by the geo service provider plugin. True is returned if all specified features are supported; otherwise false is returned.

The features parameter can be any flag combination of:

FeatureDescription
Plugin.NoNavigationFeaturesNo navigation features are supported.
Plugin.OnlineNavigationFeatureOnline navigation is supported.
Plugin.OfflineNavigationFeatureOffline navigation is supported.
Plugin.AnyNavigationFeaturesMatches a geo service provider that provides any navigation features.

bool supportsPlaces(PlacesFeatures features)

This method returns a boolean indicating whether the specified set of features are supported by the geo service provider plugin. True is returned if all specified features are supported; otherwise false is returned.

The features parameter can be any flag combination of:

FeatureDescription
Plugin.NoPlacesFeaturesNo places features are supported.
Plugin.OnlinePlacesFeatureOnline places is supported.
Plugin.OfflinePlacesFeatureOffline places is supported.
Plugin.SavePlaceFeatureSaving categories is supported.
Plugin.RemovePlaceFeatureRemoving or deleting places is supported.
Plugin.PlaceRecommendationsFeatureSearching for recommended places similar to another place is supported.
Plugin.SearchSuggestionsFeatureSearch suggestions is supported.
Plugin.LocalizedPlacesFeatureSupports returning localized place data.
Plugin.NotificationsFeatureNotifications of place and category changes is supported.
Plugin.PlaceMatchingFeatureSupports matching places from two different geo service providers.
Plugin.AnyPlacesFeaturesMatches a geo service provider that provides any places features.

bool supportsRouting(RoutingFeatures features)

This method returns a boolean indicating whether the specified set of features are supported by the geo service provider plugin. True is returned if all specified features are supported; otherwise false is returned.

The features parameter can be any flag combination of:

FeatureDescription
Plugin.NoRoutingFeaturesNo routing features are supported.
Plugin.OnlineRoutingFeatureOnline routing is supported.
Plugin.OfflineRoutingFeatureOffline routing is supported.
Plugin.LocalizedRoutingFeatureSupports returning routes with localized addresses and instructions.
Plugin.RouteUpdatesFeatureUpdating an existing route based on the current position is supported.
Plugin.AlternativeRoutesFeatureSupports returning alternative routes.
Plugin.ExcludeAreasRoutingFeatureSupports specifying a areas which the returned route must not cross.
Plugin.AnyRoutingFeaturesMatches a geo service provider that provides any routing features.

© 2021 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.