diff --git a/src/qml/FullScreenMap.qml b/src/qml/FullScreenMap.qml index 8ed7bf1ac..3d84b4017 100644 --- a/src/qml/FullScreenMap.qml +++ b/src/qml/FullScreenMap.qml @@ -33,13 +33,13 @@ ApplicationWindow { onClicked: root.destroy() } - Map { - id: map + MapView { + id: mapView anchors.fill: parent - center: root.liveLocationModel ? QtPositioning.coordinate(root.liveLocationModel.boundingBox.y, root.liveLocationModel.boundingBox.x) + map.center: root.liveLocationModel ? QtPositioning.coordinate(root.liveLocationModel.boundingBox.y, root.liveLocationModel.boundingBox.x) : QtPositioning.coordinate(root.latitude, root.longitude) - zoomLevel: 15 - plugin: OsmLocationPlugin.plugin + map.zoomLevel: 15 + map.plugin: OsmLocationPlugin.plugin LocationMapItem { latitude: root.latitude longitude: root.longitude @@ -53,8 +53,12 @@ ApplicationWindow { model: root.liveLocationModel delegate: LocationMapItem {} } - onCopyrightLinkActivated: { - Qt.openUrlExternally(link) + + Connections { + target: mapView.map + function onCopyrightLinkActivated() { + Qt.openUrlExternally(link) + } } } diff --git a/src/qml/LiveLocationDelegate.qml b/src/qml/LiveLocationDelegate.qml index 2b84e3dfe..909aada0c 100644 --- a/src/qml/LiveLocationDelegate.qml +++ b/src/qml/LiveLocationDelegate.qml @@ -25,16 +25,15 @@ MessageDelegate { id: liveLocationModel eventId: root.eventId } - Map { - id: map + MapView { + id: mapView Layout.fillWidth: true Layout.preferredHeight: root.contentMaxWidth / 16 * 9 - center: QtPositioning.coordinate(liveLocationModel.boundingBox.y, liveLocationModel.boundingBox.x) - zoomLevel: 15 + map.center: QtPositioning.coordinate(liveLocationModel.boundingBox.y, liveLocationModel.boundingBox.x) + map.zoomLevel: 15 - plugin: OsmLocationPlugin.plugin - onCopyrightLinkActivated: Qt.openUrlExternally(link) + map.plugin: OsmLocationPlugin.plugin MapItemView { model: liveLocationModel @@ -53,6 +52,12 @@ MessageDelegate { acceptedButtons: Qt.RightButton onTapped: openMessageContext("") } + Connections { + target: mapView.map + function onCopyrightLinkActivated() { + Qt.openUrlExternally(link) + } + } } Component { id: fullScreenMap diff --git a/src/qml/LocationChooser.qml b/src/qml/LocationChooser.qml index 352e70fb6..581dd783a 100644 --- a/src/qml/LocationChooser.qml +++ b/src/qml/LocationChooser.qml @@ -33,9 +33,9 @@ Components.AbstractMaximizeComponent { } ] - content: Map { + content: MapView { id: map - plugin: Plugin { + map.plugin: Plugin { name: "osm" PluginParameter { name: "osm.useragent" @@ -81,5 +81,11 @@ Components.AbstractMaximizeComponent { } } } + Connections { + target: mapView.map + function onCopyrightLinkActivated() { + Qt.openUrlExternally(link) + } + } } } diff --git a/src/qml/LocationDelegate.qml b/src/qml/LocationDelegate.qml index 6816d1a2c..5bf04aaa0 100644 --- a/src/qml/LocationDelegate.qml +++ b/src/qml/LocationDelegate.qml @@ -36,16 +36,15 @@ MessageDelegate { required property string asset bubbleContent: ColumnLayout { - Map { - id: map + MapView { + id: mapView Layout.fillWidth: true Layout.preferredHeight: root.contentMaxWidth / 16 * 9 - center: QtPositioning.coordinate(root.latitude, root.longitude) - zoomLevel: 15 + map.center: QtPositioning.coordinate(root.latitude, root.longitude) + map.zoomLevel: 15 - plugin: OsmLocationPlugin.plugin - onCopyrightLinkActivated: Qt.openUrlExternally(link) + map.plugin: OsmLocationPlugin.plugin LocationMapItem { latitude: root.latitude @@ -68,6 +67,12 @@ MessageDelegate { acceptedButtons: Qt.RightButton onTapped: openMessageContext("") } + Connections { + target: mapView.map + function onCopyrightLinkActivated() { + Qt.openUrlExternally(link) + } + } } Component { id: fullScreenMap diff --git a/src/qml/LocationsPage.qml b/src/qml/LocationsPage.qml index 7b6073773..e8cf04311 100644 --- a/src/qml/LocationsPage.qml +++ b/src/qml/LocationsPage.qml @@ -17,16 +17,16 @@ Kirigami.Page { padding: 0 - Map { - id: map + MapView { + id: mapView anchors.fill: parent - plugin: OsmLocationPlugin.plugin + map.plugin: OsmLocationPlugin.plugin - center: { + map.center: { let c = LocationHelper.center(LocationHelper.unite(locationsModel.boundingBox, liveLocationsModel.boundingBox)); return QtPositioning.coordinate(c.y, c.x); } - zoomLevel: LocationHelper.zoomToFit(LocationHelper.unite(locationsModel.boundingBox, liveLocationsModel.boundingBox), map.width, map.height) + map.zoomLevel: LocationHelper.zoomToFit(LocationHelper.unite(locationsModel.boundingBox, liveLocationsModel.boundingBox), mapView.width, mapView.height) MapItemView { model: LocationsModel { @@ -49,8 +49,14 @@ Kirigami.Page { Kirigami.PlaceholderMessage { text: i18n("There are no locations shared in this room.") - visible: map.mapItems.length === 0 + visible: mapView.mapItems.length === 0 anchors.centerIn: parent } + Connections { + target: mapView.map + function onCopyrightLinkActivated() { + Qt.openUrlExternally(link) + } + } } }