QProximityReading

Since: 1.0

#include <QtSensors/QProximityReading>

QtSensors

The QProximityReading class represents one reading from the proximity sensor.

QProximityReading_Units The proximity sensor can only indicate if an object is close or not.

The distance at which an object is considered close is device-specific. This distance may be available in the QSensor::outputRanges property.


Overview

Inheritance

QSensorReading
QProximityReading

Properties Index

boolclose [read-only]
QtMobility::qtimestamptimestamp [read-only]Inherited

Public Functions Index

boolclose () const
voidsetClose (bool close)
voidsetTimestamp (qtimestamp timestamp)Inherited
qtimestamptimestamp () const Inherited
QVariantvalue (int index) const Inherited
intvalueCount () const Inherited

Protected Functions Index

Only has inherited protected functions

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

Properties

bool close[read-only]

a value indicating if something is close.

See also:

QProximityReading_Units

Since:

1.0

QtMobility::qtimestamp timestampInherited[read-only]

the timestamp of the reading.

See also:

qtimestamp

Since:

1.0

,

1.0

Public Functions

bool close ()

void setClose (
  • boolclose)

Sets the close value to close.

Since:

1.0

void setTimestamp (Inherited

Sets the timestamp of the reading.

Since:

1.0

qtimestamp timestamp ()Inherited

QVariant value (
  • intindex)
Inherited

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 ()Inherited

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

(Only has inherited protected functions)

virtual void copyValuesFrom (Inherited

QScopedPointer< QSensorReadingPrivate > * d_ptr ()Inherited

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

Last modified: 2014-09-30



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

comments powered by Disqus