Position.qml finished. Some more stuff done on the QmlMirror.qml page

This commit is contained in:
Oscar Andreasson 2015-06-22 23:21:49 -07:00
parent 021547f3df
commit a8863ca865
2 changed files with 53 additions and 13 deletions

View file

@ -1,12 +1,13 @@
import QtPositioning 5.2
import QtQuick 2.3
import QtQuick.Layouts 1.1
import QtQuick.XmlListModel 2.0
Rectangle {
id: root
color: "black"
PositionSource {
id: positionSource
onPositionChanged: { }
Component.onCompleted: { positionSource.update() }
}
@ -14,22 +15,53 @@ Rectangle {
XmlListModel {
id: listModel
property variant coordinate
property double lng: positionSource.position.coordinate.longitude
property double lat: positionSource.position.coordinate.latitude
source: "http://api.geonames.org/findNearbyPlaceName?" +
"lat=" + coordinate.latitude +
"&lng=" + coordinate.longitude
source: "http://api.geonames.org/findNearbyPlaceName?username=frznlogic&" +
"lat=" + lat +
"&lng=" + lng
query: "/geonames/geoname"
XmlRole { name: "toponymName"; query: "toponymName/string()" }
XmlRole { name: "name"; query: "name/string()" }
XmlRole { name: "lat"; query: "lat/string()" }
XmlRole { name: "lng"; query: "lng/string()" }
XmlRole { name: "cityname"; query: "name/string()" }
XmlRole { name: "geonameId"; query: "geonameId/string()" }
XmlRole { name: "countryCode"; query: "countryCode/string()" }
XmlRole { name: "countryName"; query: "countryName/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"
}
}
}

View file

@ -8,9 +8,17 @@ ApplicationWindow {
height: 1920
color: "black"
Clock {
Position {
id: positionId
anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
height: 100
}
Clock {
anchors.top: positionId.bottom
anchors.left: parent.left
width: 360
height: 240
}
@ -19,7 +27,7 @@ ApplicationWindow {
id: weatherId
width: 360
height: 400
anchors.top: parent.top
anchors.top: positionId.bottom
anchors.right: parent.right
Weather {
width: 360