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.
enum | Duration { Infinite } |
enum | ErrorType { UnknownError, DeviceBusy } |
enum | State { Stopped, Paused, Running, Loading } |
enum | ThemeEffect { ThemeBasic, ThemeSensitive, ThemeBasicButton, ThemeSensitiveButton, ..., ThemeUser } |
QFeedbackEffect ( QObject * parent = 0 ) | |
virtual int | duration () const = 0 |
virtual State | state () const = 0 |
void | pause () |
void | start () |
void | stop () |
void | error ( QFeedbackEffect::ErrorType error ) const |
void | stateChanged () |
bool | playThemeEffect ( ThemeEffect effect ) |
bool | supportsThemeEffect () |
virtual void | setState ( State state ) = 0 |
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.
This enum describes the possible effect predefined duration types. Generally a specific milliseconds value can be supplied instead of one of these values.
Constant | Value | Description |
---|---|---|
QFeedbackEffect::Infinite | -1 | Infinite effect duration |
This enum describes the possible errors happening on the effect.
Constant | Value | Description |
---|---|---|
QFeedbackEffect::UnknownError | 0 | An unknown error occurred. |
QFeedbackEffect::DeviceBusy | 1 | The feedback could not start because the device is busy. |
See also error().
This enum describes the state of the effect. An effect will be in one of these states.
Constant | Value | Description |
---|---|---|
QFeedbackEffect::Stopped | 0 | The 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::Paused | 1 | The effect is paused. Calling start() will resume it. |
QFeedbackEffect::Running | 2 | The effect is running. You can control the current state by calling the stop() or pause() functions. |
QFeedbackEffect::Loading | 3 | The 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().
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.
Constant | Value | Description |
---|---|---|
QFeedbackEffect::ThemeBasic | 0 | Generic feedback. |
QFeedbackEffect::ThemeSensitive | 1 | Generic sensitive feedback. |
QFeedbackEffect::ThemeBasicButton | 2 | Feedback for interacting with a button (e.g. pressing). |
QFeedbackEffect::ThemeSensitiveButton | 3 | Sensitive feedback for interacting with a button (e.g. auto repeat). |
QFeedbackEffect::ThemeBasicKeypad | 4 | Feedback for interacting with a keypad button. |
QFeedbackEffect::ThemeSensitiveKeypad | 5 | Sensitive feedback for interacting with a keypad button. |
QFeedbackEffect::ThemeBasicSlider | 6 | Feedback for moving a slider. |
QFeedbackEffect::ThemeSensitiveSlider | 7 | Sensitive feedback for moving a slider. |
QFeedbackEffect::ThemeBasicItem | 8 | Feedback when interacting with a list or grid item. |
QFeedbackEffect::ThemeSensitiveItem | 9 | Sensitive feedback when interacting with a list or grid item. |
QFeedbackEffect::ThemeItemScroll | 10 | Feedback when scrolling a list or grid item view. |
QFeedbackEffect::ThemeItemPick | 11 | Feedback when selecting an item to move in a list or grid view. |
QFeedbackEffect::ThemeItemDrop | 12 | Feedback when dropping an item in a list or grid view. |
QFeedbackEffect::ThemeItemMoveOver | 13 | Feedback when moving an item in a list or grid view. |
QFeedbackEffect::ThemeBounceEffect | 14 | Feedback for a bounce effect. |
QFeedbackEffect::ThemeCheckBox | 15 | Feedback for selecting a checkbox. |
QFeedbackEffect::ThemeMultipleCheckBox | 16 | Feedback for selecting checkboxes of multiple items. |
QFeedbackEffect::ThemeEditor | 17 | Feedback for interacting with an editor. |
QFeedbackEffect::ThemeTextSelection | 18 | Feedback for selecting text. |
QFeedbackEffect::ThemeBlankSelection | 19 | Feedback for a blank selection. |
QFeedbackEffect::ThemeLineSelection | 20 | Feedback for selecting a line. |
QFeedbackEffect::ThemeEmptyLineSelection | 21 | Feedback for selecting an empty line. |
QFeedbackEffect::ThemePopUp | 22 | Generic feedback for interacting with a popup. |
QFeedbackEffect::ThemePopupOpen | 23 | Generic feedback when a popup opens. |
QFeedbackEffect::ThemePopupClose | 24 | Generic feedback when a popup closes. |
QFeedbackEffect::ThemeFlick | 25 | Generic feedback when starting a flick gesture. |
QFeedbackEffect::ThemeStopFlick | 26 | Generic feedback when stopping a flick. |
QFeedbackEffect::ThemeMultiPointTouchActivate | 27 | Generic feedback when a touch gesture with more than one point is started. |
QFeedbackEffect::ThemeRotateStep | 28 | Feedback when rotating using a gesture. |
QFeedbackEffect::ThemeLongPress | 29 | Feedback for a long press (or tap and hold) gesture. |
QFeedbackEffect::ThemePositiveTacticon | 30 | Generic feedback for notification of a successful operation. |
QFeedbackEffect::ThemeNeutralTacticon | 31 | Generic feedback for notification. |
QFeedbackEffect::ThemeNegativeTacticon | 32 | Generic feedback for notification of a failed operation. |
QFeedbackEffect::NumberOfThemeEffects | 33 | The number of built-in effects. |
QFeedbackEffect::ThemeUser | 65535 | The starting point for any user defined effects, where supported. |
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 |
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 () |
Constructs the QFeedbackEffect base class, and passes parent to QObject's constructor. This is called by the classes that inherit from this class.
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.
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.
This function plays effect instantly and returns true if the effect could be played; otherwise, returns false.
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().
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().
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().
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().
Returns true if playing themed feedback is available.
© 2008-2011 Nokia Corporation and/or its subsidiaries. Nokia, Qt and their respective logos are trademarks of Nokia Corporation in Finland and/or other countries worldwide.
All other trademarks are property of their respective owners. Privacy Policy
Licensees holding valid Qt Commercial licenses may use this document in accordance with the Qt Commercial License Agreement provided with the Software or, alternatively, in accordance with the terms contained in a written agreement between you and Nokia.
Alternatively, this document may be used under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation.