Warning, /libraries/kpublictransport/tests/PathPage.qml is written in an unsupported language. File is not indexed.

0001 /*
0002     SPDX-FileCopyrightText: 2021 Volker Krause <vkrause@kde.org>
0003 
0004     SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 
0007 import QtQuick
0008 import QtQuick.Layouts
0009 import QtQuick.Controls as QQC2
0010 import org.kde.kirigami as Kirigami
0011 import org.kde.kpublictransport
0012 
0013 Kirigami.ScrollablePage {
0014     property alias path: pathModel.path
0015 
0016     Component {
0017         id: pathDelegate
0018         QQC2.ItemDelegate {
0019             highlighted: false
0020             width: ListView.view.width
0021             property var section: model.section
0022             contentItem: GridLayout {
0023                 rows: 2
0024                 columns: 4
0025 
0026                 QQC2.Label {
0027                     Layout.row: 0
0028                     Layout.column: 0
0029                     Layout.rowSpan: 2
0030                     text: {
0031                         switch (section.maneuver) {
0032                             case PathSection.Stairs:
0033                                 return "🪜";
0034                             case PathSection.Elevator:
0035                                 return "🛗";
0036                             case PathSection.Escalator:
0037                                 return "↗️";
0038                             default:
0039                                 return "🚶";
0040                         }
0041                     }
0042                     font.pixelSize: 32
0043                 }
0044 
0045                 QQC2.Label {
0046                     Layout.row: 0
0047                     Layout.column: 1
0048                     Layout.rowSpan: 2
0049                     visible: section.floorLevelChange != 0
0050                     text: section.floorLevelChange < 0 ? "⬇️" : "⬆️"
0051                     font.pixelSize: 32
0052                 }
0053 
0054                 QQC2.Label {
0055                     Layout.row: 0
0056                     Layout.column: 2
0057                     Layout.fillWidth: true
0058                     text: section.description
0059                 }
0060                 QQC2.Label {
0061                     Layout.row: 1
0062                     Layout.column: 2
0063                     visible: section.distance > 0
0064                     text: section.distance + "m"
0065                 }
0066 
0067                 QQC2.Label {
0068                     Layout.row: 0
0069                     Layout.column: 3
0070                     Layout.rowSpan: 2
0071                     text: "⬆️"
0072                     visible: model.turnDirection >= 0
0073                     font.pixelSize: 32
0074                     rotation: model.turnDirection
0075                 }
0076             }
0077         }
0078     }
0079 
0080     PathModel {
0081         id: pathModel
0082     }
0083 
0084     ListView {
0085         model: pathModel
0086         delegate: pathDelegate
0087     }
0088 }