diff options
Diffstat (limited to 'examples/location/geojson_viewer/main.qml')
-rw-r--r-- | examples/location/geojson_viewer/main.qml | 54 |
1 files changed, 52 insertions, 2 deletions
diff --git a/examples/location/geojson_viewer/main.qml b/examples/location/geojson_viewer/main.qml index 01faef5f..1b55ef8b 100644 --- a/examples/location/geojson_viewer/main.qml +++ b/examples/location/geojson_viewer/main.qml @@ -58,14 +58,17 @@ 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 { + id: win visible: true width: 1024 height: 1024 menuBar: mainMenu title: qsTr("GeoJSON Viewer") + property bool openGLBackends: glBackendSelector.checked FileDialog { visible: false @@ -141,6 +144,33 @@ C1.ApplicationWindow { geoJsoner.print(miv) } } + C1.MenuItem { + 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 + } + } + } } } @@ -149,17 +179,37 @@ C1.ApplicationWindow { id: geoJsoner } + Shortcut { + sequence: "Ctrl+P" + onActivated: { + + console.log("Center : QtPositioning.coordinate(",map.center.latitude,",",map.center.longitude,")") + console.log("Zoom : ",map.zoomLevel) + } + } + + MapObjectView { + id: mov + delegate: GeoJsonDelegateMapObject {} + } + Map { id: map anchors.fill: parent center: QtPositioning.coordinate(43.59, 13.50) // Starting coordinates: Ancona, the city where I am studying :) - plugin: Plugin { name: "mapboxgl" } + plugin: Plugin { name: "osm" } zoomLevel: 4 + MapObjectView { + id: rootMoV + } + MapItemView { id: miv model: geoJsoner.model - delegate: GeoJsonDelegate {} + delegate: GeoJsonDelegate { + openGLBackends: win.openGLBackends + } } } } |