IME popup placement on Ubuntu 16.04 using iBus
-
Hi everyone,
My issue is the placement of the IME popup when using iBus as the IME for Ubuntu 16.04. I will try to give some context. The app I am working on consists of a widget that acts as a graphical context to stream video. If the OS that the app is running on has a different input method selected i.e Chinese (Pinyin) (IBus) then I am not able to set the position of the popup for character selection.
My implementation works for Windows by recording the last clicked mouse position and reporting that as the value for the query to Qt::ImCursorRectangle, which is requested in the overridden virtual method QWidget::inputMethodQuery(). When using this method the popup is placed correctly below the position of the last mouse click.
When testing the app under Ubuntu the function QWidget::inputMethodQuery() is never called by QGuiApplication and so I can never provide the position for the popup to be drawn. I have also tried setting the input item rectangle using QGuiApplication::inputMethod()->setInputItemRectangle(rect); but this also doesn't work.
I'm out of ideas at the moment as the problem seems to be with the different behaviours of the platform integrations in Qt (QIBusPlatformInputContext and QWindowsInputContext).
I've also considered spinning up my own QtVitualKeyboard but would like to avoid this if possible as it would be nice to just use the OS's IME.
Any advice would be appreciated.
Thanks,
Richard