diff options
Diffstat (limited to 'examples/location/geojson_viewer/main.qml')
-rw-r--r-- | examples/location/geojson_viewer/main.qml | 33 |
1 files changed, 32 insertions, 1 deletions
diff --git a/examples/location/geojson_viewer/main.qml b/examples/location/geojson_viewer/main.qml index b2fc3524..1b55ef8b 100644 --- a/examples/location/geojson_viewer/main.qml +++ b/examples/location/geojson_viewer/main.qml @@ -58,6 +58,7 @@ import QtQuick.Window 2.11 import QtPositioning 5.12 import QtLocation 5.12 import Qt.labs.qmlmodels 1.0 +import Qt.labs.location 1.0 import Qt.GeoJson 1.0 C1.ApplicationWindow { @@ -144,11 +145,32 @@ C1.ApplicationWindow { } } C1.MenuItem { - text: "&OpenGL Item backends" + text: "OpenGL Item backends" id: glBackendSelector checkable: true checked: false } + + C1.MenuItem { + text: "Map Object Delegates" + id: mapObjectsSelector + checkable: true + checked: false + + onCheckedChanged: { + if (checked) { + miv.model = undefined + map.removeMapItemView(miv) + rootMoV.addMapObject(mov) + mov.model = geoJsoner.model + } else { + mov.model = undefined + rootMoV.removeMapObject(mov) + map.addMapItemView(miv) + miv.model = geoJsoner.model + } + } + } } } @@ -166,6 +188,11 @@ C1.ApplicationWindow { } } + MapObjectView { + id: mov + delegate: GeoJsonDelegateMapObject {} + } + Map { id: map anchors.fill: parent @@ -173,6 +200,10 @@ C1.ApplicationWindow { plugin: Plugin { name: "osm" } zoomLevel: 4 + MapObjectView { + id: rootMoV + } + MapItemView { id: miv model: geoJsoner.model |