- Qt 5.0
- QFeedbackActuator
- Qt 5.0.0 Reference Documentation

# QFeedbackActuator Class

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

Header: | #include <QFeedbackActuator>
Instantiated By: | Actuator

- List of all members, including inherited members

## Public Types

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

## Properties

- enabled : bool
- id : const int
- name : const QString

- state : const QFeedbackActuator::State
- valid : const bool

## Public Functions

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

## Signals

void | enabledChanged()

## Static Public Members

QList<QFeedbackActuator *> | actuators()

## Detailed Description

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

Constant | Value | Description
--- | --- | ---
`QFeedbackActuator::Envelope` | `0` | Capability defining the wave type with attack/fade times and levels.
`QFeedbackActuator::Period` | `1` | Capability defining that the device can play periodic effects.

### enum QFeedbackActuator::State

Constant | Value | Description
--- | --- | ---
`QFeedbackActuator::Busy` | `0` | The actuator is busy.
`QFeedbackActuator::Ready` | `1` | The actuator is ready to play an effect.
`QFeedbackActuator::Unknown` | `2` | The 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:

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().

### `[signal]` void QFeedbackActuator::enabledChanged()

This signal is emitted when the actuator is requested to enable or disable itself.

Note: Notifier signal for property enabled.

See also isEnabled().

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

Returns the list of actuators available on the system.

### int QFeedbackActuator::id() const

Returns the id of the actuator.

Note: Getter function for property id.

This function was introduced in Qt 1.1.

### bool QFeedbackActuator::isCapabilitySupported(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().

### State QFeedbackActuator::state() const

Returns the state of the actuator.

Note: Getter function for property state.

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

Returns true if this actuator is equal to other.