Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Call for Presentations - Qt World Summit

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

    Mobile and Embedded
    3
    16
    1463
    Loading More Posts
    • 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-worx
      raven-worx Moderators @IMAN4K last edited by

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

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

      IMAN4K 1 Reply Last reply Reply Quote 2
      • IMAN4K
        IMAN4K @raven-worx last edited by 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-worx 1 Reply Last reply Reply Quote 0
        • raven-worx
          raven-worx Moderators @IMAN4K last edited by

          @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

          IMAN4K 2 Replies Last reply Reply Quote 2
          • IMAN4K
            IMAN4K @raven-worx last edited by

            @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 Reply Quote 0
            • IMAN4K
              IMAN4K @raven-worx last edited by 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-worx 1 Reply Last reply Reply Quote 0
              • IMAN4K
                IMAN4K last edited by

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

                1 Reply Last reply Reply Quote 0
                • raven-worx
                  raven-worx Moderators @IMAN4K last edited by 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?

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

                  IMAN4K 1 Reply Last reply Reply Quote 1
                  • IMAN4K
                    IMAN4K @raven-worx last edited by

                    @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-worx 1 Reply Last reply Reply Quote 0
                    • raven-worx
                      raven-worx Moderators @IMAN4K last edited by

                      @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

                      IMAN4K 1 Reply Last reply Reply Quote 1
                      • IMAN4K
                        IMAN4K @raven-worx last edited by IMAN4K

                        @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 Reply Quote 0
                        • First post
                          Last post