Read the qtvirtualkeyboard current locale
-
Hello
I'm using qt5 virtualkeyboard with qtkioskbrowser and Yocto, branch dunfell.
I need to persistently store the virtualkeyboard language / localeAt start I do
VirtualKeyboardSettings.locale = ls.getLocale();
"ls.getLocale()" reads the locale from disk, e.g. "en_GB". When I open the virtualkeyboard, the locale is properly set.I also set
Qt.inputMethod.localeChanged.connect(languageUpdated);
which calls "languageUpdated" when I switch the virtualkeyboard locale.
"languageUpdated" is called as expected but I don't know how to get the current locale.
If I print "VirtualKeyboardSettings.locale", I see the locale I set at startup but not the one I switched to.function languageUpdated()
{
console.log(VirtualKeyboardSettings.locale);
}
Which attribute does return the current virtualkeyboard locale?I also found that "VirtualKeyboardSettings.availableLocales" is emtpy although I set
"PACKAGECONFIG_pn-qtvirtualkeyboard = "lang-de_DE lang-es_ES lang-en_GB lang-ja_JP qtquickcompiler"I tried to set the languages manually
VirtualKeyboardSettings.activeLocales = ["de_DE", "es_ES, "en_GB "ja_JP"]
but this did not help.Help appreciated, Chris
-
set virtual keyboard language:
Component.onCompleted: { VirtualKeyboardSettings.locale = "en_UK" }detect new locale when changing the keyboard language:
Connections { target: InputContext onLocaleChanged: { console.debug("new locale:", InputContext.locale) } }limit the language selection list of the keyboard language button:
Component.onCompleted: { VirtualKeyboardSettings.activeLocales = ["de_DE", "es_ES", "en_UK"] }