diff options
author | Thomas McGuire <thomas.mcguire.qnx@kdab.com> | 2012-08-24 14:10:57 +0200 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-08-28 00:33:19 +0200 |
commit | 2750ad7f862cedc7600637c442eea0caf29b1fd8 (patch) | |
tree | 11b068070d3203e2cbfac31311c1a5b3e5a0c450 /src/sensors/qsensor.cpp | |
parent | a1637c935a0c7055cfc905c02d072af8e54fc948 (diff) | |
download | qtsensors-2750ad7f862cedc7600637c442eea0caf29b1fd8.tar.gz |
Pass through invalid data rates to the backend instead of ignoring them
This gives the backend the chance to do something sensible with it, at
the expense of the data rate not being reported correctly in those
cases.
Change-Id: Iadf72b4448145f2454bc9422dde094ad799cb17a
Reviewed-by: Lorn Potter <lorn.potter@nokia.com>
Diffstat (limited to 'src/sensors/qsensor.cpp')
-rw-r--r-- | src/sensors/qsensor.cpp | 15 |
1 files changed, 2 insertions, 13 deletions
diff --git a/src/sensors/qsensor.cpp b/src/sensors/qsensor.cpp index 9d41dbf..56c11bc 100644 --- a/src/sensors/qsensor.cpp +++ b/src/sensors/qsensor.cpp @@ -480,20 +480,9 @@ int QSensor::dataRate() const void QSensor::setDataRate(int rate) { Q_D(QSensor); - if (rate == 0 || !isConnectedToBackend()) { + if (d->dataRate != rate) { d->dataRate = rate; - return; - } - bool warn = true; - Q_FOREACH (const qrange &range, d->availableDataRates) { - if (rate >= range.first && rate <= range.second) { - warn = false; - d->dataRate = rate; - break; - } - } - if (warn) { - qWarning() << "setDataRate:" << rate << "is not supported by the sensor."; + emit dataRateChanged(); } } |