Why is setPreeditText not directly available in QML?
-
Hi,
I have been trying to use the setPreeditText function in QML to set preedit text dynamically for my virtual keyboard implementation. However, when I call setPreeditText from QML (e.g., InputContext.setPreeditText()), I receive the following error:
Property 'setPreeditText' of object QVirtualKeyboardInputContext(xxxxxxx) is not a function
Could you please clarify:
- Is setPreeditText not exposed in QML?
- Is there any official documentation or Qt design guideline that explicitly mentions this limitation?
- If possible, could you share the recommended way to dynamically set preedit text in QML? I would greatly appreciate any suggestions.
Thank you for your time and help!
-
I found that the InputContext object in QML does not have a setPreeditText function. This method is only available in the C++ QInputMethodEvent class.
QML: https://doc.qt.io/qt-5/qml-qtquick-virtualkeyboard-inputcontext.html
C++: https://doc.qt.io/qt-5/qvirtualkeyboardinputcontext.htmlBelow are my remaining questions:
- Is there any official documentation or Qt design guideline that explicitly mentions this limitation?
- If possible, could you share the recommended way to preedit text in QML?
-
According to the documentation, https://doc.qt.io/qt-5/qml-qtquick-virtualkeyboard-inputcontext.html#preeditText-prop:
preeditText : string
This property sets the pre-edit text.
The property isn't marked read-only, indicating that an application can assign to it.