QSensorGestureRecognizer Class

The QSensorGestureRecognizer class is the base class for a sensor gesture recognizer. 更多...

头: #include <QSensorGestureRecognizer>
qmake: QT += sensors
Since: Qt 5.1
继承: QObject

该类在 Qt 5.1 引入。

公共函数

QSensorGestureRecognizer (QObject * parent = Q_NULLPTR)
virtual ~QSensorGestureRecognizer ()
void createBackend ()
QStringList gestureSignals () const
virtual QString id () const = 0
virtual bool isActive () = 0
void startBackend ()
void stopBackend ()

信号

void detected ( const QString & )

保护函数

virtual void create () = 0
virtual bool start () = 0
virtual bool stop () = 0

详细描述

QSensorGesture recognizer developers should sub-class this to implement their own recognizer.

All sensor gesture recognizers have a detected( QString ) signal. Implementors can use this and send recognizer specific gestures, such as detected("shake_left") or implement custom signals such as shakeLeft().

These custom signals will be available in the QSensorGesture object at runtime.

另请参阅 QSensorGestureRecognizer::gestureSignals ().

成员函数文档编制

QSensorGestureRecognizer:: QSensorGestureRecognizer ( QObject * parent = Q_NULLPTR)

Constructs the QSensorGestureRecognizer with parent 作为父级。

[signal] void QSensorGestureRecognizer:: detected ( const QString & )

Signals when a gesture is recognized. Implementors can use this signal to send recognizer-specific gestures, such as detected("shake_left") or implement custom signals such as shakeLeft() .

The custom signals are available in the QSensorGesture object at runtime.

[虚拟] QSensorGestureRecognizer:: ~QSensorGestureRecognizer ()

Destroy the QSensorGestureRecognizer

[pure virtual protected] void QSensorGestureRecognizer:: create ()

Called by QSensorGesture object constructor to create the recognizers backend.

Implementors would use this to instantiate QSensors and connect signals.

void QSensorGestureRecognizer:: createBackend ()

调用 QSensorGestureRecognizer::create () if the recognizer is valid.

QStringList QSensorGestureRecognizer:: gestureSignals () const

Returns a list of signals that this recognizer supports.

Note that all signals declared will be exported to the QSensorGesture object. If you need to use signals that are not exported, you should use a private class to do so.

[pure virtual] QString QSensorGestureRecognizer:: id () const

Returns the identifier for this recognizer.

[pure virtual] bool QSensorGestureRecognizer:: isActive ()

Returns true if this recognizer is active, otherwise false.

[pure virtual protected] bool QSensorGestureRecognizer:: start ()

Called by QSensorGesture::startDetection () to start this recognizer. Implementors should start the sensors. Returns true if the operation is successful.

void QSensorGestureRecognizer:: startBackend ()

调用 QSensorGestureRecognizer::start () if the recognizer isn't already initialized. This is called by the QSensorGesture object, so please use that instead.

另请参阅 QSensorGesture::startDetection ().

[pure virtual protected] bool QSensorGestureRecognizer:: stop ()

Called by QSensorGesture::stopDetection () to stop this recognizer. Returns true if the call succeeds, otherwise false.

Implementors should stop the sensors.

void QSensorGestureRecognizer:: stopBackend ()

调用 QSensorGestureRecognizer::stop () if no other clients are using it. This is called by the QSensorGesture object, so please use that instead.

另请参阅 QSensorGesture::stopDetection ().