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  ·  Classes principales  ·  Annotées  ·  Classes groupées  ·  Fonctions  · 

QIMEvent Class Reference

The QIMEvent class provides parameters for input method events. More...

#include <qevent.h>

Inherits QEvent.

List of all member functions.

Public Members


Detailed Description

The QIMEvent class provides parameters for input method events.

Input method events are sent to widgets when an input method is used to enter text into a widget. Input methods are widely used to enter text in Asian and other complex languages.

The events are of interest to widgets that accept keyboard input and want to be able to correctly handle complex languages. Text input in such languages is usually a three step process.

  1. Starting to Compose
    When the user presses the first key on a keyboard an input context is created. This input context will contain a string with the typed characters.

  2. Composing
    With every new key pressed, the input method will try to create a matching string for the text typed so far. While the input context is active, the user can only move the cursor inside the string belonging to this input context.

  3. Completing
    At some point, e.g. when the user presses the Spacebar, they get to this stage, where they can choose from a number of strings that match the text they have typed so far. The user can press Enter to confirm their choice or Escape to cancel the input; in either case the input context will be closed.

Note that the particular key presses used for a given input context may differ from those we've mentioned here, i.e. they may not be Spacebar, Enter and Escape.

These three stages are represented by three different types of events. The IMStartEvent, IMComposeEvent and IMEndEvent. When a new input context is created, an IMStartEvent will be sent to the widget and delivered to the QWidget::imStartEvent() function. The widget can then update internal data structures to reflect this.

After this, an IMComposeEvent will be sent to the widget for every key the user presses. It will contain the current composition string the widget has to show and the current cursor position within the composition string. This string is temporary and can change with every key the user types, so the widget will need to store the state before the composition started (the state it had when it received the IMStartEvent). IMComposeEvents will be delivered to the QWidget::imComposeEvent() function.

Usually, widgets try to mark the part of the text that is part of the current composition in a way that is visible to the user. A commonly used visual cue is to use a dotted underline.

After the user has selected the final string, an IMEndEvent will be sent to the widget. The event contains the final string the user selected, and could be empty if they canceled the composition. This string should be accepted as the final text the user entered, and the intermediate composition string should be cleared. These events are delivered to QWidget::imEndEvent().

If the user clicks another widget, taking the focus out of the widget where the composition is taking place the IMEndEvent will be sent and the string it holds will be the result of the composition up to that point (which may be an empty string).

See also Event Classes.


Member Function Documentation

QIMEvent::QIMEvent ( Type type, const QString & text, int cursorPosition )

Constructs a new QIMEvent with the accept flag set to FALSE. type can be one of QEvent::IMStartEvent, QEvent::IMComposeEvent or QEvent::IMEndEvent. text contains the current compostion string and cursorPosition the current position of the cursor inside text.

void QIMEvent::accept ()

Sets the accept flag of the input method event object.

Setting the accept parameter indicates that the receiver of the event processed the input method event.

The accept flag is not set by default.

See also ignore().

int QIMEvent::cursorPos () const

Returns the current cursor position inside the composition string. Will return 0 for IMStartEvent and IMEndEvent.

void QIMEvent::ignore ()

Clears the accept flag parameter of the input method event object.

Clearing the accept parameter indicates that the event receiver does not want the input method event.

The accept flag is cleared by default.

See also accept().

bool QIMEvent::isAccepted () const

Returns TRUE if the receiver of the event processed the event; otherwise returns FALSE.

int QIMEvent::selectionLength () const

Returns the number of characters in the composition string ( starting at cursorPos() ) that should be marked as selected by the input widget receiving the event. Will return 0 for IMStartEvent and IMEndEvent.

const QString & QIMEvent::text () const

Returns the composition text. This is a null string for an IMStartEvent, and contains the final accepted string (which may be empty) in the IMEndEvent.


This file is part of the Qt toolkit. Copyright © 1995-2003 Trolltech. All Rights Reserved.

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. Les développeurs ignorent-ils trop les failles découvertes dans leur code ? Prenez-vous en compte les remarques des autres ? 17
  4. Pourquoi les programmeurs sont-ils moins payés que les gestionnaires de programmes ? Manquent-ils de pouvoir de négociation ? 42
  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. 2017 : un quinquennat pour une nouvelle version du C++ ? Possible, selon Herb Sutter 6
Page suivante

Le Qt Developer Network au hasard

Logo

Livre blanc de l'outillage de Qt Quick

Le Qt Developer Network est un réseau de développeurs Qt anglophone, où ils peuvent partager leur expérience sur le framework. 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 3.2
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