QSensorReading

Since: 1.0

#include <QtSensors/QSensorReading>

QtSensors

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


Overview

Properties Index

QtMobility::qtimestamptimestamp [read-only]

Public Functions Index

virtual ~QSensorReading ()
voidsetTimestamp (qtimestamp timestamp)
qtimestamptimestamp () const
QVariantvalue (int index) const
intvalueCount () const

Protected Functions Index

QSensorReading (QObject *parent, QSensorReadingPrivate *d)
virtual voidcopyValuesFrom (QSensorReading *other)
QScopedPointer< QSensorReadingPrivate > *d_ptr ()

Properties

QtMobility::qtimestamp timestamp[read-only]

the timestamp of the reading.

See also:

qtimestamp

Since:

1.0

,

1.0

Public Functions

virtual~QSensorReading ()

Destructor.

void setTimestamp (

Sets the timestamp of the reading.

Since:

1.0

qtimestamp timestamp ()

QVariant value (
  • intindex)

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(), QObject::property()

Since:

1.0

int valueCount ()

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.
Since:

1.0

Protected Functions

QSensorReading (
  • QObject *parent,
  • QSensorReadingPrivate *d )

virtual void copyValuesFrom (

QScopedPointer< QSensorReadingPrivate > * d_ptr ()

Last modified: 2014-06-24



Got questions about leaving a comment? Get answers from our Disqus FAQ.

comments powered by Disqus