Warning, /education/marble/src/apps/marble-maps/PublicTransport.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.6
0007 import QtQuick.Window 2.2
0008 import QtQuick.Controls 2.0
0009 import QtQuick.Layouts 1.3
0010 
0011 
0012 Item {
0013     id: root
0014 
0015     implicitHeight: Math.min(0.75 * Screen.height, listView.contentHeight)
0016     property var marbleMaps
0017 
0018     ListModel {
0019         id: transportModel
0020         ListElement {
0021             name: qsTr("Train")
0022             icon: "material/directions-railway.svg"
0023             key: "train"
0024         }
0025         ListElement {
0026             name: qsTr("Subway")
0027             icon: "material/directions-subway.svg"
0028             key: "subway"
0029         }
0030         ListElement {
0031             name: qsTr("Tram")
0032             icon: "material/directions-tram.svg"
0033             key: "tram"
0034         }
0035         ListElement {
0036             name: qsTr("Bus")
0037             icon: "material/directions-bus.svg"
0038             key: "bus"
0039         }
0040         ListElement {
0041             name: qsTr("Trolley Bus")
0042             icon: "material/directions-bus.svg"
0043             key: "trolley-bus"
0044         }
0045     }
0046 
0047     ListView {
0048         id: listView
0049         anchors.fill: parent
0050         contentWidth: width
0051 
0052         model: transportModel
0053         clip: true
0054         spacing: Screen.pixelDensity * 2
0055 
0056         delegate: Row {
0057             CheckBox {
0058                 id: control
0059                 text: name
0060 
0061                 checked: root.marbleMaps.isRelationTypeVisible(key)
0062 
0063                 contentItem: Row {
0064                     Item {
0065                         height: parent.height
0066                         width: control.indicator.width + control.spacing
0067                     }
0068 
0069                     Image {
0070                         source: icon
0071                         height: parent.height
0072                         sourceSize.height: height
0073                         fillMode: Image.PreserveAspectFit
0074                     }
0075 
0076                     Text {
0077                         height: parent.height
0078                         text: control.text
0079                         font: control.font
0080                         opacity: enabled ? 1.0 : 0.3
0081                         horizontalAlignment: Text.AlignHCenter
0082                         verticalAlignment: Text.AlignVCenter
0083                     }
0084                 }
0085 
0086                 onCheckedChanged: {
0087                     root.marbleMaps.setRelationTypeVisible(key, checked)
0088                 }
0089             }
0090         }
0091         ScrollBar.vertical: ScrollBar {}
0092     }
0093 }