summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorThomas McGuire <thomas.mcguire.qnx@kdab.com>2013-05-13 11:27:11 +0200
committerLorn Potter <lorn.potter@jollamobile.com>2013-05-13 21:50:50 +0200
commitf062c5c6cc304157b866cf9ff5b96c3409251e04 (patch)
tree92799c8956eca5514eb875af8cb04c0757766f59 /src
parent3806d66336329832afd0c1ed91f766b4f98fbf02 (diff)
Document that the QSensor constructor should not be used directly
This is a backport of QtSensors commit ceec1eda82dd9b6f8823bb7f9639e6f79763331e Change-Id: I3e5d8bc99d9f14163c45593e216d21e2f972999d Reviewed-by: Lorn Potter <lorn.potter@jollamobile.com>
Diffstat (limited to 'src')
-rw-r--r--src/sensors/qsensor.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/sensors/qsensor.cpp b/src/sensors/qsensor.cpp
index fdbe9d4f61..54d91b79f5 100644
--- a/src/sensors/qsensor.cpp
+++ b/src/sensors/qsensor.cpp
@@ -201,8 +201,28 @@ void QSensorPrivate::init(const QByteArray &sensorType)
type = sensorType;
q->registerInstance(); // so the availableSensorsChanged() signal works
}
+
/*!
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 snippets/sensors/creating.cpp 3
+ The right way is to create an instance of the derived class:
+ \snippet snippets/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 {Grue Application}{Grue sensor
+ example}.
+
\since 1.0
*/
QSensor::QSensor(const QByteArray &type, QObject *parent)