Viadeo Twitter Google Bookmarks ! Facebook Digg del.icio.us MySpace Yahoo MyWeb Blinklist Netvouz Reddit Simpy StumbleUpon Bookmarks Windows Live Favorites 
Logo Documentation Qt ·  Page d'accueil  ·  Toutes les classes  ·  Toutes les fonctions  ·  Vues d'ensemble  · 

QML PositionSource Element

The PositionSource element allows you to get information about your current position. More...

  • List of all members, including inherited members
  • Properties

    Signals

    Methods

    Detailed Description

    The 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 Documentation

    read-onlyactive : bool

    This property indicates whether the position source is (/should be) active. Setting this property to false equals calling stop, and setting this property true equals calling start.

    This documentation was introduced in Qt Mobility Mobility 1.2.

    See also start, stop, and update.


    read-onlynmeaSource : url

    This 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 documentation was introduced in Qt Mobility Mobility 1.2.


    read-onlyposition : Position

    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 documentation was introduced in Qt Mobility Mobility 1.2.

    See also start, stop, and update.


    read-onlypositioningMethod : enumeration

    This property holds the supported positioning methods of the current source.

    • NoPositioningMethod - No positioning methods supported (no source).
    • SatellitePositioningMethod - Satellite-based positioning methods such as GPS is supported.
    • NonSatellitePositioningMethod - Non satellite methods are supported.
    • AllPositioningMethods - Combination of methods are supported.

    This documentation was introduced in Qt Mobility Mobility 1.2.


    read-onlyupdateInterval : bool

    This property holds the desired interval between updates (milliseconds).

    This documentation was introduced in Qt Mobility Mobility 1.2.

    See also QGeoPositionInfoSource::updateInterval().


    Signal Documentation

    PositionSource::positionChanged ()

    This 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.

    This documentation was introduced in Qt Mobility Mobility 1.2.

    See also updateInterval.


    Method Documentation

    PositionSource::start ()

    Requests updates from the location source. Uses updateInterval if set, default interval otherwise. If there is no source available, this method has no effect.

    This documentation was introduced in Qt Mobility Mobility 1.2.

    See also stop, update, and active.


    PositionSource::stop ()

    Stops updates from the location source. If there is no source available or it is not active, this method has no effect.

    This documentation was introduced in Qt Mobility Mobility 1.2.

    See also start, update, and active.


    PositionSource::update ()

    A convenience method to request single update from the location source. If there is no source available, this method has no effect.

    This documentation was introduced in Qt Mobility Mobility 1.2.

    See also start, stop, and active.


    Publicité

    Best Of

    Actualités les plus lues

    Semaine
    Mois
    Année
    1. « Quelque chose ne va vraiment pas avec les développeurs "modernes" », un développeur à "l'ancienne" critique la multiplication des bibliothèques 59
    2. Les développeurs ignorent-ils trop les failles découvertes dans leur code ? Prenez-vous en compte les remarques des autres ? 17
    3. Apercevoir la troisième dimension ou l'utilisation multithreadée d'OpenGL dans Qt, un article des Qt Quarterly traduit par Guillaume Belz 0
    4. BlackBerry 10 : premières images du prochain OS de RIM qui devrait intégrer des widgets et des tuiles inspirées de Windows Phone 0
    5. Quelles nouveautés de C++11 Visual C++ doit-il rapidement intégrer ? Donnez-nous votre avis 10
    6. Adieu qmake, bienvenue qbs : Qt Building Suite, un outil déclaratif et extensible pour la compilation de projets Qt 17
    7. La rubrique Qt a besoin de vous ! 1
    Page suivante

    Le Qt Labs au hasard

    Logo

    Construire l'avenir : (ré-)introduction aux composants de Qt Quick

    Les Qt Labs sont les laboratoires des développeurs de Qt, où ils peuvent partager des impressions sur le framework, son utilisation, ce que pourrait être son futur. Lire l'article.

    Communauté

    Ressources

    Liens utiles

    Contact

    • Vous souhaitez rejoindre la rédaction ou proposer un tutoriel, une traduction, une question... ? Postez dans le forum Contribuez ou contactez-nous par MP ou par email (voir en bas de page).

    Qt dans le magazine

    Cette page est une traduction d'une page de la documentation de Qt, écrite par Nokia Corporation and/or its subsidiary(-ies). Les éventuels problèmes résultant d'une mauvaise traduction ne sont pas imputables à Nokia. Qt qtmobility-1.2
    Copyright © 2012 Developpez LLC. Tous droits réservés Developpez LLC. Aucune reproduction, même partielle, ne peut être faite de ce site et de l'ensemble de son contenu : textes, documents et images sans l'autorisation expresse de Developpez LLC. Sinon, vous encourez selon la loi jusqu'à 3 ans de prison et jusqu'à 300 000 E de dommages et intérêts. Cette page est déposée à la SACD.
    Vous avez déniché une erreur ? Un bug ? Une redirection cassée ? Ou tout autre problème, quel qu'il soit ? Ou bien vous désirez participer à ce projet de traduction ? N'hésitez pas à nous contacter ou par MP !
     
     
     
     
    Partenaires

    Hébergement Web