Reliably triggering Ubuntu 22.04 GNOME OSK from QLineEdit (Without Wayland / Without qtvirtualkeyboard)
-
Hi everyone,
I am developing a Qt 6.5.3 C++ Widgets application running on an Ubuntu 22.04 touchscreen IPC. Wayland is disabled (strictly using an X11/Xorg session).
I cannot use the GPLv3-licensed qtvirtualkeyboard. I need to use Ubuntu’s native GNOME On-Screen Keyboard (OSK).
The Issue:
When a user taps inside a Qt QLineEdit, the default GNOME OSK behaves erratically—sometimes it pops up, but most of the time it doesn't trigger at all. This unreliability happens on a completely stock Ubuntu installation, I tried installing the "Improved OSK" GNOME extension and tested it and it's the same behaviour.Currently, I am using a workaround where I launch the onboard keyboard utility via QProcess on focus events. While this works, it feels like an unnecessary external dependency hack.
Questions:
-
Is there a way to make Qt 6 text widgets properly communicate focus changes to the GNOME/X11 accessibility layer so the native OSK triggers 100% of the time?
-
What is the correct D-Bus interface/method under Ubuntu 22.04 to manually force the default GNOME keyboard to show/hide from C++?
Any insights on bridging this Qt-to-GNOME input gap would be greatly appreciated!
-
-
My advise would be to write your own virtual keyboard app using Qt. Since it seems you are writing a kiosk application then consider dropping gnome completely and run the app on a raw X11 session.
Well, actually a kiosk application is one of the few places where wayland is actually appropriate since it is a single application (if you integrate the popup keyword)