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  · 

QSensorReading Class Reference

The QSensorReading class holds the readings from the sensor. More...

    #include <QSensorReading>

Inherits QObject.

Inherited by QAccelerometerReading, QAmbientLightReading, QCompassReading, QMagnetometerReading, QOrientationReading, QProximityReading, QRotationReading, and QTapReading.


Properties

  • 1 property inherited from QObject

Public Functions

void setTimestamp ( qtimestamp timestamp )
qtimestamp timestamp () const
QVariant value ( int index ) const
int valueCount () const
  • 29 public functions inherited from QObject

Macros

DECLARE_READING ( classname )
IMPLEMENT_READING ( classname )

Additional Inherited Members

  • 1 public slot inherited from QObject
  • 1 signal inherited from QObject
  • 1 public type inherited from QObject
  • 4 static public members inherited from QObject
  • 7 protected functions inherited from QObject
  • 2 protected variables inherited from QObject

Detailed Description

The QSensorReading class holds the readings from the sensor.

Note that QSensorReading is not particularly useful by itself. The interesting data for each sensor is defined in a sub-class of QSensorReading.


Property Documentation

timestamp : const QtMobility::qtimestamp

This property holds the timestamp of the reading.

Access functions:

qtimestamp timestamp () const

See also qtimestamp.


Member Function Documentation

void QSensorReading::setTimestamp ( qtimestamp timestamp )

Sets the timestamp of the reading.

See also timestamp().

QVariant QSensorReading::value ( int index ) const

Returns the value of the property at index.

Note that this function is slower than calling the data function directly.

Here is an example of getting a property via the different mechanisms available.

Accessing directly provides the best performance but requires compile-time knowledge of the data you are accessing.

    QAccelerometerReading *reading = ...;
    qreal x = reading->x();

You can also access a property by name. To do this you must call QObject::property().

    qreal x = reading->property("x").value<qreal>();

Finally, you can access values via numeric index.

    qreal x = reading->value(0).value<qreal>();

Note that value() can only access properties declared with Q_PROPERTY() in sub-classes of QSensorReading.

See also valueCount() and QObject::property().

int QSensorReading::valueCount () const

Returns the number of extra properties that the reading has.

Note that this does not count properties declared in QSensorReading.

As an example, this returns 3 for QAccelerometerReading because there are 3 properties defined in that class.


Macro Documentation

DECLARE_READING ( classname )

The DECLARE_READING macro adds some required methods to a reading class.

This macro should be used for all reading classes. Pass the classname of your reading class.

    class MyReading : public QSensorReading
    {
        Q_OBJECT
        Q_PROPERTY(qreal myprop READ myprop)
        DECLARE_READING(MyReading)
    public:
        qreal myprop() const;
        vod setMyprop(qreal myprop);
    };

See also IMPLEMENT_READING().

IMPLEMENT_READING ( classname )

The IMPLEMENT_READING macro implements the required methods for a reading class.

This macro should be used for all reading classes. It should be placed into a single compilation unit (source file), not into a header file. Pass the classname of your reading class.

    IMPLEMENT_READING(MyReading)

See also DECLARE_READING().

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


Warning: mysql_connect() [function.mysql-connect]: [2002] Connection refused (trying to connect via tcp://developpez.net:3306) in /home/developpez/www/developpez-com/template/connexion.php on line 7

Warning: mysql_connect() [function.mysql-connect]: Connection refused in /home/developpez/www/developpez-com/template/connexion.php on line 7

Warning: mysql_fetch_object(): supplied argument is not a valid MySQL result resource in /home/developpez/www/developpez-com/template/pied.php on line 12