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  · 

QGesture Class Reference
[QtGui module]

The QGesture class represents a gesture, containing properties that describe the corresponding user input. More...

 #include <QGesture>

Inherits QObject.

Inherited by QPanGesture, QPinchGesture, QSwipeGesture, QTapAndHoldGesture, and QTapGesture.

This class was introduced in Qt 4.6.


Public Types

enum GestureCancelPolicy { CancelNone, CancelAllInContext }

Properties

  • 1 property inherited from QObject

Public Functions

QGesture ( QObject * parent = 0 )
~QGesture ()
GestureCancelPolicy gestureCancelPolicy () const
Qt::GestureType gestureType () const
bool hasHotSpot () const
QPointF hotSpot () const
void setGestureCancelPolicy ( GestureCancelPolicy policy )
void setHotSpot ( const QPointF & value )
Qt::GestureState state () const
void unsetHotSpot ()
  • 29 public functions inherited from QObject

Additional Inherited Members

  • 1 public slot inherited from QObject
  • 1 signal inherited from QObject
  • 5 static public members inherited from QObject
  • 7 protected functions inherited from QObject

Detailed Description

The QGesture class represents a gesture, containing properties that describe the corresponding user input.

Gesture objects are not constructed directly by developers. They are created by the QGestureRecognizer object that is registered with the application; see QGestureRecognizer::registerRecognizer().

Gesture Properties

The class has a list of properties that can be queried by the user to get some gesture-specific arguments. For example, the pinch gesture has a scale factor that is exposed as a property.

Developers of custom gesture recognizers can add additional properties in order to provide additional information about a gesture. This can be done by adding new dynamic properties to a QGesture object, or by subclassing the QGesture class (or one of its subclasses).

Lifecycle of a Gesture Object

A QGesture instance is implicitly created when needed and is owned by Qt. Developers should never destroy them or store them for later use as Qt may destroy particular instances of them and create new ones to replace them.

The registered gesture recognizer monitors the input events for the target object via its recognize() function, updating the properties of the gesture object as required.

The gesture object may be delivered to the target object in a QGestureEvent if the corresponding gesture is active or has just been canceled. Each event that is delivered contains a list of gesture objects, since support for more than one gesture may be enabled for the target object. Due to the way events are handled in Qt, gesture events may be filtered by other objects.

See also QGestureEvent and QGestureRecognizer.


Member Type Documentation

enum QGesture::GestureCancelPolicy

This enum describes how accepting a gesture can cancel other gestures automatically.

ConstantValueDescription
QGesture::CancelNone0On accepting this gesture no other gestures will be affected.
QGesture::CancelAllInContext1On accepting this gesture all gestures that are active in the context (respecting the Qt::GestureFlag that were specified when subscribed to the gesture) will be cancelled.


Property Documentation

gestureCancelPolicy : QGesture::GestureCancelPolicy

This property holds the policy for deciding what happens on accepting a gesture.

On accepting one gesture Qt can automatically cancel other gestures that belong to other targets. The policy is normally set to not cancel any other gestures and can be set to cancel all active gestures in the context. For example for all child widgets.

Access functions:

GestureCancelPolicy gestureCancelPolicy () const
void setGestureCancelPolicy ( GestureCancelPolicy policy )

gestureType : const Qt::GestureType

This property holds the type of the gesture.

Access functions:

Qt::GestureType gestureType () const

hasHotSpot : const bool

This property holds whether the gesture has a hot-spot.

Access functions:

bool hasHotSpot () const

hotSpot : QPointF

This property holds the point that is used to find the receiver for the gesture event.

The hot-spot is a point in the global coordinate system, use QWidget::mapFromGlobal() or QGestureEvent::mapToGraphicsScene() to get a local hot-spot.

The hot-spot should be set by the gesture recognizer to allow gesture event delivery to a QGraphicsObject.

Access functions:

QPointF hotSpot () const
void setHotSpot ( const QPointF & value )
void unsetHotSpot ()

state : const Qt::GestureState

This property holds the current state of the gesture.

Access functions:

Qt::GestureState state () const

Member Function Documentation

QGesture::QGesture ( QObject * parent = 0 )

Constructs a new gesture object with the given parent.

QGesture objects are created by gesture recognizers in the QGestureRecognizer::create() function.

QGesture::~QGesture ()

Destroys the gesture object.

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 53
  2. Les développeurs ignorent-ils trop les failles découvertes dans leur code ? Prenez-vous en compte les remarques des autres ? 17
  3. Apercevoir la troisième dimension ou l'utilisation multithreadée d'OpenGL dans Qt, un article des Qt Quarterly traduit par Guillaume Belz 0
  4. BlackBerry 10 : premières images du prochain OS de RIM qui devrait intégrer des widgets et des tuiles inspirées de Windows Phone 0
  5. Quelles nouveautés de C++11 Visual C++ doit-il rapidement intégrer ? Donnez-nous votre avis 10
  6. Adieu qmake, bienvenue qbs : Qt Building Suite, un outil déclaratif et extensible pour la compilation de projets Qt 17
  7. La rubrique Qt a besoin de vous ! 1
Page suivante

Le Qt Quarterly au hasard

Logo

XQuery et la météo

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 4.6
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