How to change Qt 5.7 virtual keyboard / locale layout

I am writing a small Windows application with Qt 5.7 using qml. For my project, I would need to change the virtual keyboard layout. But after hours of reading documents and trying various things, I still can’t achieve this.

My Qt installation is the default installation for Windows and it has been updated (just checked if there will be updates).

As you can see here, the keyboard uses en_EN locale, despite the fact that my OS localization is fi_FI. Also note that the Change Language button is disabled.

enter image description here

I also tried to list the available locales from the keyboard settings, and I tried to set the locale manually using the keyboard settings, but the layout will not change. Here is my code for these things:

InputPanel {
    id: keyboardPanel
    y: Qt.inputMethod.visible ? parent.height - keyboardPanel.height : parent.height
    anchors.left: parent.left
    anchors.right: parent.right
    Component.onCompleted: {
        console.log("locales available: " + VirtualKeyboardSettings.availableLocales)
        console.log("Locale before changing it: " + VirtualKeyboardSettings.locale)
        VirtualKeyboardSettings.locale = "fi_FI";
        console.log("Locale after changing it: " + VirtualKeyboardSettings.locale)
    }
}

And the result is to run this code (the keyboard layout has not changed):

qml: locales available: 
qml: Locale before changing it: 
qml: Locale after changing it: fi_FI

I could use a custom layout, but I didn’t understand how you can go to a custom layout ....

Any help would be greatly appreciated.

+4
source share
1 answer
+3

Source: https://habr.com/ru/post/1660287/


All Articles