9import QtQuick.Controls as QQC2
10import org.kde.kirigami as Kirigami
11import org.kde.kpublictransport as PublicTransport
12import org.kde.kosmindoormap
13import org.kde.kosmindoormap.kpublictransport
17 property point coordinate;
18 property var publicTransportManager
20 signal coordinateSelected()
22 title: i18nc("@title:dialog", "Select Location")
24 width: Math.min(applicationWindow().width,
Kirigami.
Units.gridUnit * 24)
31 contentItem: ColumnLayout {
37 ExampleLocationModel { id: exampleModel }
41 Layout.fillWidth:
true
45 onCurrentIndexChanged: {
46 var obj = exampleModel.get(currentIndex);
47 root.coordinate.y = obj.lat;
48 root.coordinate.x = obj.lon;
60 placeholderText:
"<latitude>, <longitude>"
61 Layout.fillWidth:
true
62 onEditingFinished: function() {
65 function parseCoordinate() {
66 var c = coordField.text.match(/([\d\.-]+)[,;/ ]+([\d\.-]*)/);
68 root.coordinate.y = c[1];
69 root.coordinate.x = c[2];
74 icon.name:
"edit-clear-symbolic"
75 onClicked: function() {
77 coordField.parseCoordinate();
81 icon.name:
"edit-paste-symbolic"
82 onClicked: function() {
85 coordField.parseCoordinate();
97 placeholderText:
"train station name"
98 Layout.fillWidth:
true
99 onEditingFinished: function() {
100 locationModel.request.name = nameField.text;
101 locationModel.request.backends = [
"un_navitia",
"de_db" ];
102 locationModel.request.maximumResults = 10;
103 locationModel.request.types = PublicTransport.Location.Stop;
106 PublicTransport.LocationQueryModel {
108 manager: root.publicTransportManager
111 id: nameSearchResultView
112 Layout.fillWidth:
true
114 implicitHeight: contentHeight
116 delegate: QQC2.ItemDelegate {
117 width: ListView.view.width
118 contentItem:
Kirigami.TitleSubtitle {
122 onCurrentIndexChanged: function() {
123 var loc = locationModel.data(locationModel.index(nameSearchResultView.currentIndex, 0), PublicTransport.LocationQueryModel.LocationRole);
124 if (loc != undefined) {
125 root.coordinate.x = loc.longitude;
126 root.coordinate.y = loc.latitude;
132 customFooterActions: [
135 enabled: root.coordinate.x != 0.0 && root.coordinate.x != NaN && root.coordinate.y != 0.0 && root.coordinate != NaN
137 console.log(root.coordinate);
139 coordinateSelected();
QVariant location(const QVariant &res)
QStringView level(QStringView ifopt)