SensorGesture QML Type

Provides notifications when sensor-based gestures are detected. More...

Import Statement: import QtSensors 5.15
Since: QtSensors 5.0



Detailed Description

This type provides notification when sensor gestures are triggered.

The following QML code creates a "shake" and "SecondCounter" SensorGesture QML type, and displays the detected gesture in a text type.

QtSensors.shake gesture is available with the Qt Sensors API, but the QtSensors.SecondCounter sensor gesture is provided as example code for the Qt Sensors - SensorGesture QML Type example

 Item {
    SensorGesture {
        id: sensorGesture
        enabled: false
        gestures : ["QtSensors.shake", "QtSensors.SecondCounter"]
            detectedText.text = gesture
    Text {
        id: detectedText

Qt Sensor Gestures contains a list of currently supported sensor gestures and their descriptions.

Property Documentation

availableGestures : stringlist

This property can be used to determine all available gestures on the system.

enabled : bool

This property can be used to activate or deactivate the sensor gesture. Default value is false;

See also SensorGesture::detected and detected.

gestures : stringlist

Set this property to a list of the gestures that the application is interested in detecting. This property cannot be changed while the type is enabled.

The properties validGestures and invalidGestures will be set as appropriate immediately. To determine all available getures on the system please use the availableGestures property.

See also QtSensorGestures Plugins.

invalidGestures : stringlist

This property holds the requested gestures that were not found on the system.

validGestures : stringlist

This property holds the requested gestures that were found on the system.

Signal Documentation

detected(string gesture)

This signal is emitted whenever a gesture is detected. The gesture parameter contains the gesture that was detected.

The corresponding handler is onDetected.

Note: The corresponding handler is onDetected.

© 2023 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.