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  ·  Tous les espaces de nom  ·  Toutes les classes  ·  Classes principales  ·  Annotées  ·  Classes groupées  ·  Modules  ·  Fonctions  · 

Qtopia Core Pointer Handling

When running a Qtopia Core application, it either runs as a server or connects to an existing server. The mouse driver is loaded by the server application when it starts running, using Qt's plugin system.

Internally in the client/server protocol, all system generated events, including pointer events, are passed to the server application which then propagates the event to the appropiate client. Note that pointer handling in Qtopia Core works for both mouse and mouse-like devices such as touch panels and trackballs.

Contents:

Available Drivers

Qtopia Core provides ready-made drivers for the MouseMan, IntelliMouse, Microsoft, NEC Vr41XX, Linux Touch Panel and Yopy protocols as well as the universal touch screen library, tslib. Run the configure script to list the available drivers:

 ./configure -help

In the default Qt configuration, only the "pc" mouse driver is enabled. The various drivers can be enabled and disabled using the configure script. For example:

 configure -qt-mouse-tslib

Custom mouse drivers can be implemented by subclassing the QWSMouseHandler class and creating a mouse driver plugin (derived from the QMouseDriverPlugin class). Qtopia Core's implementation of the QMouseDriverFactory class will automatically detect the plugin, loading the driver into the server application at runtime.

If you are creating a driver for a device that needs calibration or noise reduction, such as a touchscreen, derive from the QWSCalibratedMouseHandler subclass instead to take advantage of its calibration functionality.

Specifying a Driver

Provided that the "pc" mouse driver is enabled, Qtopia Core will try to auto-detect the mouse device if it is one of the supported types on /dev/psaux or one of the /dev/ttyS? serial lines. If multiple mice are detected, all may be used simultaneously.

Note that Qtopia Core does not support auto-detection of touch panels in which case the driver must be specified explicitly to determine which device to use.

To manually specify which driver to use, set the QWS_MOUSE_PROTO environment variable. For example (if the current shell is bash, ksh, zsh or sh):

 export QWS_MOUSE_PROTO=<driver>[:<driver specific options>]

The valid values for the <driver> argument are MouseMan, IntelliMouse, Microsoft, VR41xx, LinuxTP, Yopy, Tslib and keys identifying custom drivers, and the driver specific options are typically a device, e.g., /dev/mouse for mouse devices and /dev/ts for touch panels.

Multiple mouse drivers can be specified in one go:

  export QWS_MOUSE_PROTO="<driver>[:<driver specific options>]
          <driver>[:<driver specific options>]
          <driver>[:<driver specific options>]"

Input will be read from all specified drivers.

Note that the Vr41xx driver also accepts two optional arguments: press=<value> defining a mouse click (the default value is 750) and filter=<value> specifying the length of the filter used to eliminate noise (the default length is 3). For example:

 export QWS_MOUSE_PROTO="Vr41xx:press=500:/dev/misc/ts"

The Tslib Mouse Driver
The tslib mouse driver inherits the QWSCalibratedMouseHandler class, providing calibration and noise reduction functionality in addition to generating mouse events for devices using the Universal Touch Screen Library.

To be able to compile this mouse handler, Qtopia Core must be configured with the -qt-mouse-tslib option as described above. In addition, the tslib headers and library must be present in the build environment.

The tslib sources can be downloaded from http://tslib.berlios.de. Use the configure script's -L and -I options to explicitly specify the location of the library and its headers:

 ./configure  -L <path to tslib library> -I <path to tslib headers>

In order to use this mouse driver, tslib must also be correctly installed on the target machine. This includes providing a ts.conf configuration file and setting the neccessary environment variables (see the README file provided with tslib for details).

The ts.conf file will usually contain the following two lines:

  module_raw input
  module linear

To make Qtopia Core explicitly choose the tslib mouse handler, set the QWS_MOUSE_PROTO environment variable as explained above.

Troubleshooting

Device Files

Make sure you are using the correct device file.

As a first step, you can test whether the device file actually gives any output. For instance, if you have specified the mouse driver with

 QWS_MOUSE_PROTO=IntelliMouse:/dev/input/mouse0}

then try examining the output from the device by entering the following command in a console:

 cat /dev/input/mouse0 | hexdump

If you see output from the device printed on the console when you move the mouse, you are probably using the correct device file; otherwise, you will need to experiment to find the correct device file.

File Permissions

Make sure you have sufficient permissions to access the device file.

The Qtopia Core server process needs at least read permission for the device file. Some drivers also require write access to the device file. For instance, if you have specified the mouse driver with

 QWS_MOUSE_PROTO=IntelliMouse:/dev/input/mouse0

then examine the permissions of the device file by entering the following command in a console:

     chmod a+rw /dev/input/mouse0

If the device file is actually a symbolic link to another file, you must change the permissions of the actual file instead.

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 ? 43
  4. Les développeurs ignorent-ils trop les failles découvertes dans leur code ? Prenez-vous en compte les remarques des autres ? 17
  5. Quelles nouveautés de C++11 Visual C++ doit-il rapidement intégrer ? Donnez-nous votre avis 10
  6. Qt Commercial : Digia organise un webinar gratuit le 27 mars sur la conception d'interfaces utilisateur et d'applications avec le framework 0
  7. 2017 : un quinquennat pour une nouvelle version du C++ ? Possible, selon Herb Sutter 9
Page suivante

Le Qt Labs au hasard

Logo

QMake et au-delà, le retour

Les Qt Labs sont les laboratoires des développeurs de Qt, où ils peuvent partager des impressions sur le framework, son utilisation, ce que pourrait être son futur. 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.3
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