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  · 

QWSMouseHandler Class Reference
[QtGui module]

The QWSMouseHandler class is a base class for mouse drivers in Qt for Embedded Linux. More...

 #include <QWSMouseHandler>

Inherited by QWSCalibratedMouseHandler.

Public Functions


Detailed Description

The QWSMouseHandler class is a base class for mouse drivers in Qt for Embedded Linux.

Note that this class is only available in Qt for Embedded Linux.

Qt for Embedded Linux provides ready-made drivers for several mouse protocols, see the pointer handling documentation for details. Custom mouse drivers can be implemented by subclassing the QWSMouseHandler class and creating a mouse driver plugin (derived from QMouseDriverPlugin). The default implementation of the QMouseDriverFactory class will automatically detect the plugin, and load the driver into the server application at run-time using Qt's plugin system.

The mouse driver receives mouse events from the system device and encapsulates each event with an instance of the QWSEvent class which it then passes to the server application (the server is responsible for propagating the event to the appropriate client). To receive mouse events, a QWSMouseHandler object will usually create a QSocketNotifier object for the given device. The QSocketNotifier class provides support for monitoring activity on a file descriptor. When the socket notifier receives data, it will call the mouse driver's mouseChanged() function to send the event to the Qt for Embedded Linux server application for relaying to clients.

If you are creating a driver for a device that needs calibration or noise reduction, such as a touchscreen, use the QWSCalibratedMouseHandler subclass instead to take advantage of the calibrate() and clearCalibration() functions. The Mouse Calibration demonstrates how to write a simple program using the mechanisms provided by the QWSMouseHandler class to calibrate a mouse driver.

Note that when deriving from the QWSMouseHandler class, the resume() and suspend() functions must be reimplemented to control the flow of mouse input, i.e., the default implementation does nothing. Reimplementations of these functions typically call the QSocketNotifier::setEnabled() function to enable or disable the socket notifier, respectively.

In addition, QWSMouseHandler provides the setScreen() function that allows you to specify a screen for your mouse driver and the limitToScreen() function that ensures that a given position is within this screen's boundaries (changing the position if necessary). Finally, QWSMouseHandler provides the pos() function returning the current mouse position.

See also QMouseDriverPlugin, QMouseDriverFactory, and Qt for Embedded Linux Pointer Handling.


Member Function Documentation

QWSMouseHandler::QWSMouseHandler ( const QString & driver = QString(), const QString & device = QString() )

Constructs a mouse driver. The driver and device arguments are passed by the QWS_MOUSE_PROTO environment variable.

Call the QWSServer::setMouseHandler() function to make the newly created mouse driver, the primary driver. Note that the primary driver is controlled by the system, i.e., the system will delete it upon exit.

QWSMouseHandler::~QWSMouseHandler ()   [virtual]

Destroys this mouse driver.

Do not call this function if this driver is the primary mouse driver, i.e., if QWSServer::setMouseHandler() function has been called passing this driver as argument. The primary mouse driver is deleted by the system.

void QWSMouseHandler::calibrate ( const QWSPointerCalibrationData * data )   [virtual]

This virtual function allows subclasses of QWSMouseHandler to set the calibration information passed in the given data. Note that the default implementation does nothing.

See also QWSCalibratedMouseHandler::calibrate() and clearCalibration().

void QWSMouseHandler::clearCalibration ()   [virtual]

This virtual function allows subclasses of QWSMouseHandler to clear the calibration information. Note that the default implementation does nothing.

See also QWSCalibratedMouseHandler::clearCalibration() and calibrate().

void QWSMouseHandler::getCalibration ( QWSPointerCalibrationData * data ) const   [virtual]

This virtual function allows subclasses of QWSMouseHandler to fill in the device coordinates in data with values that correspond to screen coordinates that are already in data. Note that the default implementation does nothing.

void QWSMouseHandler::limitToScreen ( QPoint & position )

Ensures that the given position is within the screen's boundaries, changing the position if necessary.

See also pos() and setScreen().

void QWSMouseHandler::mouseChanged ( const QPoint & position, int state, int wheel = 0 )

Notifies the system of a new mouse event.

This function updates the current mouse position and sends the event to the Qt for Embedded Linux server application for delivery to the correct widget. Note that a custom mouse driver must call this function whenever it wants to deliver a new mouse event.

The given position is the global position of the mouse cursor. The state parameter is a bitmask of the Qt::MouseButton enum's values, indicating which mouse buttons are pressed. The wheel parameter is the delta value of the mouse wheel as returned by QWheelEvent::delta().

See also pos().

const QPoint & QWSMouseHandler::pos () const

Returns the current mouse position.

See also mouseChanged() and limitToScreen().

void QWSMouseHandler::resume ()   [pure virtual]

Implement this function to resume reading and handling mouse events, e.g., call the QSocketNotifier::setEnabled() function to enable the socket notifier.

See also suspend().

void QWSMouseHandler::setScreen ( const QScreen * screen )

Sets the screen for this mouse driver to be the given screen.

This function was introduced in Qt 4.2.

See also limitToScreen().

void QWSMouseHandler::suspend ()   [pure virtual]

Implement this function to suspend reading and handling of mouse events, e.g., call the QSocketNotifier::setEnabled() function to disable the socket notifier.

See also resume().

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 102
  2. Pourquoi les programmeurs sont-ils moins payés que les gestionnaires de programmes ? Manquent-ils de pouvoir de négociation ? 53
  3. «Le projet de loi des droits du développeur» : quelles conditions doivent remplir les entreprises pour que le développeur puisse réussir ? 77
  4. Les développeurs détestent-ils les antivirus ? Un programmeur manifeste sa haine envers ces solutions de sécurité 28
  5. Qt Commercial : Digia organise un webinar gratuit le 27 mars sur la conception d'interfaces utilisateur et d'applications avec le framework 0
  6. Quelles nouveautés de C++11 Visual C++ doit-il rapidement intégrer ? Donnez-nous votre avis 10
  7. 2017 : un quinquennat pour une nouvelle version du C++ ? Possible, selon Herb Sutter 11
Page suivante
  1. Linus Torvalds : le "C++ est un langage horrible", en justifiant le choix du C pour le système de gestion de version Git 100
  2. Comment prendre en compte l'utilisateur dans vos applications ? Pour un développeur, « 90 % des utilisateurs sont des idiots » 229
  3. Quel est LE livre que tout développeur doit lire absolument ? Celui qui vous a le plus marqué et inspiré 96
  4. Apple cède et s'engage à payer des droits à Nokia, le conflit des brevets entre les deux firmes s'achève 158
  5. Nokia porte à nouveau plainte contre Apple pour violation de sept nouveaux brevets 158
  6. « Quelque chose ne va vraiment pas avec les développeurs "modernes" », un développeur à "l'ancienne" critique la multiplication des bibliothèques 102
  7. Quel est le code dont vous êtes le plus fier ? Pourquoi l'avez-vous écrit ? Et pourquoi vous a-t-il donné autant de satisfaction ? 83
Page suivante

Le Qt Quarterly au hasard

Logo

Optimisation avec QPixmapCache et PyQt

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.5
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