Warning, /education/marble/src/apps/marble-maps/RoutesItem.qml is written in an unsupported language. File is not indexed.
0001 // SPDX-License-Identifier: LGPL-2.1-or-later 0002 // 0003 // SPDX-FileCopyrightText: 2017 Dennis Nienhüser <nienhueser@kde.org> 0004 // 0005 0006 import QtQuick 2.3 0007 import QtQuick.Window 2.2 0008 import QtQuick.Controls 2.0 0009 import QtQuick.Layouts 1.3 0010 import QtGraphicalEffects 1.0 0011 0012 0013 Item { 0014 id: root 0015 property alias model: listView.model 0016 property alias count: listView.count 0017 0018 implicitHeight: Math.min(0.75 * Screen.height, listView.contentHeight) 0019 0020 signal highlightChanged(int oid, bool enabled) 0021 0022 ListView { 0023 id: listView 0024 anchors.fill: parent 0025 contentWidth: width 0026 0027 model: placemark ? placemark.routeRelationModel : undefined 0028 clip: true 0029 spacing: Screen.pixelDensity * 2 0030 0031 delegate: Item { 0032 id: routeCard 0033 property bool expanded: false 0034 0035 width: parent.width 0036 height: rectangle.height + dropShadow.verticalOffset + dropShadow.radius 0037 Rectangle { 0038 id: rectangle 0039 width: parent.width - dropShadow.horizontalOffset - dropShadow.radius 0040 height: column.height 0041 radius: Screen.pixelDensity * 1 0042 0043 Column { 0044 id: column 0045 width: parent.width 0046 spacing: Screen.pixelDensity * 1 0047 0048 Item { 0049 width: parent.width 0050 height: Math.max(icon.height, textColumn.height) 0051 0052 anchors { 0053 left: parent.left; 0054 right: parent.right; 0055 } 0056 0057 Image { 0058 id: icon 0059 anchors.left: parent.left 0060 source: iconSource 0061 height: Screen.pixelDensity * 6 0062 width: height 0063 sourceSize.height: Screen.pixelDensity * 6 0064 sourceSize.width: width 0065 fillMode: Image.PreserveAspectFit 0066 } 0067 0068 Column { 0069 id: textColumn 0070 anchors.left: icon.right 0071 anchors.right: parent.right 0072 0073 Rectangle { 0074 width: parent.width 0075 height: childrenRect.height 0076 color: routeColor 0077 Text { 0078 anchors.left: parent.left 0079 anchors.margins: Screen.pixelDensity * 0.5 0080 clip: true 0081 font.pointSize: 16 0082 text: routeRef 0083 color: textColor 0084 width: parent.width 0085 wrapMode: Text.WrapAtWordBoundaryOrAnywhere 0086 } 0087 } 0088 0089 Text { 0090 visible: text.length > 2 0091 font.pointSize: 16 0092 text: "● " + routeFrom 0093 width: parent.width 0094 wrapMode: Text.WrapAtWordBoundaryOrAnywhere 0095 } 0096 0097 Repeater { 0098 model: routeCard.expanded ? routeVia : undefined 0099 Text { 0100 font.pointSize: 16 0101 text: "○ " + modelData 0102 width: parent.width 0103 wrapMode: Text.WrapAtWordBoundaryOrAnywhere 0104 } 0105 } 0106 0107 Text { 0108 visible: text.length > 2 0109 font.pointSize: 16 0110 text: "● " + routeTo 0111 width: parent.width 0112 wrapMode: Text.WrapAtWordBoundaryOrAnywhere 0113 } 0114 0115 Text { 0116 visible: routeCard.expanded 0117 font.pointSize: 14 0118 text: "Network: " + network 0119 width: parent.width 0120 wrapMode: Text.WrapAtWordBoundaryOrAnywhere 0121 } 0122 0123 Text { 0124 visible: routeCard.expanded 0125 font.pointSize: 14 0126 text: description 0127 width: parent.width 0128 wrapMode: Text.WrapAtWordBoundaryOrAnywhere 0129 } 0130 } 0131 0132 MouseArea { 0133 anchors.fill: parent 0134 onClicked: { 0135 routeCard.expanded = !routeCard.expanded 0136 listView.currentIndex = index 0137 } 0138 } 0139 0140 Behavior on height { 0141 NumberAnimation { 0142 duration: 200 0143 easing.type: Easing.OutQuart 0144 } 0145 } 0146 } 0147 0148 Item { 0149 visible: routeCard.expanded 0150 0151 anchors.left: parent.left 0152 anchors.right: parent.right 0153 anchors.rightMargin: Screen.pixelDensity * 4 0154 height: childrenRect.height 0155 0156 Switch { 0157 id: highlightSwitch 0158 anchors.right: switchText.left 0159 anchors.verticalCenter: switchText.verticalCenter 0160 0161 checked: routeVisible 0162 onClicked: root.highlightChanged(oid, checked) 0163 } 0164 0165 Text { 0166 id: switchText 0167 anchors.right: parent.right 0168 text: "Highlight in Map" 0169 0170 MouseArea { 0171 anchors.fill: parent 0172 onClicked: highlightSwitch.checked = !highlightSwitch.checked 0173 } 0174 } 0175 } 0176 } 0177 } 0178 0179 DropShadow { 0180 id: dropShadow 0181 anchors.fill: rectangle 0182 horizontalOffset: 4 0183 verticalOffset: 4 0184 radius: 4.0 0185 samples: 17 0186 color: "#40000000" 0187 source: rectangle 0188 } 0189 } 0190 0191 ScrollBar.vertical: ScrollBar {} 0192 } 0193 }