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.0k 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.
  • raven-worxR raven-worx

    @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.

    IMAN4KI Offline
    IMAN4KI Offline
    IMAN4K
    wrote on last edited by IMAN4K
    #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

    raven-worxR 1 Reply Last reply
    0
    • IMAN4KI IMAN4K

      @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

      raven-worxR Offline
      raven-worxR Offline
      raven-worx
      Moderators
      wrote on 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

      IMAN4KI 2 Replies Last reply
      2
      • raven-worxR raven-worx

        @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?

        IMAN4KI Offline
        IMAN4KI Offline
        IMAN4K
        wrote on 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
        • raven-worxR raven-worx

          @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?

          IMAN4KI Offline
          IMAN4KI Offline
          IMAN4K
          wrote on last edited by IMAN4K
          #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
          
          raven-worxR 1 Reply Last reply
          0
          • IMAN4KI Offline
            IMAN4KI Offline
            IMAN4K
            wrote on last edited by
            #12

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

            1 Reply Last reply
            0
            • IMAN4KI IMAN4K

              @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
              
              raven-worxR Offline
              raven-worxR Offline
              raven-worx
              Moderators
              wrote on last edited by raven-worx
              #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

              IMAN4KI 1 Reply Last reply
              1
              • raven-worxR raven-worx

                @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?

                IMAN4KI Offline
                IMAN4KI Offline
                IMAN4K
                wrote on 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 :(

                raven-worxR 1 Reply Last reply
                0
                • IMAN4KI IMAN4K

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

                  raven-worxR Offline
                  raven-worxR Offline
                  raven-worx
                  Moderators
                  wrote on 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

                  IMAN4KI 1 Reply Last reply
                  1
                  • raven-worxR raven-worx

                    @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?

                    IMAN4KI Offline
                    IMAN4KI Offline
                    IMAN4K
                    wrote on last edited by IMAN4K
                    #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 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