Skip to content

Draft: Implement basic input method support.

Wolthera van Hövell requested to merge text-tool-phase-1-ime into text-tool-phase-1

This MR implements basic input method support and applies on top of the text cursor MR (!1912).

text-demo-input-method-support.mp4

The pre-edit string (or compose string), is handled via an Undo command, and never added to the undo stack.

It is more or less complete, except for some problems:

  • I'm having a hard time figuring out how https://doc.qt.io/qt-6/qinputmethod.html is supposed to be used: in particular I'm commiting, but when we switch texts it now resets because committing doesn't quite seem to do what I expected it to...
  • I am wondering whether QVariant inputMethodQuery(Qt::InputMethodQuery query, const KoViewConverter &converter) const override; in KoToolBase needs that converter, given that the tool always has access to the canvas which has everything we need. Similarly, virtual void updateInputMethodInfo() = 0; in KoCanvasBase.h is never implemented anywhere, and the function it is supossed to call is a QApplication function.
  • Qt’s platform integration is very horizontal-tb focused, and thus may look somewhat glitchy. There’s nothing we can do here because Qt never implemented ImhNoTextHandles for android.
  • Similarly, said input support uses Qt’s StandardKey for the behaviour of the floating menu, we might need to manually check for these KeySequences and activate the associated actions.

How to test…

  • On Linux, you can setup either iBus (don’t ask me how, the KDE dialog is terribly confusing), and I think the Compose key should also work.
  • On MacOS, the longpress on vowels should show a little menu with diacritics on said vowels: this is an input method.
  • Apparantly Windows 10+ has a onscreen keyboard that can be used.
  • For Android, all edits via the onscreen keyboard are supossed to be input method driven.
Edited by Wolthera van Hövell

Merge request reports