Home · All Classes · Main Classes · Grouped Classes · Modules · Functions

QWSInputMethod Class Reference
[QtGui module]

The QWSInputMethod class provides international input methods for Qtopia Core. More...

#include <QWSInputMethod>

Inherits QObject.

Public Functions

Protected Functions

Additional Inherited Members


Detailed Description

The QWSInputMethod class provides international input methods for Qtopia Core.

Subclass this class to implement your own input method.

An input methods consists of a keyboard filter and optionally a graphical interface. The keyboard filter intercepts key events from physical or virtual keyboards by implementing the filter() function.

Use sendIMEvent() to send composition events.

Use QWSServer::setCurrentInputMethod() to install an input method.

This class is still subject to change.


Member Function Documentation

QWSInputMethod::QWSInputMethod ()

Constructs a new input method

QWSInputMethod::~QWSInputMethod ()   [virtual]

Destructs the input method uninstalling it if it is currently installed.

bool QWSInputMethod::filter ( int unicode, int keycode, int modifiers, bool isPress, bool autoRepeat )   [pure virtual]

This function must be implemented in subclasses to handle key input from physical or virtual keyboards. Returning true will block the event from further processing.

The Unicode value is given in unicode and the key code in keycode. Keyboard modifiers are OR-ed together in modifiers. If isPress is true this is a key press; otherwise it is a key release. If autoRepeat is true this is an auto-repeated key press.

void QWSInputMethod::mouseHandler ( int x, int state )   [virtual]

Implemented in subclasses to handle mouse presses/releases within the preedit text. The parameter x is the offset within the string that was sent with the InputMethodCompose event. state is either QWSServer::MousePress or QWSServer::MouseRelease

if state < 0 then the mouse event is inside the widget, but outside the preedit text

QWSServer::MouseOutside is sent when clicking in a different widget.

The default implementation resets the input method on all mouse presses.

void QWSInputMethod::queryResponse ( int property, const QVariant & result )   [virtual]

This event handler is implemented in subclasses to receive replies to an input method query.

The specified property and result contain the property queried and the result returned in the reply.

See also QWSServer::sendIMQuery().

void QWSInputMethod::reset ()   [virtual]

Implemented in subclasses to reset the state of the input method.

The default implementation calls sendIMEvent() with empty preedit and commit strings, if the input method is in compose mode.

void QWSInputMethod::sendCommitString ( const QString & commitString, int replaceFrom = 0, int replaceLength = 0 )   [protected]

Sends an input method event with commit string commitString. This is a convenience function for sendEvent().

If replaceLength is greater than 0, the commit string will replace replaceLength characters of the receiving widget's previous text, starting at replaceFrom relative to the start of the preedit string.

This will cause the input method to leave compose mode.

See also sendEvent(), sendPreeditString(), and QInputMethodEvent.

void QWSInputMethod::sendEvent ( const QInputMethodEvent * )   [protected]

void QWSInputMethod::sendIMEvent ( QWSServer::IMState state, const QString & txt, int cpos, int selLen = 0 )   [protected]

Causes a QIMEvent to be sent to the focus widget.

txt is the preedit string if state is QWSServer::IMCompose, or the commit string if state is QWSServer::IMEnd.

If state is QWSServer::IMCompose, cpos is the cursor position within the preedit string, and selLen is the number of characters (starting at cpos) that should be marked as selected by the input widget receiving the event.

Use sendEvent(), sendPreeditString() or sendCommitString() instead.

void QWSInputMethod::sendPreeditString ( const QString & preeditString, int cursorPosition, int selectionLength = 0 )   [protected]

Sends an input method event with preedit string preeditString and cursor position cursorPosition. selectionLength is the number of characters to be marked as selected (starting at cursorPosition). If selectionLength is negative, the text before cursorPosition is marked.

This is a convenience function for sendEvent().

The preedit string is marked with QInputContext::PreeditFormat, and the selected part is marked with QInputContext::SelectionFormat.

Sending an input method event with a non-empty preedit string will cause the input method to enter compose mode. Sending an input method event with an empty preedit string will cause the input method to leave compose mode.

See also sendEvent(), sendCommitString(), and QInputMethodEvent.

void QWSInputMethod::sendQuery ( int property )   [protected]

Sends an input method query for the specified property.

Reimplement the virtual function queryResponse() to receive responses to input method queries.

See also queryResponse().

void QWSInputMethod::updateHandler ( int type )   [virtual]

Handles update events, including resets and focus changes.

Reimplementations must call the base implementation for all cases that it does not handle itself.

type is a value defined in QWSIMUpdateCommand::UpdateType.


Copyright © 2005 Trolltech Trademarks
Qt 4.1.0
Hosted by uCoz