QWindowsInputContext Class
Windows Input context implementation More...
#include <QWindowsInputContext> Inherits: QObject.
Public Functions
Reimplemented Public Functions
virtual void | invokeAction(QInputMethod::Action, int cursorPosition) |
virtual void | reset() |
virtual void | update(Qt::InputMethodQueries queries) |
- 31 public functions inherited from QObject
Static Public Members
- 11 static public members inherited from QObject
Additional Inherited Members
- 1 property inherited from QObject
- 1 public slot inherited from QObject
- 2 signal inherited from QObject
- 9 protected functions inherited from QObject
Detailed Description
Windows Input context implementation
Handles input of foreign characters (particularly East Asian) languages.
Testing
- Install the East Asian language support and choose Japanese (say).
- Compile the mainwindows/mdi example and open a text window.
- In the language bar, switch to Japanese and choose the Input method 'Hiragana'.
- In a text editor control, type the syllable 'la'. Underlined characters show up, indicating that there is completion available. Press the Space key two times. A completion popup occurs which shows the options.
Reconversion: Input texts can be 'converted' into different input modes or more completion suggestions can be made based on context to correct errors. This is bound to the 'Conversion key' (F13-key in Japanese, which can be changed in the configuration). After writing text, pressing the key selects text and triggers a conversion popup, which shows the alternatives for the word.
Interaction
When the user activates input methods, Windows sends WM_IME_STARTCOMPOSITION, WM_IME_COMPOSITION, WM_IME_ENDCOMPOSITION messages that trigger startComposition(), composition(), endComposition(), respectively. No key events are sent.
composition() determines the markup of the pre-edit or selected text and/or the final text and sends that to the focus object.
In between startComposition(), endComposition(), multiple compositions may happen (isComposing).
update() is called to synchronize the position of the candidate window with the microfocus rectangle of the focus object. Also, a hidden caret is moved along with that position, which is important for some Chinese input methods.
reset() is called to cancel a composition if the mouse is moved outside or for example some Undo/Redo operation is invoked.
Note: Mouse interaction of popups with QtWindows::InputMethodOpenCandidateWindowEvent and QtWindows::InputMethodCloseCandidateWindowEvent needs to be checked (mouse grab might interfere with candidate window).
Member Function Documentation
QWindowsInputContext::QWindowsInputContext()
QWindowsInputContext::~QWindowsInputContext()
bool QWindowsInputContext::composition(HWND hwnd, LPARAM lParamIn)
Notify focus object about markup or final text.
bool QWindowsInputContext::endComposition(HWND hwnd)
bool QWindowsInputContext::handleIME_Request(WPARAM wparam, LPARAM lparam, LRESULT * result)
QWindowsInputContext * QWindowsInputContext::instance() [static]
void QWindowsInputContext::invokeAction(QInputMethod::Action, int cursorPosition) [virtual]
int QWindowsInputContext::reconvertString(RECONVERTSTRING * reconv)
Determines the string for reconversion with selection.
This is triggered twice by WM_IME_REQUEST, first with reconv=0 to determine the length and later with a reconv struct to obtain the string with the position of the selection to be reconverted.
Obtains the text from the focus object and marks the word for selection (might not be entirely correct for Japanese).
void QWindowsInputContext::reset() [virtual]
Cancels a composition.
bool QWindowsInputContext::startComposition(HWND hwnd)
void QWindowsInputContext::update(Qt::InputMethodQueries queries) [virtual]
Moves the candidate window along with microfocus of the focus object.
|