QFeedbackEffect Class

The QFeedbackEffect class is the abstract base class for feedback effects. More...

Header: #include <QFeedbackEffect>
Inherited By:

QFeedbackHapticsEffect

Public Functions

void pause()
void stop()

Protected Functions

virtual void setState(QFeedbackEffect::State) = 0
void stateChanged()

Detailed Description

The QFeedbackEffect class is the abstract base class for feedback effects.

It represents an effect to provide feedback to a person (i.e., an effect that affect human senses). The technology available today usually only provides haptic effects, which deal with the sense of touch, and audio effects. The QFeedbackHapticsEffect and QFeedbackFileEffect are implementations of haptic effects and can be used to control a mobile device's vibrator. In addition, the QFeedbackFileEffect can also be used to play audio feedback.

Feedback effects have a duration, which is measured in milliseconds. Subclasses reimplement duration() to inform how long the effect lasts. The duration is the total time the effect will last, and thus includes any envelope modifiers (attack and fade).

At any given time, a feedback effect is in one of four states: Loading, Stopped, Running, or Paused. See the State enum documentation for further details. Subclasses must reimplement state() to report which state an effect is in, and setState() to receive state change requests. The start(), pause(), and stop() slots calls setState() with the corresponding new State. Changes in state are reported through the stateChanged() signal and may happen asynchronously some time after the state change request.

A system often has a set of standard feedback effects for user interface interaction (e.g., button clicks). The Effect describes the standard effects that QFeedbackEffect supports. It is named so because the effects often depend on the theme of the user interface. You can play these effects using the playThemeEffect() function.


 QFeedbackEffect::playThemeEffect(QFeedbackEffect::Press);

The playThemeEffect() function returns true if the effect was played successfully. An effect may not be played if the system does not support it or if an error occurred.

Member Function Documentation

void QFeedbackEffect::pause()

[pure virtual protected] void QFeedbackEffect::setState(QFeedbackEffect::State)

[protected] void QFeedbackEffect::stateChanged()

void QFeedbackEffect::stop()