Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Itinerary
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
20
Issues
20
List
Boards
Labels
Service Desk
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
PIM
Itinerary
Commits
410335fe
Commit
410335fe
authored
Jan 05, 2019
by
Volker Krause
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow manual journey queries in the journey query example
parent
9a4c3cfe
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
70 additions
and
2 deletions
+70
-2
tests/journeyquery.cpp
tests/journeyquery.cpp
+3
-1
tests/journeyquery.qml
tests/journeyquery.qml
+67
-1
No files found.
tests/journeyquery.cpp
View file @
410335fe
...
...
@@ -46,7 +46,7 @@ public:
ptMgr
.
setNetworkAccessManager
(
&
nam
);
}
Q_INVOKABLE
void
findJourney
(
double
fromLat
,
double
fromLon
,
double
toLat
,
double
toLon
)
Q_INVOKABLE
void
findJourney
(
const
QString
&
fromName
,
double
fromLat
,
double
fromLon
,
const
QString
&
toName
,
double
toLat
,
double
toLon
)
{
engine
->
rootContext
()
->
setContextProperty
(
QStringLiteral
(
"_journeys"
),
QVariantList
());
m_loading
=
true
;
...
...
@@ -55,8 +55,10 @@ public:
emit
errorMessageChanged
();
Location
from
;
from
.
setName
(
fromName
);
from
.
setCoordinate
(
fromLat
,
fromLon
);
Location
to
;
to
.
setName
(
toName
);
to
.
setCoordinate
(
toLat
,
toLon
);
auto
reply
=
ptMgr
.
queryJourney
({
from
,
to
});
...
...
tests/journeyquery.qml
View file @
410335fe
...
...
@@ -34,29 +34,37 @@ Kirigami.ApplicationWindow {
id
:
exampleModel
ListElement
{
name
:
"
CDG -> Gare de Lyon
"
fromName
:
"
Paris Charles de Gaulle
"
fromLon
:
2.57110
fromLat
:
49.00406
toName
:
"
Paris Gare de Lyon
"
toLon
:
2.37708
toLat
:
48.84388
}
ListElement
{
name
:
"
ZRH -> Randa
"
fromName
:
"
Zürich Flughafen
"
fromLon
:
8.56275
fromLat
:
47.45050
toName
:
"
Randa
"
toLon
:
7.78315
toLat
:
46.09901
}
ListElement
{
name
:
"
Gare de Midi -> Fosdem
"
fromName
:
"
Brussels Gare du Midi
"
fromLon
:
4.33620
fromLat
:
50.83588
toName
:
"
ULB
"
toLon
:
4.38116
toLat
:
50.81360
}
ListElement
{
name
:
"
VIE -> Akademy 2018 Accomodation
"
fromName
:
"
Wien Flughafen
"
fromLon
:
16.56312
fromLat
:
48.12083
toName
:
"
Wien Hauptbahnhof
"
toLon
:
16.37859
toLat
:
48.18282
}
...
...
@@ -83,15 +91,19 @@ Kirigami.ApplicationWindow {
}
ListElement
{
name
:
"
TXL -> Akademy 2016
"
fromName
:
"
Berlin Flughafen Tegel
"
fromLon
:
13.29281
fromLat
:
52.55420
toName
:
"
Berlin Alexanderplatz
"
toLon
:
13.41644
toLat
:
52.52068
}
ListElement
{
name
:
"
SXF -> Akademy 2016
"
fromName
:
"
Berlin Flughafen Schönefeld
"
fromLon
:
13.51870
fromLat
:
52.38841
toName
:
"
Berlin Alexanderplatz
"
toLon
:
13.41644
toLat
:
52.52068
}
...
...
@@ -241,9 +253,63 @@ Kirigami.ApplicationWindow {
textRole
:
"
name
"
onCurrentIndexChanged
:
{
var
obj
=
exampleModel
.
get
(
currentIndex
);
_queryMgr
.
findJourney
(
obj
.
fromLat
,
obj
.
fromLon
,
obj
.
toLat
,
obj
.
toLon
);
fromName
.
text
=
obj
.
fromName
fromLon
.
text
=
obj
.
fromLon
fromLat
.
text
=
obj
.
fromLat
toName
.
text
=
obj
.
toName
toLon
.
text
=
obj
.
toLon
toLat
.
text
=
obj
.
toLat
}
}
RowLayout
{
QQC2.TextField
{
id
:
fromName
}
QQC2.TextField
{
id
:
fromLon
}
QQC2.TextField
{
id
:
fromLat
}
}
RowLayout
{
QQC2.TextField
{
id
:
toName
}
QQC2.TextField
{
id
:
toLon
}
QQC2.TextField
{
id
:
toLat
}
}
RowLayout
{
QQC2.Button
{
text
:
"
Query
"
onClicked
:
_queryMgr
.
findJourney
(
fromName
.
text
,
fromLat
.
text
,
fromLon
.
text
,
toName
.
text
,
toLat
.
text
,
toLon
.
text
);
}
QQC2.Button
{
text
:
"
Query Name
"
onClicked
:
_queryMgr
.
findJourney
(
fromName
.
text
,
NaN
,
NaN
,
toName
.
text
,
NaN
,
NaN
);
}
QQC2.Button
{
text
:
"
Query Coord
"
onClicked
:
_queryMgr
.
findJourney
(
""
,
fromLat
.
text
,
fromLon
.
text
,
""
,
toLat
.
text
,
toLon
.
text
);
}
QQC2.Button
{
text
:
"
Clear
"
onClicked
:
{
fromName
.
text
=
""
;
fromLon
.
text
=
""
;
fromLat
.
text
=
""
;
toName
.
text
=
""
;
toLon
.
text
=
""
;
toLat
.
text
=
""
;
}
}
}
QQC2.ComboBox
{
id
:
journeySelector
Layout.fillWidth
:
true
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment