Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Attempting to set default language with 'VirtualKeyboarSettings.local' property

Attempting to set default language with 'VirtualKeyboarSettings.local' property

Scheduled Pinned Locked Moved Solved General and Desktop
2 Posts 2 Posters 476 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    Circuits
    wrote on last edited by Circuits
    #1

    I am attempting to set the default language for the Qt Virtual Keyboard using the VirtualKeyboardSettings.local property, for instance:

    InputPanel{
                    id: virtualKeyboard
                    width: parent.width
                    anchors.centerIn: parent
                    visible: true
                    onActiveChanged: {
                        if(activeFocus){
                            switch(langIndex){
                            case 0:
                                VirtualKeyboardSettings.local = "en_US"
                                break;
                            case 1:
                                VirtualKeyboardSettings.local = ///Here I want Espanol
                                break;
                            case 2:
                                VirtualKeyboardSettings.local = ///Here I want Francais
                                break;
                            case 3:
                                VirtualKeyboardSettings.local = ///Here I want Polish
                                break;
                            }
                        }
                    }
                }
    

    In the layouts directory I see that each language is given an abbreviation: ar_AR, bg_BG, cs_CZ etc... however, I am not sure what languages those abbreviations refer too. Is there a document somewhere that can tell me which is which?

    I tried printing the list of availableLocales to the console:

    console.log(VirtualKeyboardSettings.availableLocales)
    

    but this just prints an empty list. However, the keyboard itself has all the of different locals available for me to switch between so I am not sure how it could be empty. In general, this doesn't seem to be working. Is this not how you use the .local property or is there some switch I need to enable before I can use the .local property that I am not aware of?

    K 1 Reply Last reply
    0
    • C Circuits

      I am attempting to set the default language for the Qt Virtual Keyboard using the VirtualKeyboardSettings.local property, for instance:

      InputPanel{
                      id: virtualKeyboard
                      width: parent.width
                      anchors.centerIn: parent
                      visible: true
                      onActiveChanged: {
                          if(activeFocus){
                              switch(langIndex){
                              case 0:
                                  VirtualKeyboardSettings.local = "en_US"
                                  break;
                              case 1:
                                  VirtualKeyboardSettings.local = ///Here I want Espanol
                                  break;
                              case 2:
                                  VirtualKeyboardSettings.local = ///Here I want Francais
                                  break;
                              case 3:
                                  VirtualKeyboardSettings.local = ///Here I want Polish
                                  break;
                              }
                          }
                      }
                  }
      

      In the layouts directory I see that each language is given an abbreviation: ar_AR, bg_BG, cs_CZ etc... however, I am not sure what languages those abbreviations refer too. Is there a document somewhere that can tell me which is which?

      I tried printing the list of availableLocales to the console:

      console.log(VirtualKeyboardSettings.availableLocales)
      

      but this just prints an empty list. However, the keyboard itself has all the of different locals available for me to switch between so I am not sure how it could be empty. In general, this doesn't seem to be working. Is this not how you use the .local property or is there some switch I need to enable before I can use the .local property that I am not aware of?

      K Offline
      K Offline
      koahnig
      wrote on last edited by
      #2

      @circuits

      Probably those https://doc.qt.io/qt-5/qtvirtualkeyboard-layouts.html#english-american-layout

      Vote the answer(s) that helped you to solve your issue(s)

      1 Reply Last reply
      1

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved