Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
QLocale Keyboard Input set Language
i am using linux embedded with debian as OS.
I can change the locale language and keyboard input language on Debian but on Qt5 i can only change
QLocale but not keyboard input language.
I found this: Note: "For the current keyboard input locale take a look at QInputMethod::locale()."
How do i instaciate from this class and how do i change the language keyboard input?
On Qt4 they have QLocale QApplication::keyboardInputLocale() where i can change the input language.
You can use the QGuiApplication::inputMethod function to retrieve the current input method.
I can read the locale from QInputMethod class but how do i set the language?
I have tryied this:
QGuiApplication app(argc, argv); QLocale::setDefault(QLocale::German); QLocale l; qDebug() << l.language(); app.inputMethod()->locale().setDefault(QLocale::German); qDebug() << app.inputMethod()->locale().language();
But qDebug() gave me this:
C is the inputMethod QLocale and i cannot change this to other languages.
Is the only way to change the input keyboard language with the QEglFSFunctions::loadKeymap(".qmap")
function on linux?
i made it work with the tool kmap2qmap and loaded like this on main:
QEglFSFunctions myKeyboard_Layout; myKeyboard_Layout.loadKeymap("/home/root/de-latin1-nodeadkeys.qmap");
The keymaps on the OS where all with .gz zipped. To make it work with the tool i had to "gunzip" all the files from
/usr/share/keymaps/i386/qwertz and /usr/share/keymaps/i386/include
kmap2qmap /usr/share/keymaps/i386/qwertz/de-latin1-nodeadkeys.kmap de-latin1-nodeadkeys.qmap
After that you have your .qmap file. Copy it to the directory where your application runs at and add the function in main to set the right keymap fo the keyboard.