Position.qml finished. Some more stuff done on the QmlMirror.qml page
This commit is contained in:
parent
021547f3df
commit
a8863ca865
2 changed files with 53 additions and 13 deletions
54
Position.qml
54
Position.qml
|
@ -1,12 +1,13 @@
|
||||||
import QtPositioning 5.2
|
import QtPositioning 5.2
|
||||||
import QtQuick 2.3
|
import QtQuick 2.3
|
||||||
|
import QtQuick.Layouts 1.1
|
||||||
|
import QtQuick.XmlListModel 2.0
|
||||||
Rectangle {
|
Rectangle {
|
||||||
id: root
|
id: root
|
||||||
|
color: "black"
|
||||||
|
|
||||||
PositionSource {
|
PositionSource {
|
||||||
id: positionSource
|
id: positionSource
|
||||||
onPositionChanged: { }
|
|
||||||
Component.onCompleted: { positionSource.update() }
|
Component.onCompleted: { positionSource.update() }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -14,22 +15,53 @@ Rectangle {
|
||||||
XmlListModel {
|
XmlListModel {
|
||||||
id: listModel
|
id: listModel
|
||||||
property variant coordinate
|
property variant coordinate
|
||||||
|
property double lng: positionSource.position.coordinate.longitude
|
||||||
|
property double lat: positionSource.position.coordinate.latitude
|
||||||
|
|
||||||
source: "http://api.geonames.org/findNearbyPlaceName?" +
|
source: "http://api.geonames.org/findNearbyPlaceName?username=frznlogic&" +
|
||||||
"lat=" + coordinate.latitude +
|
"lat=" + lat +
|
||||||
"&lng=" + coordinate.longitude
|
"&lng=" + lng
|
||||||
query: "/geonames/geoname"
|
query: "/geonames/geoname"
|
||||||
|
|
||||||
|
|
||||||
XmlRole { name: "toponymName"; query: "toponymName/string()" }
|
XmlRole { name: "cityname"; query: "name/string()" }
|
||||||
XmlRole { name: "name"; query: "name/string()" }
|
|
||||||
XmlRole { name: "lat"; query: "lat/string()" }
|
|
||||||
XmlRole { name: "lng"; query: "lng/string()" }
|
|
||||||
XmlRole { name: "geonameId"; query: "geonameId/string()" }
|
XmlRole { name: "geonameId"; query: "geonameId/string()" }
|
||||||
XmlRole { name: "countryCode"; query: "countryCode/string()" }
|
|
||||||
XmlRole { name: "countryName"; query: "countryName/string()" }
|
XmlRole { name: "countryName"; query: "countryName/string()" }
|
||||||
XmlRole { name: "distance"; query: "distance/string()" }
|
XmlRole { name: "distance"; query: "distance/string()" }
|
||||||
|
|
||||||
|
onStatusChanged: {
|
||||||
|
if (status == XmlListModel.Ready)
|
||||||
|
{
|
||||||
|
locationName.text = listModel.get(0).cityname
|
||||||
|
locationCountry.text = listModel.get(0).countryName
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
id: positionId
|
||||||
|
anchors.top: parent.top
|
||||||
|
anchors.left: parent.left
|
||||||
|
anchors.right: parent.right
|
||||||
|
height: 100
|
||||||
|
color:"black"
|
||||||
|
Text {
|
||||||
|
id: locationName
|
||||||
|
anchors.fill: parent
|
||||||
|
horizontalAlignment: Text.AlignHCenter
|
||||||
|
verticalAlignment: Text.AlignTop
|
||||||
|
text: "Unknown"
|
||||||
|
font.pointSize: 48
|
||||||
|
color: "white"
|
||||||
|
}
|
||||||
|
Text {
|
||||||
|
id: locationCountry
|
||||||
|
anchors.fill: parent
|
||||||
|
horizontalAlignment: Text.AlignHCenter
|
||||||
|
verticalAlignment: Text.AlignBottom
|
||||||
|
text: "Unknown"
|
||||||
|
font.pointSize: 20
|
||||||
|
color: "white"
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8,9 +8,17 @@ ApplicationWindow {
|
||||||
height: 1920
|
height: 1920
|
||||||
color: "black"
|
color: "black"
|
||||||
|
|
||||||
Clock {
|
Position {
|
||||||
|
id: positionId
|
||||||
anchors.top: parent.top
|
anchors.top: parent.top
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
|
anchors.right: parent.right
|
||||||
|
height: 100
|
||||||
|
}
|
||||||
|
|
||||||
|
Clock {
|
||||||
|
anchors.top: positionId.bottom
|
||||||
|
anchors.left: parent.left
|
||||||
width: 360
|
width: 360
|
||||||
height: 240
|
height: 240
|
||||||
}
|
}
|
||||||
|
@ -19,7 +27,7 @@ ApplicationWindow {
|
||||||
id: weatherId
|
id: weatherId
|
||||||
width: 360
|
width: 360
|
||||||
height: 400
|
height: 400
|
||||||
anchors.top: parent.top
|
anchors.top: positionId.bottom
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
Weather {
|
Weather {
|
||||||
width: 360
|
width: 360
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue