diff options
author | Lincoln Ramsay <lincoln.ramsay@nokia.com> | 2011-12-20 19:03:08 +1000 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-01-13 04:12:01 +0100 |
commit | 44150b8815fd133bd86b033abd19a41b9ad81fb8 (patch) | |
tree | 61b55bb0b3a50c99bf6e45722ad8878753894996 /src/imports/sensors2/qsensor2proximity.cpp | |
parent | 4187d0baa96c4731abfcddfe2c24cf4ef4e72ac5 (diff) |
alwaysOn for QtSensors 5.0 sensors
refactor the enabled and alwaysOn properties into a common base class
use appropriate namespacing to avoid collisions with the QtMobility.sensors elements
Change-Id: I6ac9f040d226bb648ede5459df2c26b82feff587
Sanity-Review: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Wolfgang Beck <wolfgang.beck@nokia.com>
Diffstat (limited to 'src/imports/sensors2/qsensor2proximity.cpp')
-rw-r--r-- | src/imports/sensors2/qsensor2proximity.cpp | 27 |
1 files changed, 2 insertions, 25 deletions
diff --git a/src/imports/sensors2/qsensor2proximity.cpp b/src/imports/sensors2/qsensor2proximity.cpp index 4322ad7c..14b0e599 100644 --- a/src/imports/sensors2/qsensor2proximity.cpp +++ b/src/imports/sensors2/qsensor2proximity.cpp @@ -46,6 +46,7 @@ QT_BEGIN_NAMESPACE /*! \qmlclass ProximitySensor QSensor2Proximity + \inherits QtSensors5::Sensor \inqmlmodule QtSensors 5 \ingroup qml-QtSensors5 \since QtSensors 5.0 @@ -55,7 +56,7 @@ QT_BEGIN_NAMESPACE */ QSensor2Proximity::QSensor2Proximity(QObject* parent) - : QObject(parent) + : qsensor2common(parent) , _near(false) { _proximity = new QProximitySensor(this); @@ -67,30 +68,6 @@ QSensor2Proximity::~QSensor2Proximity() } /*! - \qmlproperty bool QtSensors5::ProximitySensor::enabled - This property can be used to activate or deactivate the sensor. -*/ -bool QSensor2Proximity::enabled() -{ - return _proximity->isActive(); -} - -void QSensor2Proximity::setEnabled(bool val) -{ - bool active = enabled(); - if (active != val){ - if (val){ - bool ret = _proximity->start(); - if (!ret) - qWarning() << "couldn't start the sensor."; - } - else - _proximity->stop(); - emit enabledChanged(); - } -} - -/*! \qmlproperty bool QtSensors5::ProximitySensor::near This property holds whether the sensor has detected something in close proximity. Device dependent, but typically 1-2 cm. |