summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorMichal Klocek <michal.klocek@digia.com>2015-01-06 12:46:06 +0100
committerAlex Blasche <alexander.blasche@theqtcompany.com>2015-01-09 09:00:50 +0100
commit836f6d621a32eb12e8adbb59f4b2b20e8b666df6 (patch)
tree3097c374e226d5e3a83a51991af972cfd75e80ed /examples
parent3a48d5bf848ccd2b59eb4abbb3ee240bd688321c (diff)
downloadqtlocation-836f6d621a32eb12e8adbb59f4b2b20e8b666df6.tar.gz
Fix listing of plugins in mapviewer example
* list all location plugins which support mapping in mapviewer, adjust tools menu according to supported features * list providers in the same order * select provider in provider menu at startup Change-Id: Ic5fcc207929caab70b95f7204fd6a3665feeb23a Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
Diffstat (limited to 'examples')
-rw-r--r--examples/location/mapviewer/mapviewer.qml50
1 files changed, 26 insertions, 24 deletions
diff --git a/examples/location/mapviewer/mapviewer.qml b/examples/location/mapviewer/mapviewer.qml
index 9481676a..e6404004 100644
--- a/examples/location/mapviewer/mapviewer.qml
+++ b/examples/location/mapviewer/mapviewer.qml
@@ -135,9 +135,15 @@ Item {
}
function update(){
clear()
- addItem("Reverse geocode")
- addItem("Geocode")
- addItem("Route")
+ if (map.plugin.supportsGeocoding(Plugin.ReverseGeocodingFeature)) {
+ addItem("Reverse geocode")
+ }
+ if (map.plugin.supportsGeocoding()) {
+ addItem("Geocode")
+ }
+ if (map.plugin.supportsRouting()) {
+ addItem("Route")
+ }
var item = addItem("Follow me")
item.text = Qt.binding(function() { return map.followme ? "Stop following" : "Follow me" });
item = addItem("Minimap")
@@ -549,16 +555,13 @@ Item {
plugin = Qt.createQmlObject ('import QtLocation 5.3; Plugin{ name:"' + provider + '"; parameters: page.parameters}', page)
else
plugin = Qt.createQmlObject ('import QtLocation 5.3; Plugin{ name:"' + provider + '"}', page)
- if (plugin.supportsMapping()
- && plugin.supportsGeocoding(Plugin.ReverseGeocodingFeature)
- && plugin.supportsRouting()) {
- if (map) {
- map.destroy()
- minimap = null
- }
+ if (map) {
+ map.destroy()
+ minimap = null
+ }
- map = Qt.createQmlObject ('import QtLocation 5.3;\
+ map = Qt.createQmlObject ('import QtLocation 5.3;\
import "content/map";\
MapComponent{\
z : backgroundRect.z + 1;\
@@ -603,11 +606,13 @@ Item {
page.state = "";\
}\
}',page)
- map.plugin = plugin;
- tempGeocodeModel.plugin = plugin;
- mapTypeMenu.update();
- toolsMenu.update();
- }
+
+
+ map.plugin = plugin;
+ tempGeocodeModel.plugin = plugin;
+ mapTypeMenu.update();
+ toolsMenu.update();
+
}
function getPlugins(){
@@ -616,14 +621,10 @@ Item {
var myArray = new Array()
for (var i = 0; i<plugin.availableServiceProviders.length; i++){
tempPlugin = Qt.createQmlObject ('import QtLocation 5.3; Plugin {name: "' + plugin.availableServiceProviders[i]+ '"}', page)
-
- if (tempPlugin.supportsMapping()
- && tempPlugin.supportsGeocoding(Plugin.ReverseGeocodingFeature)
- && tempPlugin.supportsRouting()) {
+ if (tempPlugin.supportsMapping())
myArray.push(tempPlugin.name)
- }
}
-
+ myArray.sort()
return myArray
}
@@ -636,8 +637,9 @@ Item {
page.parameters=parameters
if (providerMenu.exclusiveButton !== "")
createMap(providerMenu.exclusiveButton);
- else if (providerMenu.children.length > 0)
- createMap(providerMenu.children[0].text);
+ else if (providerMenu.children.length > 0) {
+ providerMenu.exclusiveButton = providerMenu.children[0].text
+ }
}
//=====================States of page=====================