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  ·  Modules  ·  Fonctions  · 

QInputMethod Class

The QInputMethod class provides access to the active text input method. More...

 #include <QInputMethod>

Inherits: QObject.

Public Types

enum Action { Click, ContextMenu }

Properties

  • 1 property inherited from QObject

Public Functions

QRectF cursorRectangle() const
Qt::LayoutDirection inputDirection() const
QTransform inputItemTransform() const
bool isAnimating() const
bool isVisible() const
QRectF keyboardRectangle() const
QLocale locale() const
void setInputItemTransform(const QTransform & transform)
void setVisible(bool visible)
  • 31 public functions inherited from QObject

Public Slots

void commit()
void hide()
void invokeAction(Action a, int cursorPosition)
void reset()
void show()
void update(Qt::InputMethodQueries queries)
  • 1 public slot inherited from QObject

Signals

void animatingChanged()
void cursorRectangleChanged()
void inputDirectionChanged(Qt::LayoutDirection newDirection)
void inputItemChanged()
void keyboardRectangleChanged()
void localeChanged()
void visibleChanged()

Additional Inherited Members

  • 11 static public members inherited from QObject
  • 9 protected functions inherited from QObject

Detailed Description

The QInputMethod class provides access to the active text input method.

QInputMethod is used by the text editors for integrating to the platform text input methods and more commonly by application views for querying various text input method-related information like virtual keyboard visibility and keyboard dimensions.

Qt Quick also provides access to QInputMethod in QML through Qt global object as Qt.inputMethod property.

Member Type Documentation

enum QInputMethod::Action

Property Documentation

animating : const bool

This property holds true when the virtual keyboard is being opened or closed.

Animating is false when keyboard is fully open or closed. When animating is true and visibility is true keyboard is being opened. When animating is true and visibility is false keyboard is being closed.

Access functions:

bool isAnimating() const

Notifier signal:

void animatingChanged()

cursorRectangle : const QRectF

This property holds input item's cursor rectangle in window coordinates.

Cursor rectangle is often used by various text editing controls like text prediction popups for following the text being typed.

Access functions:

QRectF cursorRectangle() const

Notifier signal:

void cursorRectangleChanged()

inputDirection : const Qt::LayoutDirection

This property holds current input direction.

Access functions:

Qt::LayoutDirection inputDirection() const

Notifier signal:

void inputDirectionChanged(Qt::LayoutDirection newDirection)

keyboardRectangle : const QRectF

This property holds virtual keyboard's geometry in window coordinates.

Access functions:

QRectF keyboardRectangle() const

Notifier signal:

void keyboardRectangleChanged()

locale : const QLocale

This property holds current input locale.

Access functions:

QLocale locale() const

Notifier signal:

void localeChanged()

visible : const bool

This property holds virtual keyboard's visibility on the screen.

Input method visibility remains false for devices with no virtual keyboards.

Access functions:

bool isVisible() const

Notifier signal:

void visibleChanged()

See also show() and hide().

Member Function Documentation

void QInputMethod::commit() [slot]

Commits the word user is currently composing to the editor. The function is mostly needed by the input methods with text prediction features and by the methods where the script used for typing characters is different from the script that actually gets appended to the editor. Any kind of action that interrupts the text composing needs to flush the composing state by calling the commit() function, for example when the cursor is moved elsewhere.

void QInputMethod::hide() [slot]

Requests virtual keyboard to close.

Normally applications should not need to call this function, keyboard should automatically close when the text editor loses focus, for example when the parent view is closed.

QTransform QInputMethod::inputItemTransform() const

Returns the transformation from input item coordinates to the window coordinates.

See also setInputItemTransform().

void QInputMethod::invokeAction(Action a, int cursorPosition) [slot]

Called by the input item when the word currently being composed is tapped by the user. Input methods often use this information to offer more word suggestions to the user.

void QInputMethod::reset() [slot]

Resets the input method state. For example, a text editor normally calls this method before inserting a text to make widget ready to accept a text.

Input method resets automatically when the focused editor changes.

void QInputMethod::setInputItemTransform(const QTransform & transform)

Sets the transformation from input item coordinates to the window coordinates. Item transform needs to be updated by the focused window like QQuickCanvas whenever item is moved inside the scene.

See also inputItemTransform().

void QInputMethod::setVisible(bool visible)

Controls the keyboard visibility. Equivalent to calling show() and hide() functions.

See also visible(), show(), and hide().

void QInputMethod::show() [slot]

Requests virtual keyboard to open. If the platform doesn't provide virtual keyboard the visibility remains false.

Normally applications should not need to call this function, keyboard should automatically open when the text editor gains focus.

void QInputMethod::update(Qt::InputMethodQueries queries) [slot]

Called by the input item to inform the platform input methods when there has been state changes in editor's input method query attributes. When calling the function queries parameter has to be used to tell what has changes, which input method can use to make queries for attributes it's interested with QInputMethodQueryEvent.

In particular calling update whenever the cursor position changes is important as that often causes other query attributes like surrounding text and text selection to change as well. The attributes that often change together with cursor position have been grouped in Qt::ImQueryInput value for convenience.

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 5.0-snapshot
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