From b974efa5ca4306b1b9474207317ade4da33bdbc9 Mon Sep 17 00:00:00 2001 From: Thomas McGuire Date: Fri, 1 Feb 2013 10:31:57 +0100 Subject: Convert QLightSensor::fieldOfView to a proper property Change-Id: Ic6e5388e0cbc2a0045157873c05aa241ffe5e82d Reviewed-by: Lorn Potter --- src/sensors/qlightsensor.cpp | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) (limited to 'src/sensors/qlightsensor.cpp') diff --git a/src/sensors/qlightsensor.cpp b/src/sensors/qlightsensor.cpp index b712bb6e..f02f6b10 100644 --- a/src/sensors/qlightsensor.cpp +++ b/src/sensors/qlightsensor.cpp @@ -120,7 +120,7 @@ char const * const QLightSensor::type("QLightSensor"); Construct the sensor as a child of \a parent. */ QLightSensor::QLightSensor(QObject *parent) - : QSensor(QLightSensor::type, parent) + : QSensor(QLightSensor::type, *new QLightSensorPrivate, parent) { } @@ -144,7 +144,33 @@ QLightSensor::~QLightSensor() \brief a value indicating the field of view. This is an angle that represents the field of view of the sensor. + + Not all light sensor support retrieving their field of view. For sensors + that don't support this property, the value will be 0. Whether the field of + view is supported can be checked with QSensor::isFeatureSupported() and the + QSensor::FieldOfView flag. +*/ + +qreal QLightSensor::fieldOfView() const +{ + Q_D(const QLightSensor); + return d->fieldOfView; +} + +/*! + \since 5.1 + + Sets the field of view. This is to be called from the + backend. */ +void QLightSensor::setFieldOfView(qreal fieldOfView) +{ + Q_D(QLightSensor); + if (d->fieldOfView != fieldOfView) { + d->fieldOfView = fieldOfView; + emit fieldOfViewChanged(fieldOfView); + } +} #include "moc_qlightsensor.cpp" QT_END_NAMESPACE -- cgit v1.2.3