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. Need help to code VirtualKeyboard using QQuickWidget on Widget-based app
Forum Updated to NodeBB v4.3 + New Features

Need help to code VirtualKeyboard using QQuickWidget on Widget-based app

Scheduled Pinned Locked Moved Solved Mobile and Embedded
17 Posts 4 Posters 3.1k Views 3 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.
  • R raven-worx
    4 Sept 2019, 14:37

    @iman4k said in Need help to code VirtualKeyboard using QQuickWidget on Widget-based app:

    And having windowed applications, we're able to use VK in form of Desktop Integration Method?

    yes, if you want to use it with QtWidgets.
    An InputPanel QML element can also show a virtualkeyboard using EGLFS.

    I Offline
    I Offline
    IMAN4K
    wrote on 4 Sept 2019, 15:21 last edited by IMAN4K 9 Apr 2019, 15:25
    #8

    @raven-worx said

    yes, if you want to use it with QtWidgets.
    An InputPanel QML element can also show a virtualkeyboard using EGLFS.

    So far so good!
    I have managed to cross compile Qt v5.12.3 on Raspbian stretch@Raspberry Pi3B+ without EGLFS and with EGL on X11 and all Virtual Keyboard plugins are deployed correctly based on Deployment Guide BUT VK won't run and if we set QT_DEBUG_PLUGINS to true only $$[QT_INSTALL_PLUGINS]/platforminputcontexts/libqtvirtualkeyboardplugin.so is loaded(full log).
    So do you have any clue about what's wrong?
    Regards.

    Hope to get to a solution on this topic for anyone else

    R 1 Reply Last reply 4 Sept 2019, 19:26
    0
    • I IMAN4K
      4 Sept 2019, 15:21

      @raven-worx said

      yes, if you want to use it with QtWidgets.
      An InputPanel QML element can also show a virtualkeyboard using EGLFS.

      So far so good!
      I have managed to cross compile Qt v5.12.3 on Raspbian stretch@Raspberry Pi3B+ without EGLFS and with EGL on X11 and all Virtual Keyboard plugins are deployed correctly based on Deployment Guide BUT VK won't run and if we set QT_DEBUG_PLUGINS to true only $$[QT_INSTALL_PLUGINS]/platforminputcontexts/libqtvirtualkeyboardplugin.so is loaded(full log).
      So do you have any clue about what's wrong?
      Regards.

      Hope to get to a solution on this topic for anyone else

      R Offline
      R Offline
      raven-worx
      Moderators
      wrote on 4 Sept 2019, 19:26 last edited by
      #9

      @iman4k
      did you set QT_IM_MODULE=qtvirtualkeyboard env variable?
      How do you start your application? With what parameters and or platform plugin?
      Do you see your application in your X11 display?

      --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
      If you have a question please use the forum so others can benefit from the solution in the future

      I 2 Replies Last reply 4 Sept 2019, 20:26
      2
      • R raven-worx
        4 Sept 2019, 19:26

        @iman4k
        did you set QT_IM_MODULE=qtvirtualkeyboard env variable?
        How do you start your application? With what parameters and or platform plugin?
        Do you see your application in your X11 display?

        I Offline
        I Offline
        IMAN4K
        wrote on 4 Sept 2019, 20:26 last edited by
        #10

        @raven-worx said in Need help to code VirtualKeyboard using QQuickWidget on Widget-based app:

        @iman4k
        did you set QT_IM_MODULE=qtvirtualkeyboard env variable?
        How do you start your application? With what parameters and or platform plugin?
        Do you see your application in your X11 display?

        • Yes, before QApplication creation in the main function:
          • qputenv("QT_IM_MODULE", QByteArray("qtvirtualkeyboard"));
        • ./<my-app> -platform xcb
        • Not sure about seeing application on X11 display but yes my app running normally(windowed) just like the desktop-x86 one.
        1 Reply Last reply
        0
        • R raven-worx
          4 Sept 2019, 19:26

          @iman4k
          did you set QT_IM_MODULE=qtvirtualkeyboard env variable?
          How do you start your application? With what parameters and or platform plugin?
          Do you see your application in your X11 display?

          I Offline
          I Offline
          IMAN4K
          wrote on 5 Sept 2019, 06:10 last edited by IMAN4K 9 May 2019, 08:40
          #11

          @raven-worx

          Also for more debugging when I set qputenv("QT_LOGGING_RULES", QByteArray("qt.virtualkeyboard=true"));, the VK's logs
          for raspberry is like this :

          qt.virtualkeyboard: Loading extension "japanese"
          qt.virtualkeyboard: Loading extension "traditional_chinese"
          qt.virtualkeyboard: Loading extension "pinyin"
          qt.virtualkeyboard: Loading extension "thai"
          qt.virtualkeyboard: Loading extension "hangul"
          qt.virtualkeyboard: PlatformInputContext::setFocusObject(): QLineEdit(0x7ec96790)
          qt.virtualkeyboard: PlatformInputContext::update(): QFlags<Qt::InputMethodQuery>(ImQueryAll)
          qt.virtualkeyboard: PlatformInputContext::update(): QFlags<Qt::InputMethodQuery>(ImInputItemClipRectangle)
          qt.virtualkeyboard: PlatformInputContext::setFocusObject(): QLineEdit(0x7ec96790)
          qt.virtualkeyboard: PlatformInputContext::update(): QFlags<Qt::InputMethodQuery>(ImQueryAll)
          qt.virtualkeyboard: PlatformInputContext::update(): QFlags<Qt::InputMethodQuery>(ImQueryAll)
          qt.virtualkeyboard: PlatformInputContext::update(): QFlags<Qt::InputMethodQuery>(ImQueryAll)
          qt.virtualkeyboard: PlatformInputContext::update(): QFlags<Qt::InputMethodQuery>(ImQueryAll)
          qt.virtualkeyboard: PlatformInputContext::showInputPanel()
          qt.virtualkeyboard: PlatformInputContext::commit()
          qt.virtualkeyboard: PlatformInputContext::commit()
          qt.virtualkeyboard: PlatformInputContext::hideInputPanel()
          qt.virtualkeyboard: PlatformInputContext::setFocusObject(): QObject(0x0)
          qt.virtualkeyboard: PlatformInputContext::update(): QFlags<Qt::InputMethodQuery>(ImQueryAll)
          

          So showInputPanel() is called but actually is not shown! and couldn't find the reason.
          And these logs are for running on Desktop:

          qt.virtualkeyboard: PlatformInputContext::update(): QFlags<Qt::InputMethodQuery>(ImInputItemClipRectangle)
          qt.virtualkeyboard: PlatformInputContext::setFocusObject(): QLineEdit(0x7ffe8952fa60)
          qt.virtualkeyboard: PlatformInputContext::update(): QFlags<Qt::InputMethodQuery>(ImQueryAll)
          qt.virtualkeyboard: InputContext::setFocus(): true
          qt.virtualkeyboard: PlatformInputContext::setFocusObject(): QLineEdit(0x7ffe8952fa60)
          qt.virtualkeyboard: PlatformInputContext::update(): QFlags<Qt::InputMethodQuery>(ImQueryAll)
          qt.virtualkeyboard: InputContext::setLocale(): "en_GB"
          qt.virtualkeyboard: PlatformInputContext::setLocale(): QLocale(English, Latin, UnitedKingdom)
          qt.virtualkeyboard: InputEngine::setInputMethod(): QtVirtualKeyboard::PlainInputMethod(0x1110b60)
          qt.virtualkeyboard: InputEngine::setInputMode(): 0
          qt.virtualkeyboard: PlatformInputContext::update(): QFlags<Qt::InputMethodQuery>(ImQueryAll)
          qt.virtualkeyboard: PlatformInputContext::showInputPanel()
          qt.virtualkeyboard: DesktopInputPanel::repositionView(): QRect(55,24 1865x1056)
          qt.virtualkeyboard: PlatformInputContext::hideInputPanel()
          qt.virtualkeyboard: PlatformInputContext::commit()
          qt.virtualkeyboard: PlatformInputContext::commit()
          qt.virtualkeyboard: PlatformInputContext::setFocusObject(): QObject(0x0)
          qt.virtualkeyboard: PlatformInputContext::update(): QFlags<Qt::InputMethodQuery>(ImQueryAll)
          qt.virtualkeyboard: InputContext::setFocus(): false
          qt.virtualkeyboard: PlatformInputContext::update(): QFlags<Qt::InputMethodQuery>(ImInputItemClipRectangle)
          qt.virtualkeyboard: PlatformInputContext::setFocusObject(): QLineEdit(0x7ffe8952fa60)
          qt.virtualkeyboard: PlatformInputContext::update(): QFlags<Qt::InputMethodQuery>(ImQueryAll)
          qt.virtualkeyboard: InputContext::setFocus(): true
          qt.virtualkeyboard: PlatformInputContext::setFocusObject(): QLineEdit(0x7ffe8952fa60)
          qt.virtualkeyboard: PlatformInputContext::update(): QFlags<Qt::InputMethodQuery>(ImQueryAll)
          qt.virtualkeyboard: PlatformInputContext::commit()
          qt.virtualkeyboard: PlatformInputContext::commit()
          qt.virtualkeyboard: InputContext::setFocus(): false
          
          R 1 Reply Last reply 9 Sept 2019, 11:54
          0
          • I Offline
            I Offline
            IMAN4K
            wrote on 7 Sept 2019, 05:44 last edited by
            #12

            @raven-worx
            Any idea or hint would be appreciated.
            Regards.

            1 Reply Last reply
            0
            • I IMAN4K
              5 Sept 2019, 06:10

              @raven-worx

              Also for more debugging when I set qputenv("QT_LOGGING_RULES", QByteArray("qt.virtualkeyboard=true"));, the VK's logs
              for raspberry is like this :

              qt.virtualkeyboard: Loading extension "japanese"
              qt.virtualkeyboard: Loading extension "traditional_chinese"
              qt.virtualkeyboard: Loading extension "pinyin"
              qt.virtualkeyboard: Loading extension "thai"
              qt.virtualkeyboard: Loading extension "hangul"
              qt.virtualkeyboard: PlatformInputContext::setFocusObject(): QLineEdit(0x7ec96790)
              qt.virtualkeyboard: PlatformInputContext::update(): QFlags<Qt::InputMethodQuery>(ImQueryAll)
              qt.virtualkeyboard: PlatformInputContext::update(): QFlags<Qt::InputMethodQuery>(ImInputItemClipRectangle)
              qt.virtualkeyboard: PlatformInputContext::setFocusObject(): QLineEdit(0x7ec96790)
              qt.virtualkeyboard: PlatformInputContext::update(): QFlags<Qt::InputMethodQuery>(ImQueryAll)
              qt.virtualkeyboard: PlatformInputContext::update(): QFlags<Qt::InputMethodQuery>(ImQueryAll)
              qt.virtualkeyboard: PlatformInputContext::update(): QFlags<Qt::InputMethodQuery>(ImQueryAll)
              qt.virtualkeyboard: PlatformInputContext::update(): QFlags<Qt::InputMethodQuery>(ImQueryAll)
              qt.virtualkeyboard: PlatformInputContext::showInputPanel()
              qt.virtualkeyboard: PlatformInputContext::commit()
              qt.virtualkeyboard: PlatformInputContext::commit()
              qt.virtualkeyboard: PlatformInputContext::hideInputPanel()
              qt.virtualkeyboard: PlatformInputContext::setFocusObject(): QObject(0x0)
              qt.virtualkeyboard: PlatformInputContext::update(): QFlags<Qt::InputMethodQuery>(ImQueryAll)
              

              So showInputPanel() is called but actually is not shown! and couldn't find the reason.
              And these logs are for running on Desktop:

              qt.virtualkeyboard: PlatformInputContext::update(): QFlags<Qt::InputMethodQuery>(ImInputItemClipRectangle)
              qt.virtualkeyboard: PlatformInputContext::setFocusObject(): QLineEdit(0x7ffe8952fa60)
              qt.virtualkeyboard: PlatformInputContext::update(): QFlags<Qt::InputMethodQuery>(ImQueryAll)
              qt.virtualkeyboard: InputContext::setFocus(): true
              qt.virtualkeyboard: PlatformInputContext::setFocusObject(): QLineEdit(0x7ffe8952fa60)
              qt.virtualkeyboard: PlatformInputContext::update(): QFlags<Qt::InputMethodQuery>(ImQueryAll)
              qt.virtualkeyboard: InputContext::setLocale(): "en_GB"
              qt.virtualkeyboard: PlatformInputContext::setLocale(): QLocale(English, Latin, UnitedKingdom)
              qt.virtualkeyboard: InputEngine::setInputMethod(): QtVirtualKeyboard::PlainInputMethod(0x1110b60)
              qt.virtualkeyboard: InputEngine::setInputMode(): 0
              qt.virtualkeyboard: PlatformInputContext::update(): QFlags<Qt::InputMethodQuery>(ImQueryAll)
              qt.virtualkeyboard: PlatformInputContext::showInputPanel()
              qt.virtualkeyboard: DesktopInputPanel::repositionView(): QRect(55,24 1865x1056)
              qt.virtualkeyboard: PlatformInputContext::hideInputPanel()
              qt.virtualkeyboard: PlatformInputContext::commit()
              qt.virtualkeyboard: PlatformInputContext::commit()
              qt.virtualkeyboard: PlatformInputContext::setFocusObject(): QObject(0x0)
              qt.virtualkeyboard: PlatformInputContext::update(): QFlags<Qt::InputMethodQuery>(ImQueryAll)
              qt.virtualkeyboard: InputContext::setFocus(): false
              qt.virtualkeyboard: PlatformInputContext::update(): QFlags<Qt::InputMethodQuery>(ImInputItemClipRectangle)
              qt.virtualkeyboard: PlatformInputContext::setFocusObject(): QLineEdit(0x7ffe8952fa60)
              qt.virtualkeyboard: PlatformInputContext::update(): QFlags<Qt::InputMethodQuery>(ImQueryAll)
              qt.virtualkeyboard: InputContext::setFocus(): true
              qt.virtualkeyboard: PlatformInputContext::setFocusObject(): QLineEdit(0x7ffe8952fa60)
              qt.virtualkeyboard: PlatformInputContext::update(): QFlags<Qt::InputMethodQuery>(ImQueryAll)
              qt.virtualkeyboard: PlatformInputContext::commit()
              qt.virtualkeyboard: PlatformInputContext::commit()
              qt.virtualkeyboard: InputContext::setFocus(): false
              
              R Offline
              R Offline
              raven-worx
              Moderators
              wrote on 9 Sept 2019, 11:54 last edited by raven-worx 9 Sept 2019, 11:57
              #13

              @iman4k
              seems you somehow loosing input-focus in your non-working case?
              are you running the exact same application on desktop and on your pi?
              any other output in the console?

              --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
              If you have a question please use the forum so others can benefit from the solution in the future

              I 1 Reply Last reply 9 Sept 2019, 17:01
              1
              • R raven-worx
                9 Sept 2019, 11:54

                @iman4k
                seems you somehow loosing input-focus in your non-working case?
                are you running the exact same application on desktop and on your pi?
                any other output in the console?

                I Offline
                I Offline
                IMAN4K
                wrote on 9 Sept 2019, 17:01 last edited by
                #14

                @raven-worx said in Need help to code VirtualKeyboard using QQuickWidget on Widget-based app:

                @iman4k
                seems you somehow loosing input-focus in your non-working case?
                are you running the exact same application on desktop and on your pi?
                any other output in the console?

                • No, input focus is just fine and the lineedit will get focus as expected(the last 3 line of logs in the non-working case is because I clicked on the outside of widget area at the end)
                • Yes, the exact same application is running on Desktop and also on Embedded(raspberry) kit
                • Nothing more than those logs I mentioned!

                This is somehow strange, it took 1 week struggling on this :(

                R 1 Reply Last reply 9 Sept 2019, 18:12
                0
                • I IMAN4K
                  9 Sept 2019, 17:01

                  @raven-worx said in Need help to code VirtualKeyboard using QQuickWidget on Widget-based app:

                  @iman4k
                  seems you somehow loosing input-focus in your non-working case?
                  are you running the exact same application on desktop and on your pi?
                  any other output in the console?

                  • No, input focus is just fine and the lineedit will get focus as expected(the last 3 line of logs in the non-working case is because I clicked on the outside of widget area at the end)
                  • Yes, the exact same application is running on Desktop and also on Embedded(raspberry) kit
                  • Nothing more than those logs I mentioned!

                  This is somehow strange, it took 1 week struggling on this :(

                  R Offline
                  R Offline
                  raven-worx
                  Moderators
                  wrote on 9 Sept 2019, 18:12 last edited by
                  #15

                  @iman4k
                  then i guess either something in your application or your used Qt installation.
                  Just to amke sure: I assume - becasue of the log output - the qtvirtualkeyboard plugin is available on your Pi?
                  are you also using QML in your application or is it a pure QtWidget application?

                  --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
                  If you have a question please use the forum so others can benefit from the solution in the future

                  I 1 Reply Last reply 11 Sept 2019, 09:01
                  1
                  • R raven-worx
                    9 Sept 2019, 18:12

                    @iman4k
                    then i guess either something in your application or your used Qt installation.
                    Just to amke sure: I assume - becasue of the log output - the qtvirtualkeyboard plugin is available on your Pi?
                    are you also using QML in your application or is it a pure QtWidget application?

                    I Offline
                    I Offline
                    IMAN4K
                    wrote on 11 Sept 2019, 09:01 last edited by IMAN4K 9 Nov 2019, 09:10
                    #16

                    @raven-worx said in Need help to code VirtualKeyboard using QQuickWidget on Widget-based app:

                    @iman4k
                    then i guess either something in your application or your used Qt installation.
                    Just to amke sure: I assume - becasue of the log output - the qtvirtualkeyboard plugin is available on your Pi?
                    are you also using QML in your application or is it a pure QtWidget application?

                    • Yes, these are deployed on the pi side in install step of cross-compile:

                      • /usr/local/qt5pi/plugins/platforminputcontexts/libqtvirtualkeyboardplugin.so
                      • /usr/local/qt5pi/qml/QtQuick/VirtualKeyboard/libqtquickvirtualkeyboardplugin.so
                      • /usr/local/qt5pi/qml/QtQuick/Layouts/libqquicklayoutsplugin.so
                      • /usr/local/qt5pi/lib/libQt5VirtualKeyboard.so

                      So I assume the plugin is available.

                    • It's a simple QtWidgets application:

                    #include <QtWidgets>
                    
                    int main(int argc, char *argv[]) {
                        qputenv("QT_IM_MODULE", QByteArray("qtvirtualkeyboard"));
                        qputenv("QT_LOGGING_RULES", QByteArray("qt.virtualkeyboard=true"));
                        QApplication a(argc, argv);
                        QMainWindow w;
                        QLineEdit edit(&w);
                        edit.move(50, 50);
                        w.show();
                        return a.exec();
                    }
                    

                    Is this problem related to Openbox WindowManager?
                    I'm also curious to know why DesktopInputPanel::repositionView(): QRect(55,24 1865x1056) is not called after PlatformInputContext::showInputPanel() in raspberry?

                    1 Reply Last reply
                    0
                    • M Offline
                      M Offline
                      MarKus12
                      wrote on 14 Feb 2025, 11:46 last edited by MarKus12
                      #17

                      @IMAN4K

                      Hi,
                      similar problem exists here.
                      Did you eventually found a solution for the problem, that you remember?

                      I run into it on a buildroot issue without desktop manager.
                      Currently I suspect a problem with the interpreting system input events by QApplication.
                      Seems that QGuiApplication does something different.

                      1 Reply Last reply
                      0

                      • Login

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