QFeedbackActuator Class

The QFeedbackActuator class describes actuators for tactile feedback. More...

Header: #include <QFeedbackActuator>
Instantiated By: Actuator

Public Types

enum Capability { Envelope, Period }
enum State { Busy, Ready, Unknown }

Properties

  • state : const QFeedbackActuator::State
  • valid : const bool

Public Functions

QFeedbackActuator(QObject *parent = Q_NULLPTR)
int id() const
bool isCapabilitySupported(QFeedbackActuator::Capability capability) const
bool isEnabled() const
bool isValid() const
QString name() const
void setEnabled(bool enabled)
QFeedbackActuator::State state() const
bool operator==(const QFeedbackActuator &) const

Signals

Static Public Members

QList<QFeedbackActuator *> actuators()
const QMetaObject staticMetaObject

Detailed Description

The QFeedbackActuator class describes actuators for tactile feedback.

An actuator knows how to play a tactile effect. The class gives access to a specified actuator.

An actuator can be used to play QFeedbackHapticsEffects using setActuator(). Usually, you will not have to set an actuator directly on a QFeedbackHapticsEffect. QFeedbackHapticsEffect and QFeedbackFileEffect uses an appropriate actuator by default. However, you can query which actuators are available with actuators().


 QFeedbackActuator actuator; // default system actuator
 QList<QFeedbackActuator> actuators = QFeedbackActuator::actuators();
 foreach (const QFeedbackActuator& temp, actuators) {
     if (temp.name() == "ExampleActuatorName") {
         actuator = temp;
     }
 }

The QFeedbackActuator class gives access to information about the actuator it represents. You can query if the actuator is enabled and if it is valid . Whether an actuator is ready to play an effect can be queried by checking the actuator's state(). The State enum describes the states and actuator can have. You can also get a human readable name for the actuator with the name() function.

See also QFeedbackHapticsEffect, QFeedbackFileEffect, and QFeedbackEffect.

Member Type Documentation

enum QFeedbackActuator::Capability

ConstantValueDescription
QFeedbackActuator::Envelope0Capability defining the wave type with attack/fade times and levels.
QFeedbackActuator::Period1Capability defining that the device can play periodic effects.

enum QFeedbackActuator::State

ConstantValueDescription
QFeedbackActuator::Busy0The actuator is busy.
QFeedbackActuator::Ready1The actuator is ready to play an effect.
QFeedbackActuator::Unknown2The actuator is in an unknown state.

Property Documentation

enabled : bool

This property holds whether the feedback actuator is enabled

Access functions:

bool isEnabled() const
void setEnabled(bool enabled)

Notifier signal:

void enabledChanged()

id : const int

id of the feedback actuator.

Access functions:

int id() const

name : const QString

name of the feedback actuator

Access functions:

QString name() const

state : const QFeedbackActuator::State

state of the feedback actuator

Access functions:

QFeedbackActuator::State state() const

valid : const bool

validity of the feedback actuator

Access functions:

bool isValid() const

Member Function Documentation

QFeedbackActuator::QFeedbackActuator(QObject *parent = Q_NULLPTR)

Constructs a QFeedbackActuator, passing parent to the QObject constructor.

The object will represent the default actuator on the system. If there are no actuators attached to the system, isValid() will return false.

See also isValid().

[static] QList<QFeedbackActuator *> QFeedbackActuator::actuators()

int QFeedbackActuator::id() const

Returns the id of the actuator.

This function was introduced in Qt 1.1.

Note: Getter function for property id.

bool QFeedbackActuator::isCapabilitySupported(QFeedbackActuator::Capability capability) const

Returns if the actuator supports the supplied capability.

Note: This function can be invoked via the meta-object system and from QML. See Q_INVOKABLE.

bool QFeedbackActuator::isEnabled() const

Returns true if you can use this actuator to start effects.

Note: Getter function for property enabled.

bool QFeedbackActuator::isValid() const

Returns true if the actuator is valid.

Note: Getter function for property valid.

QString QFeedbackActuator::name() const

Returns the name of the actuator.

Note: Getter function for property name.

void QFeedbackActuator::setEnabled(bool enabled)

Allows you to enable or disable an actuator. If enabled is true, the actuator will be enabled, and otherwise it will be disabled.

Note: Some systems may not allow you to change whether an actuator is enabled.

Note: Setter function for property enabled.

See also isEnabled().

QFeedbackActuator::State QFeedbackActuator::state() const

Returns the state of the actuator.

Note: Getter function for property state.

bool QFeedbackActuator::operator==(const QFeedbackActuator &) const