Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. How to enable Virtual Keyboard Languages
Forum Updated to NodeBB v4.3 + New Features

How to enable Virtual Keyboard Languages

Scheduled Pinned Locked Moved Solved QML and Qt Quick
15 Posts 5 Posters 11.5k 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.
  • Angel PopovA Offline
    Angel PopovA Offline
    Angel Popov
    wrote on last edited by Angel Popov
    #1

    Hello,

    I'm using c++ and qt quick to develop my app and it runs on raspberry pi. I have a qml file called KeyboardPanel.qml and it has the following:

    import QtQuick 2.7
    import QtQuick.VirtualKeyboard 2.1
    import QtQuick.VirtualKeyboard.Settings 2.0
    
    InputPanel {
    
        id: inputPanel
        Component.onCompleted:{
            VirtualKeyboardSettings.styleName = "retro"
            console.log("locales available: " + VirtualKeyboardSettings.availableLocales)
            console.log("Locale before changing it: " + VirtualKeyboardSettings.locale)
            VirtualKeyboardSettings.locale = "ru_RU";
            console.log("Locale after changing it: " + VirtualKeyboardSettings.locale)
            VirtualKeyboardSettings.customLayoutsOnly = true
        }
    
        y: 5000
        x: 5000
        height: 600
        width: 800
        states: State {
            name: "visible"
            when: inputPanel.active
            PropertyChanges {
                target: inputPanel
                y: 450
                x: 550
            }
        }
        transitions: Transition {
            from: ""
            to: "visible"
            reversible: true
            ParallelAnimation {
                NumberAnimation {
                    properties: "y"
                    duration: 500
                    easing.type: Easing.InOutQuad
                }
            }
        }
    }
    
    

    The keyboard shows up and works fine on text fields, but I cannot add additional languages.

    Thanks in advance!

    small_birdS 1 Reply Last reply
    0
    • ? Offline
      ? Offline
      A Former User
      wrote on last edited by
      #2

      Hi! Did you check that availableLocales : list<string> contains the locales you need?

      1 Reply Last reply
      1
      • Angel PopovA Offline
        Angel PopovA Offline
        Angel Popov
        wrote on last edited by
        #3

        Yes I do check it like

        console.log("locales available: " + VirtualKeyboardSettings.availableLocales)
        

        It is empty.

        1 Reply Last reply
        0
        • ? Offline
          ? Offline
          A Former User
          wrote on last edited by A Former User
          #4

          The documentation (http://doc.qt.io/qt-5/qml-qtquick-virtualkeyboard-settings-virtualkeyboardsettings.html#locale-prop) says:

          locale : string
          (...)
          If the locale setting is incorrect, or it is not in the list of supported locales, it is ignored and the default setting is used instead.

          A locale is supported if it is included in the list of availableLocales.

          And in http://doc.qt.io/qt-5/qml-qtquick-virtualkeyboard-settings-virtualkeyboardsettings.html#availableLocales-prop it says:

          availableLocales : list<string>
          (...)
          This list is read-only and depends on the build-time configuration of the virtual keyboard.

          So I'd conclude that you have to rebuild VirtualKeyboard with different configuration.

          1 Reply Last reply
          1
          • Angel PopovA Offline
            Angel PopovA Offline
            Angel Popov
            wrote on last edited by Angel Popov
            #5

            I build qt 5.8 on raspberry like:

            ./configure -v -opengl es2 -qt-freetype -device linux-rasp-pi-g''+ -device-option CROSS_COMPILE=/usr/bin/ -optimized-qmake -reduce-exports -release -qt-pcre -qt-libpng -make libs -prefix /usr/local/qt5

            How can I rebuild only virtualkeyboard module?
            Can I do the same on windows?

            Thanks

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

              Hi,

              You don't need to rebuild the whole Qt.
              Get the module sources and then use the classic qmake/make/make install.

              Take the time to checkout if there's any option you can passe to get more locale supported.

              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
              • Angel PopovA Offline
                Angel PopovA Offline
                Angel Popov
                wrote on last edited by
                #7

                I have tried to compile the module. Then I compiled the whole Qt and still cannot get it working

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

                  What configuration did you give when compiling the module ?

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

                  Angel PopovA 1 Reply Last reply
                  0
                  • SGaistS SGaist

                    What configuration did you give when compiling the module ?

                    Angel PopovA Offline
                    Angel PopovA Offline
                    Angel Popov
                    wrote on last edited by
                    #9

                    @SGaist

                    I just copy the source from git repository.

                    1. qmake qtvirtualkeyboard.pro
                    2. make
                    3. make install
                    1 Reply Last reply
                    0
                    • SGaistS Offline
                      SGaistS Offline
                      SGaist
                      Lifetime Qt Champion
                      wrote on last edited by
                      #10

                      Try with qmake "CONFIG+=lang-all".

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

                      Angel PopovA 1 Reply Last reply
                      2
                      • SGaistS SGaist

                        Try with qmake "CONFIG+=lang-all".

                        Angel PopovA Offline
                        Angel PopovA Offline
                        Angel Popov
                        wrote on last edited by
                        #11

                        @SGaist

                        Thank you! It works!

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

                          Hi when i do make i get this errors:

                          cd virtualkeyboard/ && ( test -e Makefile || /usr/lib/x86_64-linux-gnu/qt5/bin/qmake /home/devel/Qt5.7.1/5.7/Src/qtvirtualkeyboard/src/virtualkeyboard/virtualkeyboard.pro -o Makefile ) && make -f Makefile
                          make[2]: Entering directory '/home/devel/Qt5.7.1/5.7/Src/qtvirtualkeyboard/src/virtualkeyboard'
                          g++ -c -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -O2 -fvisibility=hidden -fvisibility-inlines-hidden -std=c++0x -fno-exceptions -Wall -W -D_REENTRANT -fPIC -DQT_VIRTUALKEYBOARD_DEFAULT_STYLE="default" -DQT_VIRTUALKEYBOARD_DESKTOP -DQT_VIRTUALKEYBOARD_HAVE_XCB -DQT_NO_EXCEPTIONS -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -DQT_NO_DEBUG -DQT_PLUGIN -DQT_QUICK_LIB -DQT_QML_LIB -DQT_NETWORK_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I/usr/lib/x86_64-linux-gnu/qt5/mkspecs/linux-g++-64 -I. -isystem /usr/include/x86_64-linux-gnu/qt5 -isystem /usr/include/x86_64-linux-gnu/qt5/QtQuick -isystem /usr/include/x86_64-linux-gnu/qt5/QtQml -isystem /usr/include/x86_64-linux-gnu/qt5/QtGui/5.3.2 -isystem /usr/include/x86_64-linux-gnu/qt5/QtGui/5.3.2/QtGui -isystem /usr/include/x86_64-linux-gnu/qt5/QtCore/5.3.2 -isystem /usr/include/x86_64-linux-gnu/qt5/QtCore/5.3.2/QtCore -isystem /usr/include/x86_64-linux-gnu/qt5/QtNetwork -isystem /usr/include/x86_64-linux-gnu/qt5/QtGui -isystem /usr/include/x86_64-linux-gnu/qt5/QtCore -I.moc -o .obj/inputcontext.o inputcontext.cpp
                          inputcontext.cpp: In member function ‘void QtVirtualKeyboard::InputContext::setSelectionOnFocusObject(const QPointF&, const QPointF&)’:
                          inputcontext.cpp:566:5: error: ‘setSelectionOnFocusObject’ is not a member of ‘QPlatformInputContext’
                          QPlatformInputContext::setSelectionOnFocusObject(anchorPos, cursorPos);
                          ^
                          inputcontext.cpp: In member function ‘void QtVirtualKeyboard::InputContext::update(Qt::InputMethodQueries)’:
                          inputcontext.cpp:669:66: error: ‘ImInputItemClipRectangle’ is not a member of ‘Qt’
                          QRectF inputItemClipRect = d->inputContext->inputMethodQuery(Qt::ImInputItemClipRectangle).toRectF();
                          ^
                          inputcontext.cpp:670:59: error: ‘ImAnchorRectangle’ is not a member of ‘Qt’
                          QRectF anchorRect = d->inputContext->inputMethodQuery(Qt::ImAnchorRectangle).toRectF();
                          ^
                          inputcontext.cpp:671:59: error: ‘ImAnchorRectangle’ is not a member of ‘Qt’
                          QRectF cursorRect = d->inputContext->inputMethodQuery(Qt::ImAnchorRectangle).toRectF();
                          ^
                          Makefile:641: recipe for target '.obj/inputcontext.o' failed
                          make[2]: *** [.obj/inputcontext.o] Error 1
                          make[2]: Leaving directory '/home/devel/Qt5.7.1/5.7/Src/qtvirtualkeyboard/src/virtualkeyboard'
                          Makefile:40: recipe for target 'sub-virtualkeyboard-make_first' failed
                          make[1]: *** [sub-virtualkeyboard-make_first] Error 2
                          make[1]: Leaving directory '/home/devel/Qt5.7.1/5.7/Src/qtvirtualkeyboard/src'
                          Makefile:40: recipe for target 'sub-src-make_first' failed
                          make: *** [sub-src-make_first] Error 2

                          Any idea?

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

                            Hi,

                            You are trying to build the module that is provided with Qt 5.7.1 with the Qt version installed by your distribution which is 5.3.2. Use the full path to your 5.7.1 qmake when building the module.

                            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
                            0
                            • michaelLM Offline
                              michaelLM Offline
                              michaelL
                              wrote on last edited by
                              #14

                              I worked for me now too.
                              I did it in Qt Creator. Open the project and:
                              -In "Build Step" qmake, add in additional arguments: CONFIG+=lang-all
                              -Add Build Step "make" with argumant "install"

                              1 Reply Last reply
                              0
                              • Angel PopovA Angel Popov

                                Hello,

                                I'm using c++ and qt quick to develop my app and it runs on raspberry pi. I have a qml file called KeyboardPanel.qml and it has the following:

                                import QtQuick 2.7
                                import QtQuick.VirtualKeyboard 2.1
                                import QtQuick.VirtualKeyboard.Settings 2.0
                                
                                InputPanel {
                                
                                    id: inputPanel
                                    Component.onCompleted:{
                                        VirtualKeyboardSettings.styleName = "retro"
                                        console.log("locales available: " + VirtualKeyboardSettings.availableLocales)
                                        console.log("Locale before changing it: " + VirtualKeyboardSettings.locale)
                                        VirtualKeyboardSettings.locale = "ru_RU";
                                        console.log("Locale after changing it: " + VirtualKeyboardSettings.locale)
                                        VirtualKeyboardSettings.customLayoutsOnly = true
                                    }
                                
                                    y: 5000
                                    x: 5000
                                    height: 600
                                    width: 800
                                    states: State {
                                        name: "visible"
                                        when: inputPanel.active
                                        PropertyChanges {
                                            target: inputPanel
                                            y: 450
                                            x: 550
                                        }
                                    }
                                    transitions: Transition {
                                        from: ""
                                        to: "visible"
                                        reversible: true
                                        ParallelAnimation {
                                            NumberAnimation {
                                                properties: "y"
                                                duration: 500
                                                easing.type: Easing.InOutQuad
                                            }
                                        }
                                    }
                                }
                                
                                

                                The keyboard shows up and works fine on text fields, but I cannot add additional languages.

                                Thanks in advance!

                                small_birdS Offline
                                small_birdS Offline
                                small_bird
                                wrote on last edited by
                                #15

                                @Angel-Popov Hello, I try to change the height, however, it does not work.Could you please help me? Thanks in advance!

                                1 Reply Last reply
                                0
                                • Pl45m4P Pl45m4 referenced this topic on

                                • Login

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