Add fullscreen map to live location delegates as well

This commit is contained in:
Volker Krause
2023-06-18 10:16:14 +02:00
parent 30f8573dfc
commit c06e69931a
2 changed files with 20 additions and 5 deletions

View File

@@ -11,10 +11,11 @@ import org.kde.kirigami 2.15 as Kirigami
ApplicationWindow { ApplicationWindow {
id: root id: root
required property real latitude property real latitude: NaN
required property real longitude property real longitude: NaN
required property string asset property string asset
required property var author property var author
property QtObject liveLocationModel: null
flags: Qt.FramelessWindowHint | Qt.WA_TranslucentBackground flags: Qt.FramelessWindowHint | Qt.WA_TranslucentBackground
visibility: Qt.WindowFullScreen visibility: Qt.WindowFullScreen
@@ -35,7 +36,8 @@ ApplicationWindow {
Map { Map {
id: map id: map
anchors.fill: parent anchors.fill: parent
center: QtPositioning.coordinate(root.latitude, root.longitude) center: root.liveLocationModel ? QtPositioning.coordinate(root.liveLocationModel.boundingBox.y, root.liveLocationModel.boundingBox.x)
: QtPositioning.coordinate(root.latitude, root.longitude)
zoomLevel: 15 zoomLevel: 15
plugin: OsmLocationPlugin.plugin plugin: OsmLocationPlugin.plugin
LocationMapItem { LocationMapItem {
@@ -44,6 +46,11 @@ ApplicationWindow {
asset: root.asset asset: root.asset
author: root.author author: root.author
isLive: true isLive: true
visible: !isNaN(root.latitude) && !isNaN(root.longitude)
}
MapItemView {
model: root.liveLocationModel
delegate: LocationMapItem {}
} }
onCopyrightLinkActivated: { onCopyrightLinkActivated: {
Qt.openUrlExternally(link) Qt.openUrlExternally(link)

View File

@@ -47,6 +47,10 @@ TimelineContainer {
TapHandler { TapHandler {
acceptedButtons: Qt.LeftButton acceptedButtons: Qt.LeftButton
onTapped: {
let map = fullScreenMap.createObject(parent, {liveLocationModel: liveLocationModel});
map.open()
}
onLongPressed: openMessageContext("") onLongPressed: openMessageContext("")
} }
TapHandler { TapHandler {
@@ -54,5 +58,9 @@ TimelineContainer {
onTapped: openMessageContext("") onTapped: openMessageContext("")
} }
} }
Component {
id: fullScreenMap
FullScreenMap {}
}
} }
} }