Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. QLocale Keyboard Input set Language
Forum Updated to NodeBB v4.3 + New Features

QLocale Keyboard Input set Language

Scheduled Pinned Locked Moved Solved Mobile and Embedded
4 Posts 2 Posters 4.1k Views 2 Watching
  • 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.
  • michaelLM Offline
    michaelLM Offline
    michaelL
    wrote on last edited by
    #1

    Hi,

    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.

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      You can use the QGuiApplication::inputMethod function to retrieve the current input method.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      1
      • michaelLM Offline
        michaelLM Offline
        michaelL
        wrote on last edited by
        #3

        @SGaist
        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:

        QLocale::Language(German)
        QLocale::Language(C)

        C is the inputMethod QLocale and i cannot change this to other languages.
        Any idea?

        Is the only way to change the input keyboard language with the QEglFSFunctions::loadKeymap(".qmap")
        function on linux?

        1 Reply Last reply
        0
        • michaelLM Offline
          michaelLM Offline
          michaelL
          wrote on last edited by
          #4

          Hi,

          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
          Than do:
          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.

          1 Reply Last reply
          2

          • Login

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