KOSMIndoorMap

OSMElementInformationDialogImageDelegate.qml
1/*
2 SPDX-FileCopyrightText: 2024 Volker Krause <vkrause@kde.org>
3 SPDX-License-Identifier: LGPL-2.0-or-later
4*/
5
6import QtQuick
8/** Delegate for showing images and logos in the OSM element information dialog. */
9Item {
10 id: root
11
12 /** URL to link to for attribution/source information. */
13 required property string url
14 /** URL of the image to show. */
15 property alias source: img.source
16 /** Maximum height for the image, scale down if the source is heigher than this. */
17 property int maximumHeight: implicitHeight
18
19 property alias topMargin: img.y
20 property real bottomMargin: 0
21
22
23 implicitHeight: img.implicitHeight + root.topMargin + root.bottomMargin
24 implicitWidth: img.implicitWidth
25 height: img.height + root.topMargin + root.bottomMargin
26
27 Image {
28 id: img
29
30 anchors.horizontalCenter: root.horizontalCenter
31 width: Math.min(root.width, img.implicitWidth)
32 height: Math.min(img.width / img.implicitWidth * img.implicitHeight, root.maximumHeight)
33
34 fillMode: Image.PreserveAspectFit
35
36 // weird, but TapHandler doesn't forward unhandled drags to our parent ListView but the map area behind this dialog...
37 MouseArea {
38 anchors.fill: img
39 onClicked: Qt.openUrlExternally(root.url);
40 HoverHandler {
41 cursorShape: Qt.PointingHandCursor
42 }
43 }
44 }
45}
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Jul 26 2024 11:57:46 by doxygen 1.11.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.