Viadeo Twitter Google Bookmarks ! Facebook Digg del.icio.us MySpace Yahoo MyWeb Blinklist Netvouz Reddit Simpy StumbleUpon Bookmarks Windows Live Favorites 
Logo Documentation Qt ·  Page d'accueil  ·  Toutes les classes  ·  Toutes les fonctions  ·  Vues d'ensemble  · 

QFeedbackHapticsEffect Class Reference

The QFeedbackHapticsEffect class allows you to play a haptics effect. More...

 #include <QFeedbackHapticsEffect>

Inherits QFeedbackEffect.

Properties

Public Functions

QFeedbackHapticsEffect ( QObject * parent = 0 )
~QFeedbackHapticsEffect ()
QFeedbackActuator * actuator () const
qreal attackIntensity () const
int attackTime () const
qreal fadeIntensity () const
int fadeTime () const
qreal intensity () const
int period () const
void setActuator ( QFeedbackActuator * actuator )
void setAttackIntensity ( qreal intensity )
void setAttackTime ( int msecs )
void setDuration ( int msecs )
void setFadeIntensity ( qreal intensity )
void setFadeTime ( int msecs )
void setIntensity ( qreal intensity )
void setPeriod ( int msecs )

Reimplemented Public Functions

virtual int duration () const

Additional Inherited Members

Detailed Description

The QFeedbackHapticsEffect class allows you to play a haptics effect.

A haptics effect is an effect that takes advantage of the sense of touch. Most mobile devices today supports one such effect, vibration, which will then be the default when you create a QFeedbackHapticsEffect.

A haptics effect has a few parameters that must be set up before it can be played:

  • duration(): The total duration of the effect in milliseconds.
  • intensity(): The intensity, e.g., how hard the device will vibrate.

An effect can, for example, be set up as follows:

 QFeedbackHapticsEffect rumble;
 rumble.setIntensity(1.0);
 rumble.setDuration(100);

You can now start() the effect.

 rumble.start();

At any given time, the effect is in one of four states: Stopped, Paused, Running, or Loading. You can request a state change by calling start(), pause(), or stop(). The state is queried with state().

The haptics effect also supports a fade-in of the effect. For vibration, this means that the vibration will grow (or sink) in intensity from when the effect starts until intensity() is reached. You can set that up as follows:

 rumble.setAttackIntensity(0.0);
 rumble.setAttackTime(250);

Attack intensity is the start intensity and attack time is the duration of the fade-in. We have a similar fade-out:

 rumble.setFadeTime(250);
 rumble.setFadeIntensity(0.0);

When using fade-in and fade-out the total duration of the haptics effect will be: duration(); the main intensity() will be played for (duration() - (attackTime() + fadeTime())) milliseconds.

A QFeedbackHapticsEffect is played on an actuator(), which is the physical component that performs the effect. You can query if other actuators are available - see the QFeedbackActuator::actuators() function documentation for details.

Errors occurring during playback are notified through the error() signal.

See also QFeedbackActuator.

Property Documentation

actuator : QFeedbackActuator *

This property holds the actuator on which the effect operates.

This property defines the actuator on which the effect operates. You can only change the actuator used when the effect is stopped. Setting a null actuator resets the effect to use the default actuator.

Access functions:

QFeedbackActuator * actuator () const
void setActuator ( QFeedbackActuator * actuator )

attackIntensity : qreal

This property holds the initial intensity of the effect.

This property defines the initial intensity of the effect, before it fades in. It is usually lower than intensity. The effect will ramp up (or down) from attackIntensity() to intensity() in attackTime() milliseconds.

Access functions:

qreal attackIntensity () const
void setAttackIntensity ( qreal intensity )

attackTime : int

This property holds the duration of the fade-in effect.

This property defines the duration of the fade-in effect in milliseconds. The effect will ramp up (or down) from attackIntensity() to intensity() in attackTime() milliseconds.

If the attack time is set to a value such that attackTime() + fadeTime() is greater than duration() for non-periodic effects, or greater than period() for periodic effects, the waveform which will result is backend-specific.

Access functions:

int attackTime () const
void setAttackTime ( int msecs )

See also duration() and period().

duration : int

This property holds the expected duration of the effect.

This property defines the total duration of the feedback effect, in milliseconds. It includes the duration of any fade-in or fade-out parts, if any, in non-periodic effects, and includes all repetitions of the period in periodic-effects, if any.

If the duration is set to a value less than attackTime() + fadeTime(), or less than the period() of the effect, the waveform which will result is backend-specific.

Access functions:

virtual int duration () const
void setDuration ( int msecs )

See also fadeTime(), attackTime(), and period().

fadeIntensity : qreal

This property holds the final intensity of the effect.

This property defines the final intensity of the effect, after it fades out. It is usually lower than intensity. The effect will ramp down (or up) from intensity() to fadeIntensity() in fadeTime() milliseconds.

Access functions:

qreal fadeIntensity () const
void setFadeIntensity ( qreal intensity )

fadeTime : int

This property holds the duration of the fade-out effect.

This property defines the duration of the fade-out effect in milliseconds. The effect will ramp down (or up) from intensity() to fadeIntensity() in fadeTime() milliseconds.

If the fade time is set to a value such that attackTime() + fadeTime() is greater than duration() for non-periodic effects, or greater than period() for periodic effects, the waveform which will result is backend-specific.

Access functions:

int fadeTime () const
void setFadeTime ( int msecs )

See also duration() and period().

intensity : qreal

This property holds the intensity of the effect.

This property defines the intensity of the feedback effect. The value can be between 0 and 1.

For non-periodic effects, the effect will be at this intensity for (duration() - (attackTime() + fadeTime())) milliseconds. For periodic effects, the effect will be at this intensity once per period for (period() - (attackTime() + fadeTime())) milliseconds.

Access functions:

qreal intensity () const
void setIntensity ( qreal intensity )

period : int

This property holds set the period for the effect.

It has a default value of -1, which means that it is not a periodic effect. You can only change the period when the effect is stopped. The duration of the effect should be set to a value larger than the period of the effect if you wish the periodicity to be discernable. Note: Not all actuators support periodic effects

The period defines the total length of the periodic envelope, which will be repeated up until duration() milliseconds has elapsed. For a periodic effect, the intensity will start at attackIntensity(), ramp to intensity() (where it stays for (period() - (attackTime() + fadeTime())) milliseconds), then ramp to fadeIntensity(). This waveform will be repeated as many times as required until the duration() has elapsed.

If the period is set to a value which is less than attackTime() + fadeTime(), the waveform which will result is backend-specific.

Access functions:

int period () const
void setPeriod ( int msecs )

Member Function Documentation

QFeedbackHapticsEffect::QFeedbackHapticsEffect ( QObject * parent = 0 )

Constructs the QFeedbackHapticsEffect class, and passes parent to QObject's constructor. The default QFeedbackActuator will be used.

See also QFeedbackActuator::actuators().

QFeedbackHapticsEffect::~QFeedbackHapticsEffect ()

Destroys this effect and stops the feedback if it is running.

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.

[0]; s.parentNode.insertBefore(ga, s); })();
Publicité

Best Of

Actualités les plus lues

Semaine
Mois
Année
  1. « Quelque chose ne va vraiment pas avec les développeurs "modernes" », un développeur à "l'ancienne" critique la multiplication des bibliothèques 94
  2. Apercevoir la troisième dimension ou l'utilisation multithreadée d'OpenGL dans Qt, un article des Qt Quarterly traduit par Guillaume Belz 0
  3. Pourquoi les programmeurs sont-ils moins payés que les gestionnaires de programmes ? Manquent-ils de pouvoir de négociation ? 47
  4. Les développeurs ignorent-ils trop les failles découvertes dans leur code ? Prenez-vous en compte les remarques des autres ? 17
  5. Les développeurs détestent-ils les antivirus ? Un programmeur manifeste sa haine envers ces solutions de sécurité 13
  6. Quelles nouveautés de C++11 Visual C++ doit-il rapidement intégrer ? Donnez-nous votre avis 10
  7. Qt Commercial : Digia organise un webinar gratuit le 27 mars sur la conception d'interfaces utilisateur et d'applications avec le framework 0
Page suivante

Le Qt Quarterly au hasard

Logo

Le tri des QListView

Qt Quarterly est la revue trimestrielle proposée par Nokia et à destination des développeurs Qt. Ces articles d'une grande qualité technique sont rédigés par des experts Qt. Lire l'article.

Communauté

Ressources

Liens utiles

Contact

  • Vous souhaitez rejoindre la rédaction ou proposer un tutoriel, une traduction, une question... ? Postez dans le forum Contribuez ou contactez-nous par MP ou par email (voir en bas de page).

Qt dans le magazine

Cette page est une traduction d'une page de la documentation de Qt, écrite par Nokia Corporation and/or its subsidiary(-ies). Les éventuels problèmes résultant d'une mauvaise traduction ne sont pas imputables à Nokia. Qt qtmobility-1.1
Copyright © 2012 Developpez LLC. Tous droits réservés Developpez LLC. Aucune reproduction, même partielle, ne peut être faite de ce site et de l'ensemble de son contenu : textes, documents et images sans l'autorisation expresse de Developpez LLC. Sinon, vous encourez selon la loi jusqu'à 3 ans de prison et jusqu'à 300 000 E de dommages et intérêts. Cette page est déposée à la SACD.
Vous avez déniché une erreur ? Un bug ? Une redirection cassée ? Ou tout autre problème, quel qu'il soit ? Ou bien vous désirez participer à ce projet de traduction ? N'hésitez pas à nous contacter ou par MP !
 
 
 
 
Partenaires

Hébergement Web