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
QtWS25 Last Chance

How to enable Virtual Keyboard Languages

Scheduled Pinned Locked Moved Solved QML and Qt Quick
15 Posts 5 Posters 11.4k 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.
  • A Offline
    A Offline
    Angel Popov
    wrote on 2 Mar 2017, 18:32 last edited by Angel Popov 3 Feb 2017, 18:34
    #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!

    S 1 Reply Last reply 17 Aug 2018, 06:44
    0
    • ? Offline
      ? Offline
      A Former User
      wrote on 2 Mar 2017, 21:51 last edited by
      #2

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

      1 Reply Last reply
      1
      • A Offline
        A Offline
        Angel Popov
        wrote on 3 Mar 2017, 06:41 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 3 Mar 2017, 18:07 last edited by A Former User 3 Mar 2017, 18:08
          #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
          • A Offline
            A Offline
            Angel Popov
            wrote on 3 Mar 2017, 18:23 last edited by Angel Popov 3 Mar 2017, 18:24
            #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
            • S Offline
              S Offline
              SGaist
              Lifetime Qt Champion
              wrote on 3 Mar 2017, 19:24 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
              • A Offline
                A Offline
                Angel Popov
                wrote on 10 Mar 2017, 19:43 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
                • S Offline
                  S Offline
                  SGaist
                  Lifetime Qt Champion
                  wrote on 10 Mar 2017, 22:13 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

                  A 1 Reply Last reply 11 Mar 2017, 13:12
                  0
                  • S SGaist
                    10 Mar 2017, 22:13

                    What configuration did you give when compiling the module ?

                    A Offline
                    A Offline
                    Angel Popov
                    wrote on 11 Mar 2017, 13:12 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
                    • S Offline
                      S Offline
                      SGaist
                      Lifetime Qt Champion
                      wrote on 12 Mar 2017, 20:19 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

                      A 1 Reply Last reply 13 Mar 2017, 16:26
                      2
                      • S SGaist
                        12 Mar 2017, 20:19

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

                        A Offline
                        A Offline
                        Angel Popov
                        wrote on 13 Mar 2017, 16:26 last edited by
                        #11

                        @SGaist

                        Thank you! It works!

                        1 Reply Last reply
                        1
                        • michaelLM Offline
                          michaelLM Offline
                          michaelL
                          wrote on 13 Apr 2017, 10:52 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
                          • S Offline
                            S Offline
                            SGaist
                            Lifetime Qt Champion
                            wrote on 13 Apr 2017, 11:25 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 18 Apr 2017, 08:52 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
                              • A Angel Popov
                                2 Mar 2017, 18:32

                                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!

                                S Offline
                                S Offline
                                small_bird
                                wrote on 17 Aug 2018, 06:44 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 30 Dec 2024, 15:37

                                • Login

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