summaryrefslogtreecommitdiff
path: root/src/sensors/qsensor.cpp
diff options
context:
space:
mode:
authorThomas McGuire <thomas.mcguire.qnx@kdab.com>2013-05-06 11:27:43 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-05-08 13:34:06 +0200
commitceec1eda82dd9b6f8823bb7f9639e6f79763331e (patch)
treef713309c846d0b2714aa25fb5206c0b4ebeb85d3 /src/sensors/qsensor.cpp
parent8b7ecd0eb2d9f1e46835687593b6a7f4b14b1009 (diff)
downloadqtsensors-ceec1eda82dd9b6f8823bb7f9639e6f79763331e.tar.gz
Document that the QSensor constructor should not be used directly
Change-Id: I1907497b2bb3b1be65e98223e0337eef358743b6 Reviewed-by: Lorn Potter <lorn.potter@jollamobile.com>
Diffstat (limited to 'src/sensors/qsensor.cpp')
-rw-r--r--src/sensors/qsensor.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/sensors/qsensor.cpp b/src/sensors/qsensor.cpp
index c725677..473c459 100644
--- a/src/sensors/qsensor.cpp
+++ b/src/sensors/qsensor.cpp
@@ -258,6 +258,23 @@ void QSensorPrivate::init(const QByteArray &sensorType)
/*!
Construct the \a type sensor as a child of \a parent.
+
+ Do not use this constructor if a derived class exists for the specific sensor type.
+
+ The wrong way is to use the base class constructor:
+ \snippet sensors/creating.cpp 3
+ The right way is to create an instance of the derived class:
+ \snippet sensors/creating.cpp 2
+
+ The derived classes have
+ additional properties and data members which are needed for certain features such as
+ geo value support in QMagnetometer or acceleration mode support in QAccelerometer.
+ These features will only work properly when creating a sensor instance from a QSensor
+ subclass.
+
+ Only use this constructor if there is no derived sensor class available. Note that all
+ built-in sensors have a derived class, so using this constructor should only be necessary
+ when implementing custom sensors, like in the \l {Qt Sensors - Grue Sensor Example}{Grue sensor example}.
*/
QSensor::QSensor(const QByteArray &type, QObject *parent)
: QObject(*new QSensorPrivate, parent)