QML PositionSource ElementThe PositionSource element allows you to get information about your current position. More... Properties
SignalsMethodsDetailed DescriptionThe PositionSource element allows you to get information about your current position. You can receive information about things such as latitude, longitude, altitude, and speed. This element is part of the QtMobility.location 1.1 module. Support for location sources are platform dependant. When declaring a PositionSource element, a default PositionSource source shall be created. Supported positioning methods are held in positioningMethod. As a development convenience, one may also set data file as a source (NMEA format). Location updates are not necessarily started automatically upon element declaration, see start stop active and update. Here is very simple example QML to illustrate the usage: import Qt 4.7 import QtMobility.location 1.1 Rectangle { id: page width: 350 height: 350 PositionSource { id: positionSource updateInterval: 1000 active: true // nmeaSource: "nmealog.txt" } Column { Text {text: "<==== PositionSource ====>"} Text {text: "positioningMethod: " + printableMethod(positionSource.positioningMethod)} Text {text: "nmeaSource: " + positionSource.nmeaSource} Text {text: "updateInterval: " + positionSource.updateInterval} Text {text: "active: " + positionSource.active} Text {text: "<==== Position ====>"} Text {text: "latitude: " + positionSource.position.coordinate.latitude} Text {text: "longitude: " + positionSource.position.coordinate.longitude} Text {text: "altitude: " + positionSource.position.coordinate.altitude} Text {text: "speed: " + positionSource.position.speed} Text {text: "timestamp: " + positionSource.position.timestamp} Text {text: "altitudeValid: " + positionSource.position.altitudeValid} Text {text: "longitudeValid: " + positionSource.position.longitudeValid} Text {text: "latitudeValid: " + positionSource.position.latitudeValid} Text {text: "speedValid: " + positionSource.position.speedValid} } function printableMethod(method) { if (method == PositionSource.SatellitePositioningMethod) return "Satellite"; else if (method == PositionSource.NoPositioningMethod) return "Not available" else if (method == PositionSource.NonSatellitePositioningMethod) return "Non-satellite" else if (method == PositionSource.AllPositioningMethods) return "All/multiple" return "source error"; } } See also QGeoPositionInfoSource, QGeoPositionInfo, QNmeaPositionInfoSource, and QGeoCoordinate. Property DocumentationThis property holds the source for NMEA data (file). One purpose of this property is to be of development convenience. Setting this property will override any other position source. Currently only files local to the .qml -file are supported. Nmea source is created in simulation mode, meaning that the data and time information in the NMEA source data is used to provide positional updates at the rate at which the data was originally recorded. If nmeaSource has been set for a PositionSource element, there is no way to revert back to non-file sources. This property holds the last known positional data. The Position element has different positional member variables, whose validity can be checked with appropriate validity functions (e.g. sometimes an update does not have speed or altitude data). However, whenever a positionChanged signal has been received, at least position::coordinate::latitude, position::coordinate::longitude, and position::timestamp can be assumed to be valid. This property holds the supported positioning methods of the current source.
This property holds the desired interval between updates (milliseconds). See also QGeoPositionInfoSource::updateInterval(). Signal DocumentationThis signal is sent when a position update has been received from the location source. Upon receiving this signal, at least position::latitude, position::longitude, and position::timestamp members of the position have been updated. See also updateInterval. Method DocumentationRequests updates from the location source. Uses updateInterval if set, default interval otherwise. If there is no source available, this method has no effect. X
|