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  · 

QGeoPositionInfoSource Class Reference

The QGeoPositionInfoSource class is an abstract base class for the distribution of positional updates. More...

 #include <QGeoPositionInfoSource>

Inherits QObject.

Inherited by QNmeaPositionInfoSource.

Public Types

enum PositioningMethod { SatellitePositioningMethods, NonSatellitePositioningMethods, AllPositioningMethods }
flags PositioningMethods

Properties

  • 1 property inherited from QObject

Public Functions

QGeoPositionInfoSource ( QObject * parent )
virtual ~QGeoPositionInfoSource ()
virtual QGeoPositionInfo lastKnownPosition ( bool fromSatellitePositioningMethodsOnly = false ) const = 0
virtual int minimumUpdateInterval () const = 0
PositioningMethods preferredPositioningMethods () const
virtual void setPreferredPositioningMethods ( PositioningMethods methods )
virtual void setUpdateInterval ( int msec )
virtual PositioningMethods supportedPositioningMethods () const = 0
int updateInterval () const
  • 29 public functions inherited from QObject

Public Slots

virtual void requestUpdate ( int timeout = 0 ) = 0
virtual void startUpdates () = 0
virtual void stopUpdates () = 0
  • 1 public slot inherited from QObject

Signals

void positionUpdated ( const QGeoPositionInfo & update )
void updateTimeout ()

Static Public Members

QGeoPositionInfoSource * createDefaultSource ( QObject * parent )
  • 4 static public members inherited from QObject

Additional Inherited Members

  • 1 public variable inherited from QObject
  • 7 protected functions inherited from QObject
  • 2 protected variables inherited from QObject

Detailed Description

The QGeoPositionInfoSource class is an abstract base class for the distribution of positional updates.

The static function QGeoPositionInfoSource::createDefaultSource() creates a default position source that is appropriate for the platform, if one is available. Otherwise, QGeoPositionInfoSource can be subclassed to create an appropriate custom source of position data.

Users of a QGeoPositionInfoSource subclass can request the current position using requestUpdate(), or start and stop regular position updates using startUpdates() and stopUpdates(). When an update is available, positionUpdated() is emitted. The last known position can be accessed with lastKnownPosition().

If regular position updates are required, setUpdateInterval() can be used to specify how often these updates should be emitted. If no interval is specified, updates are simply provided whenever they are available. For example:

 // Emit updates every 10 seconds if available
 QGeoPositionInfoSource *source = QGeoPositionInfoSource::createDefaultSource(0);
 if (source)
     source->setUpdateInterval(10000);

To remove an update interval that was previously set, call setUpdateInterval() with a value of 0.

Note that the position source may have a minimum value requirement for update intervals, as returned by minimumUpdateInterval().

Warning: On Windows CE it is not possible to detect if a device is GPS enabled. The default position source on a Windows CE device without GPS support will never provide any position data.

Member Type Documentation

enum QGeoPositionInfoSource::PositioningMethod
flags QGeoPositionInfoSource::PositioningMethods

Defines the types of positioning methods.

ConstantValueDescription
QGeoPositionInfoSource::SatellitePositioningMethods0x000000ffSatellite-based positioning methods such as GPS.
QGeoPositionInfoSource::NonSatellitePositioningMethods0xffffff00Other positioning methods.
QGeoPositionInfoSource::AllPositioningMethods0xffffffffA flag that matches all positioning methods.

The PositioningMethods type is a typedef for QFlags<PositioningMethod>. It stores an OR combination of PositioningMethod values.

Property Documentation

minimumUpdateInterval : const int

This property holds this property holds the minimum time (in milliseconds) required to retrieve a position update.

This is the minimum value accepted by setUpdateInterval() and requestUpdate().

Access functions:

virtual int minimumUpdateInterval () const = 0

updateInterval : int

This property holds this property holds the requested interval in milliseconds between each update.

If the update interval is not set (or is set to 0) the source will provide updates as often as necessary.

If the update interval is set, the source will provide updates at an interval as close to the requested interval as possible. If the requested interval is less than the minimumUpdateInterval(), the minimum interval is used instead.

Changes to the update interval will happen as soon as is practical, however the time the change takes may vary between implementations. Whether or not the elapsed time from the previous interval is counted as part of the new interval is also implementation dependent.

The default value for this property is 0.

Note: Subclass implementations must call the base implementation of setUpdateInterval() so that updateInterval() returns the correct value.

Access functions:

int updateInterval () const
virtual void setUpdateInterval ( int msec )

Member Function Documentation

QGeoPositionInfoSource::QGeoPositionInfoSource ( QObject * parent )

Creates a position source with the specified parent.

QGeoPositionInfoSource::~QGeoPositionInfoSource () [virtual]

Destroys the position source.

QGeoPositionInfoSource * QGeoPositionInfoSource::createDefaultSource ( QObject * parent ) [static]

Creates and returns a position source with the given parent that reads from the system's default sources of location data.

Returns 0 if the system has no default position source.

Note: Symbian applications will need to have the Location capability otherwise this will return 0.

QGeoPositionInfo QGeoPositionInfoSource::lastKnownPosition ( bool fromSatellitePositioningMethodsOnly = false ) const [pure virtual]

Returns an update containing the last known position, or a null update if none is available.

If fromSatellitePositioningMethodsOnly is true, this returns the last known position received from a satellite positioning method; if none is available, a null update is returned.

void QGeoPositionInfoSource::positionUpdated ( const QGeoPositionInfo & update ) [signal]

If startUpdates() or requestUpdate() is called, this signal is emitted when an update becomes available.

The update value holds the value of the new update.

PositioningMethods QGeoPositionInfoSource::preferredPositioningMethods () const

Returns the positioning methods set by setPreferredPositioningMethods().

See also setPreferredPositioningMethods().

void QGeoPositionInfoSource::requestUpdate ( int timeout = 0 ) [pure virtual slot]

Attempts to get the current position and emit positionUpdated() with this information. If the current position cannot be found within the given timeout (in milliseconds) or if timeout is less than the value returned by minimumUpdateInterval(), updateTimeout() is emitted.

If the timeout is zero, the timeout defaults to a reasonable timeout period as appropriate for the source.

This does nothing if another update request is in progress. However it can be called even if startUpdates() has already been called and regular updates are in progress.

If the source uses multiple positioning methods, it tries to gets the current position from the most accurate positioning method within the given timeout.

void QGeoPositionInfoSource::setPreferredPositioningMethods ( PositioningMethods methods ) [virtual]

Sets the preferred positioning methods for this source to methods.

If methods includes a method that is not supported by the source, the unsupported method will be ignored.

If methods does not include any methods supported by the source, the preferred methods will be set to the set of methods which the source supports.

Note: When reimplementing this method, subclasses must call the base method implementation to ensure preferredPositioningMethods() returns the correct value.

See also preferredPositioningMethods() and supportedPositioningMethods().

void QGeoPositionInfoSource::startUpdates () [pure virtual slot]

Starts emitting updates at regular intervals as specified by setUpdateInterval().

If setUpdateInterval() has not been called, the source will emit updates as soon as they become available.

An updateTimout() signal will be emitted if this QGeoPositionInfoSource subclass determines that it will not be able to provide regular updates. This could happen if a satellite fix is lost or if a hardware error is detected. Position updates will recommence if the data becomes available later on. The updateTimout() signal will not be emitted again until after the periodic updates resume.

void QGeoPositionInfoSource::stopUpdates () [pure virtual slot]

Stops emitting updates at regular intervals.

PositioningMethods QGeoPositionInfoSource::supportedPositioningMethods () const [pure virtual]

Returns the positioning methods available to this source.

See also setPreferredPositioningMethods().

void QGeoPositionInfoSource::updateTimeout () [signal]

If requestUpdate() was called, this signal will be emitted if the current position could not be retrieved within the specified timeout.

If startUpdates() has been called, this signal will be emitted if this QGeoPositionInfoSource subclass determines that it will not be able to provide further regular updates. This signal will not be emitted again until after the regular updates resume.

X

Thank you for giving your feedback.

Make sure it is related to this specific page. For more general bugs and requests, please use the Qt Bug Tracker.

[0]; s.parentNode.insertBefore(ga, s); })();
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 64
  2. Apercevoir la troisième dimension ou l'utilisation multithreadée d'OpenGL dans Qt, un article des Qt Quarterly traduit par Guillaume Belz 0
  3. Les développeurs ignorent-ils trop les failles découvertes dans leur code ? Prenez-vous en compte les remarques des autres ? 17
  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 Quarterly au hasard

Logo

Implémenter un mutex en lecture et en écriture

Qt Quarterly est la revue trimestrielle proposée par Nokia et à destination des développeurs Qt. Ces articles d'une grande qualité technique sont rédigés par des experts Qt. 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.1
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