QtMobility Reference Documentation

QFeedbackEffect Class Reference

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

 #include <QFeedbackEffect>

Inherits: QObject.

Inherited by: QFeedbackFileEffect and QFeedbackHapticsEffect.

This class was introduced in Qt Mobility 1.1.

Public Types

enum Duration { Infinite }
enum ErrorType { UnknownError, DeviceBusy }
enum State { Stopped, Paused, Running, Loading }
enum ThemeEffect { ThemeBasic, ThemeSensitive, ThemeBasicButton, ThemeSensitiveButton, ..., ThemeUser }

Properties

  • 1 property inherited from QObject

Public Functions

QFeedbackEffect ( QObject * parent = 0 )
virtual int duration () const = 0
virtual State state () const = 0
  • 29 public functions inherited from QObject

Public Slots

void pause ()
void start ()
void stop ()
  • 1 public slot inherited from QObject

Signals

void error ( QFeedbackEffect::ErrorType error ) const
void stateChanged ()

Static Public Members

bool playThemeEffect ( ThemeEffect effect )
bool supportsThemeEffect ()
  • 4 static public members inherited from QObject

Protected Functions

virtual void setState ( State state ) = 0
  • 7 protected functions inherited from QObject

Additional Inherited Members

  • 1 public variable inherited from QObject
  • 2 protected variables inherited from QObject

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 ThemeEffect 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::ThemeBasicButton);

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 Type Documentation

enum QFeedbackEffect::Duration

This enum describes the possible effect predefined duration types. Generally a specific milliseconds value can be supplied instead of one of these values.

ConstantValueDescription
QFeedbackEffect::Infinite-1Infinite effect duration

enum QFeedbackEffect::ErrorType

This enum describes the possible errors happening on the effect.

ConstantValueDescription
QFeedbackEffect::UnknownError0An unknown error occurred.
QFeedbackEffect::DeviceBusy1The feedback could not start because the device is busy.

See also error().

enum QFeedbackEffect::State

This enum describes the state of the effect. An effect will be in one of these states.

ConstantValueDescription
QFeedbackEffect::Stopped0The effect is not running. This is the initial state. The state changes to either Loading when loading an effect or to Running when the effect is started by calling start(). When an effect has finished playing, it will enter the Stopped state again.
QFeedbackEffect::Paused1The effect is paused. Calling start() will resume it.
QFeedbackEffect::Running2The effect is running. You can control the current state by calling the stop() or pause() functions.
QFeedbackEffect::Loading3The effect is loading. That can happen when loading is done asynchronously. When the effect has loaded, the state will change to either Running (if start() has been called) or Stopped.

See also state().

enum QFeedbackEffect::ThemeEffect

This enum describes all possible theme effect types. In general, "sensitive" versions of effects are useful if it is less important that the effect is noticed, or when a lot of the effects are going to be played close together. Theme effects might be tactile, or audio or visual.

Not all platforms and devices have distinct effects for each type.

ConstantValueDescription
QFeedbackEffect::ThemeBasic0Generic feedback.
QFeedbackEffect::ThemeSensitive1Generic sensitive feedback.
QFeedbackEffect::ThemeBasicButton2Feedback for interacting with a button (e.g. pressing).
QFeedbackEffect::ThemeSensitiveButton3Sensitive feedback for interacting with a button (e.g. auto repeat).
QFeedbackEffect::ThemeBasicKeypad4Feedback for interacting with a keypad button.
QFeedbackEffect::ThemeSensitiveKeypad5Sensitive feedback for interacting with a keypad button.
QFeedbackEffect::ThemeBasicSlider6Feedback for moving a slider.
QFeedbackEffect::ThemeSensitiveSlider7Sensitive feedback for moving a slider.
QFeedbackEffect::ThemeBasicItem8Feedback when interacting with a list or grid item.
QFeedbackEffect::ThemeSensitiveItem9Sensitive feedback when interacting with a list or grid item.
QFeedbackEffect::ThemeItemScroll10Feedback when scrolling a list or grid item view.
QFeedbackEffect::ThemeItemPick11Feedback when selecting an item to move in a list or grid view.
QFeedbackEffect::ThemeItemDrop12Feedback when dropping an item in a list or grid view.
QFeedbackEffect::ThemeItemMoveOver13Feedback when moving an item in a list or grid view.
QFeedbackEffect::ThemeBounceEffect14Feedback for a bounce effect.
QFeedbackEffect::ThemeCheckBox15Feedback for selecting a checkbox.
QFeedbackEffect::ThemeMultipleCheckBox16Feedback for selecting checkboxes of multiple items.
QFeedbackEffect::ThemeEditor17Feedback for interacting with an editor.
QFeedbackEffect::ThemeTextSelection18Feedback for selecting text.
QFeedbackEffect::ThemeBlankSelection19Feedback for a blank selection.
QFeedbackEffect::ThemeLineSelection20Feedback for selecting a line.
QFeedbackEffect::ThemeEmptyLineSelection21Feedback for selecting an empty line.
QFeedbackEffect::ThemePopUp22Generic feedback for interacting with a popup.
QFeedbackEffect::ThemePopupOpen23Generic feedback when a popup opens.
QFeedbackEffect::ThemePopupClose24Generic feedback when a popup closes.
QFeedbackEffect::ThemeFlick25Generic feedback when starting a flick gesture.
QFeedbackEffect::ThemeStopFlick26Generic feedback when stopping a flick.
QFeedbackEffect::ThemeMultiPointTouchActivate27Generic feedback when a touch gesture with more than one point is started.
QFeedbackEffect::ThemeRotateStep28Feedback when rotating using a gesture.
QFeedbackEffect::ThemeLongPress29Feedback for a long press (or tap and hold) gesture.
QFeedbackEffect::ThemePositiveTacticon30Generic feedback for notification of a successful operation.
QFeedbackEffect::ThemeNeutralTacticon31Generic feedback for notification.
QFeedbackEffect::ThemeNegativeTacticon32Generic feedback for notification of a failed operation.
QFeedbackEffect::NumberOfThemeEffects33The number of built-in effects.
QFeedbackEffect::ThemeUser65535The starting point for any user defined effects, where supported.

Property Documentation

duration : const int

This property holds duration of the feedback effect, in milliseconds.

In some cases the duration will be unknown, which will be reported as 0. If the duration is infinite, QFeedbackEffect::Infinite will be returned. Some subclasses may have more than one type of duration (for example, QFeedbackHapticsEffect), and this property will return the total duration of the effect.

Access functions:

virtual int duration () const = 0

state : const State

This property holds state of the feedback effect.

This returns the state of the feedback effect. The State enumeration reports the possible states.

Access functions:

virtual State state () const = 0

Notifier signal:

void stateChanged ()

Member Function Documentation

QFeedbackEffect::QFeedbackEffect ( QObject * parent = 0 )

Constructs the QFeedbackEffect base class, and passes parent to QObject's constructor. This is called by the classes that inherit from this class.

void QFeedbackEffect::error ( QFeedbackEffect::ErrorType error ) const [signal]

This signal is emitted by subclasses if an error occurred during playback of an effect. The ErrorType enum describes the errors that can be reported.

This function was introduced in Qt Mobility 1.1.

void QFeedbackEffect::pause () [slot]

Pauses a playing effect. If an error occurs the error() signal will be emitted. Not all systems support pausing an effect during playback.

This function was introduced in Qt Mobility 1.1.

bool QFeedbackEffect::playThemeEffect ( ThemeEffect effect ) [static]

This function plays effect instantly and returns true if the effect could be played; otherwise, returns false.

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

Requests the effect to change its State to change to the specified state.

Subclasses reimplement this function to handle state change requests for the effect.

This function was introduced in Qt Mobility 1.1.

See also state().

void QFeedbackEffect::start () [slot]

Starts playing the effect. If an error occurs the error() signal will be emitted.

This function was introduced in Qt Mobility 1.1.

See also stop().

void QFeedbackEffect::stateChanged () [signal]

This signal is emitted by subclasses when the State of the effect changes.

This function was introduced in Qt Mobility 1.1.

See also state().

void QFeedbackEffect::stop () [slot]

Stops a playing effect. If an error occurs the error() signal will be emitted.

This function was introduced in Qt Mobility 1.1.

See also start(), pause(), and setState().

bool QFeedbackEffect::supportsThemeEffect () [static]

Returns true if playing themed feedback is available.

X

Thank you for giving your feedback.

Make sure it is related to this specific page. For more general bugs and requests, please use the Qt Bug Tracker.