diff options
author | Paolo Angelelli <paolo.angelelli@theqtcompany.com> | 2016-01-21 17:04:38 +0100 |
---|---|---|
committer | Alex Blasche <alexander.blasche@theqtcompany.com> | 2016-01-26 07:31:21 +0000 |
commit | e9ead74ec4169d483de0b711986b5b560bbb730a (patch) | |
tree | 1f489ce01d5f9d2ed620959a7783b2480406c1a2 /examples/location | |
parent | c902d5bc7ce9c1af4bd297e459baa8b34201e34d (diff) | |
download | qtlocation-e9ead74ec4169d483de0b711986b5b560bbb730a.tar.gz |
Fixes for the mapviewer QtLocation example
Currently identified problems with this example are:
- the map element loses focus upon provider switch, or opening some
other page (geocoding page, for example)
- caused by changes in the StackView. Solved by forcing the focus
upon map change
- selecting minimap causes segfault
- caused by dereferencing a null pointer (m_flick.m_animation)
in qquickgeomapgesturearea.cpp
- occasional (random) crashes with "QVector index out of bound" error
- the menus show up on the wrong screen most of the time if the window
spans multiple screens (but this is a broader qtquick problem)
This patch fixes the first two issues
Task-number: QTBUG-50519
Change-Id: Ic6b4a35e62e4651bd8003f47fade45f44a99d81c
Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
Diffstat (limited to 'examples/location')
-rw-r--r-- | examples/location/mapviewer/mapviewer.qml | 34 |
1 files changed, 22 insertions, 12 deletions
diff --git a/examples/location/mapviewer/mapviewer.qml b/examples/location/mapviewer/mapviewer.qml index bcc2c919..2cb4e0d0 100644 --- a/examples/location/mapviewer/mapviewer.qml +++ b/examples/location/mapviewer/mapviewer.qml @@ -63,26 +63,41 @@ ApplicationWindow { var plugin if (parameters && parameters.length>0) - plugin = Qt.createQmlObject ('import QtLocation 5.3; Plugin{ name:"' + provider + '"; parameters: appWindow.parameters}', appWindow) + plugin = Qt.createQmlObject ('import QtLocation 5.6; Plugin{ name:"' + provider + '"; parameters: appWindow.parameters}', appWindow) else - plugin = Qt.createQmlObject ('import QtLocation 5.3; Plugin{ name:"' + provider + '"}', appWindow) + plugin = Qt.createQmlObject ('import QtLocation 5.6; Plugin{ name:"' + provider + '"}', appWindow) + if (minimap) { + minimap.destroy() + minimap = null + } + + var zoomLevel = null + var center = null if (map) { + zoomLevel = map.zoomLevel + center = map.center map.destroy() - minimap = null } map = mapComponent.createObject(page); map.plugin = plugin; - map.zoomLevel = (map.maximumZoomLevel - map.minimumZoomLevel)/2 + if (zoomLevel != null) { + map.zoomLevel = zoomLevel + map.center = center + } else { + map.zoomLevel = (map.maximumZoomLevel - map.minimumZoomLevel)/2 + } + + map.forceActiveFocus() } function getPlugins() { - var plugin = Qt.createQmlObject ('import QtLocation 5.3; Plugin {}', appWindow) + var plugin = Qt.createQmlObject ('import QtLocation 5.6; Plugin {}', appWindow) var myArray = new Array() for (var i = 0; i<plugin.availableServiceProviders.length; i++) { - var tempPlugin = Qt.createQmlObject ('import QtLocation 5.3; Plugin {name: "' + plugin.availableServiceProviders[i]+ '"}', appWindow) + var tempPlugin = Qt.createQmlObject ('import QtLocation 5.6; Plugin {name: "' + plugin.availableServiceProviders[i]+ '"}', appWindow) if (tempPlugin.supportsMapping()) myArray.push(tempPlugin.name) } @@ -94,7 +109,7 @@ ApplicationWindow { { var parameters = new Array() for (var prop in pluginParameters){ - var parameter = Qt.createQmlObject('import QtLocation 5.3; PluginParameter{ name: "'+ prop + '"; value: "' + pluginParameters[prop]+'"}',appWindow) + var parameter = Qt.createQmlObject('import QtLocation 5.6; PluginParameter{ name: "'+ prop + '"; value: "' + pluginParameters[prop]+'"}',appWindow) parameters.push(parameter) } appWindow.parameters = parameters @@ -156,11 +171,6 @@ ApplicationWindow { providerMenu.items[i].checked = providerMenu.items[i].text === providerName } - if (minimap) { - minimap.destroy() - minimap = null - } - createMap(providerName) if (map.error === Map.NoError) { selectMapType(map.activeMapType) |