Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. How to use virtual keyboard on Raspberry Pi 4
Forum Updated to NodeBB v4.3 + New Features

How to use virtual keyboard on Raspberry Pi 4

Scheduled Pinned Locked Moved Unsolved General and Desktop
25 Posts 4 Posters 4.8k 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.
  • I IknowQT
    17 Feb 2022, 08:06

    @JKSH

    I tried the example called basic.
    The virtual keyboard works normally.

    J Offline
    J Offline
    JKSH
    Moderators
    wrote on 17 Feb 2022, 13:02 last edited by
    #7

    @IknowQT said in How to use virtual keyboard on Raspberry Pi 4:

    I tried the example called basic.
    The virtual keyboard works normally.

    OK, that's good.

    Now, modify that example code: Convert the QGuiApplication into a QApplication, and then create + show a QTextEdit. What happens when you click on the QTextEdit? What happens when you click on one of the fields in the QQuickView?

    Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

    J 1 Reply Last reply 18 Feb 2022, 05:04
    0
    • S Offline
      S Offline
      sierdzio
      Moderators
      wrote on 17 Feb 2022, 16:52 last edited by
      #8

      Do you run your app with EGLFS plugin? It only supports single window IIRC, so the virtual keyboard can't get itself shown. Switch to X11 and it will show up, same as on Ubuntu.

      I may be totally wrong about it though :D

      (Z(:^

      I 1 Reply Last reply 17 Feb 2022, 22:48
      0
      • S sierdzio
        17 Feb 2022, 16:52

        Do you run your app with EGLFS plugin? It only supports single window IIRC, so the virtual keyboard can't get itself shown. Switch to X11 and it will show up, same as on Ubuntu.

        I may be totally wrong about it though :D

        I Offline
        I Offline
        IknowQT
        wrote on 17 Feb 2022, 22:48 last edited by IknowQT
        #9

        @sierdzio

        Is there a way to check whether it is eglfs or x11?
        I am not very good at Linux.

        ===============================================

        I tried the option to change the qt platform.
        export QT_QPA_PLATFORM="x11"

        qt.qpa.plugin: Could not find the Qt platform plugin "x11" in ""
        This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.
        
        Available platform plugins are: eglfs, linuxfb, minimal, minimalegl, offscreen, vnc, webgl, xcb.
        

        Do I need to install x11?
        Is there a command to find out which platform is currently set?

        J 1 Reply Last reply 18 Feb 2022, 03:28
        0
        • I IknowQT
          17 Feb 2022, 22:48

          @sierdzio

          Is there a way to check whether it is eglfs or x11?
          I am not very good at Linux.

          ===============================================

          I tried the option to change the qt platform.
          export QT_QPA_PLATFORM="x11"

          qt.qpa.plugin: Could not find the Qt platform plugin "x11" in ""
          This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.
          
          Available platform plugins are: eglfs, linuxfb, minimal, minimalegl, offscreen, vnc, webgl, xcb.
          

          Do I need to install x11?
          Is there a command to find out which platform is currently set?

          J Offline
          J Offline
          JKSH
          Moderators
          wrote on 18 Feb 2022, 03:28 last edited by
          #10

          @IknowQT said in How to use virtual keyboard on Raspberry Pi 4:

          Is there a way to check whether it is eglfs or x11?

          Your plugin debug output will show which platform plugin was loaded.

          I tried the option to change the qt platform.
          export QT_QPA_PLATFORM="x11"

          Use QT_QPA_PLATFORM="xcb"

          Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

          I 1 Reply Last reply 18 Feb 2022, 03:44
          1
          • J JKSH
            18 Feb 2022, 03:28

            @IknowQT said in How to use virtual keyboard on Raspberry Pi 4:

            Is there a way to check whether it is eglfs or x11?

            Your plugin debug output will show which platform plugin was loaded.

            I tried the option to change the qt platform.
            export QT_QPA_PLATFORM="x11"

            Use QT_QPA_PLATFORM="xcb"

            I Offline
            I Offline
            IknowQT
            wrote on 18 Feb 2022, 03:44 last edited by
            #11

            @JKSH

            I tried again after changing to xcb platform, but the virtual keyboard still does not work.

            1 Reply Last reply
            0
            • J JKSH
              17 Feb 2022, 13:02

              @IknowQT said in How to use virtual keyboard on Raspberry Pi 4:

              I tried the example called basic.
              The virtual keyboard works normally.

              OK, that's good.

              Now, modify that example code: Convert the QGuiApplication into a QApplication, and then create + show a QTextEdit. What happens when you click on the QTextEdit? What happens when you click on one of the fields in the QQuickView?

              J Offline
              J Offline
              JKSH
              Moderators
              wrote on 18 Feb 2022, 05:04 last edited by
              #12

              @IknowQT said in How to use virtual keyboard on Raspberry Pi 4:

              I tried again after changing to xcb platform, but the virtual keyboard still does not work.

              See my earlier post:

              Now, modify that example code: Convert the QGuiApplication into a QApplication, and then create + show a QTextEdit. What happens when you click on the QTextEdit? What happens when you click on one of the fields in the QQuickView?

              Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

              I 1 Reply Last reply 18 Feb 2022, 07:14
              0
              • J JKSH
                18 Feb 2022, 05:04

                @IknowQT said in How to use virtual keyboard on Raspberry Pi 4:

                I tried again after changing to xcb platform, but the virtual keyboard still does not work.

                See my earlier post:

                Now, modify that example code: Convert the QGuiApplication into a QApplication, and then create + show a QTextEdit. What happens when you click on the QTextEdit? What happens when you click on one of the fields in the QQuickView?

                I Offline
                I Offline
                IknowQT
                wrote on 18 Feb 2022, 07:14 last edited by
                #13

                @JKSH

                #include <QQuickView>
                #include <QGuiApplication>
                #include <QQmlEngine>
                #include <QtWidgets/QApplication>
                
                int main(int argc, char *argv[])
                {
                    qputenv("QT_IM_MODULE", QByteArray("qtvirtualkeyboard"));
                
                    QGuiApplication app(argc, argv);
                    QApplication n = qobject_cast<QApplication>(app);
                
                
                    QQuickView view(QString("qrc:/%2").arg(MAIN_QML));
                    if (view.status() == QQuickView::Error)
                        return -1;
                    view.setResizeMode(QQuickView::SizeRootObjectToView);
                    view.show();
                
                    return app.exec();
                }
                

                Are you talking about converting QGuiApplication to QApplication?
                An error occurs. >:

                jsulmJ 2 Replies Last reply 18 Feb 2022, 07:50
                0
                • I IknowQT
                  18 Feb 2022, 07:14

                  @JKSH

                  #include <QQuickView>
                  #include <QGuiApplication>
                  #include <QQmlEngine>
                  #include <QtWidgets/QApplication>
                  
                  int main(int argc, char *argv[])
                  {
                      qputenv("QT_IM_MODULE", QByteArray("qtvirtualkeyboard"));
                  
                      QGuiApplication app(argc, argv);
                      QApplication n = qobject_cast<QApplication>(app);
                  
                  
                      QQuickView view(QString("qrc:/%2").arg(MAIN_QML));
                      if (view.status() == QQuickView::Error)
                          return -1;
                      view.setResizeMode(QQuickView::SizeRootObjectToView);
                      view.show();
                  
                      return app.exec();
                  }
                  

                  Are you talking about converting QGuiApplication to QApplication?
                  An error occurs. >:

                  jsulmJ Offline
                  jsulmJ Offline
                  jsulm
                  Lifetime Qt Champion
                  wrote on 18 Feb 2022, 07:50 last edited by
                  #14

                  @IknowQT said in How to use virtual keyboard on Raspberry Pi 4:

                  An error occurs. >:

                  And what is the error?

                  https://forum.qt.io/topic/113070/qt-code-of-conduct

                  I 1 Reply Last reply 18 Feb 2022, 07:53
                  0
                  • jsulmJ jsulm
                    18 Feb 2022, 07:50

                    @IknowQT said in How to use virtual keyboard on Raspberry Pi 4:

                    An error occurs. >:

                    And what is the error?

                    I Offline
                    I Offline
                    IknowQT
                    wrote on 18 Feb 2022, 07:53 last edited by
                    #15

                    @jsulm

                    9195a10e-057d-4228-ac65-0820c3174555-image.png

                    1 Reply Last reply
                    0
                    • I IknowQT
                      18 Feb 2022, 07:14

                      @JKSH

                      #include <QQuickView>
                      #include <QGuiApplication>
                      #include <QQmlEngine>
                      #include <QtWidgets/QApplication>
                      
                      int main(int argc, char *argv[])
                      {
                          qputenv("QT_IM_MODULE", QByteArray("qtvirtualkeyboard"));
                      
                          QGuiApplication app(argc, argv);
                          QApplication n = qobject_cast<QApplication>(app);
                      
                      
                          QQuickView view(QString("qrc:/%2").arg(MAIN_QML));
                          if (view.status() == QQuickView::Error)
                              return -1;
                          view.setResizeMode(QQuickView::SizeRootObjectToView);
                          view.show();
                      
                          return app.exec();
                      }
                      

                      Are you talking about converting QGuiApplication to QApplication?
                      An error occurs. >:

                      jsulmJ Offline
                      jsulmJ Offline
                      jsulm
                      Lifetime Qt Champion
                      wrote on 18 Feb 2022, 07:56 last edited by
                      #16

                      @IknowQT said in How to use virtual keyboard on Raspberry Pi 4:

                      QGuiApplication app(argc, argv);
                      QApplication n = qobject_cast<QApplication>(app);

                      What is this actually?!

                      Why not simply

                      QApplication app(argc, argv);
                      

                      ?

                      https://forum.qt.io/topic/113070/qt-code-of-conduct

                      I 1 Reply Last reply 18 Feb 2022, 08:08
                      0
                      • jsulmJ jsulm
                        18 Feb 2022, 07:56

                        @IknowQT said in How to use virtual keyboard on Raspberry Pi 4:

                        QGuiApplication app(argc, argv);
                        QApplication n = qobject_cast<QApplication>(app);

                        What is this actually?!

                        Why not simply

                        QApplication app(argc, argv);
                        

                        ?

                        I Offline
                        I Offline
                        IknowQT
                        wrote on 18 Feb 2022, 08:08 last edited by
                        #17

                        @jsulm
                        I didn't quite understand what you mean to convert QguiApplication.

                        @JKSH
                        The keyboard works normally when you follow the steps you mentioned.

                        int main(int argc, char *argv[])
                        {
                            qputenv("QT_IM_MODULE", QByteArray("qtvirtualkeyboard"));
                        
                            QApplication app(argc, argv);
                            //QApplication app2 = static_cast<QApplication>(app);
                        
                        
                            QQuickView view(QString("qrc:/%2").arg(MAIN_QML));
                            if (view.status() == QQuickView::Error)
                                return -1;
                            view.setResizeMode(QQuickView::SizeRootObjectToView);
                            view.show();
                        
                            return app.exec();
                        }
                        
                        J 1 Reply Last reply 18 Feb 2022, 08:17
                        0
                        • I IknowQT
                          18 Feb 2022, 08:08

                          @jsulm
                          I didn't quite understand what you mean to convert QguiApplication.

                          @JKSH
                          The keyboard works normally when you follow the steps you mentioned.

                          int main(int argc, char *argv[])
                          {
                              qputenv("QT_IM_MODULE", QByteArray("qtvirtualkeyboard"));
                          
                              QApplication app(argc, argv);
                              //QApplication app2 = static_cast<QApplication>(app);
                          
                          
                              QQuickView view(QString("qrc:/%2").arg(MAIN_QML));
                              if (view.status() == QQuickView::Error)
                                  return -1;
                              view.setResizeMode(QQuickView::SizeRootObjectToView);
                              view.show();
                          
                              return app.exec();
                          }
                          
                          J Offline
                          J Offline
                          JKSH
                          Moderators
                          wrote on 18 Feb 2022, 08:17 last edited by
                          #18

                          @IknowQT said in How to use virtual keyboard on Raspberry Pi 4:

                          The keyboard works normally when you follow the steps you mentioned.

                          I also said:

                          ...create + show a QTextEdit. What happens when you click on the QTextEdit? What happens when you click on one of the fields in the QQuickView?

                          Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

                          I 1 Reply Last reply 18 Feb 2022, 08:46
                          0
                          • J JKSH
                            18 Feb 2022, 08:17

                            @IknowQT said in How to use virtual keyboard on Raspberry Pi 4:

                            The keyboard works normally when you follow the steps you mentioned.

                            I also said:

                            ...create + show a QTextEdit. What happens when you click on the QTextEdit? What happens when you click on one of the fields in the QQuickView?

                            I Offline
                            I Offline
                            IknowQT
                            wrote on 18 Feb 2022, 08:46 last edited by
                            #19

                            @JKSH

                            I tried what you did, the result is that once you click on lineedit made into widget the keyboard appears

                            However, the keyboard appears within the quick screen UI area.
                            It seems certain that the keyboard reacts when lineEdit is clicked.

                            J 1 Reply Last reply 18 Feb 2022, 13:20
                            0
                            • I IknowQT
                              18 Feb 2022, 08:46

                              @JKSH

                              I tried what you did, the result is that once you click on lineedit made into widget the keyboard appears

                              However, the keyboard appears within the quick screen UI area.
                              It seems certain that the keyboard reacts when lineEdit is clicked.

                              J Offline
                              J Offline
                              JKSH
                              Moderators
                              wrote on 18 Feb 2022, 13:20 last edited by
                              #20

                              @IknowQT said in How to use virtual keyboard on Raspberry Pi 4:

                              I tried what you did, the result is that once you click on lineedit made into widget the keyboard appears

                              ...

                              It seems certain that the keyboard reacts when lineEdit is clicked.

                              Great! You now have Qt Virtual Keyboard working with a QWidget.

                              However, the keyboard appears within the quick screen UI area.

                              I'm not sure what you mean -- the keyboard is always meant to appear in the bottom half of the screen.

                              Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

                              I 2 Replies Last reply 20 Feb 2022, 23:14
                              0
                              • J JKSH
                                18 Feb 2022, 13:20

                                @IknowQT said in How to use virtual keyboard on Raspberry Pi 4:

                                I tried what you did, the result is that once you click on lineedit made into widget the keyboard appears

                                ...

                                It seems certain that the keyboard reacts when lineEdit is clicked.

                                Great! You now have Qt Virtual Keyboard working with a QWidget.

                                However, the keyboard appears within the quick screen UI area.

                                I'm not sure what you mean -- the keyboard is always meant to appear in the bottom half of the screen.

                                I Offline
                                I Offline
                                IknowQT
                                wrote on 20 Feb 2022, 23:14 last edited by IknowQT
                                #21

                                @JKSH

                                e557f7fe-ff5b-4c45-b913-a9f5c05f9af1-image.png

                                I popped up a UI called form and clicked lineEdit. The virtual keyboard appears, but it does not appear in the form widget, but in the quick view.

                                int main(int argc, char *argv[])
                                {
                                    qputenv("QT_IM_MODULE", QByteArray("qtvirtualkeyboard"));
                                
                                    QApplication app(argc, argv);
                                    //QApplication app2 = static_cast<QApplication>(app);
                                
                                    Form* f = new Form();
                                    f->show();
                                
                                    QQuickView view(QString("qrc:/%2").arg(MAIN_QML));
                                    if (view.status() == QQuickView::Error)
                                        return -1;
                                    view.setResizeMode(QQuickView::SizeRootObjectToView);
                                    view.show();
                                    return app.exec();
                                }
                                
                                I 1 Reply Last reply 23 Feb 2022, 06:40
                                0
                                • I IknowQT
                                  20 Feb 2022, 23:14

                                  @JKSH

                                  e557f7fe-ff5b-4c45-b913-a9f5c05f9af1-image.png

                                  I popped up a UI called form and clicked lineEdit. The virtual keyboard appears, but it does not appear in the form widget, but in the quick view.

                                  int main(int argc, char *argv[])
                                  {
                                      qputenv("QT_IM_MODULE", QByteArray("qtvirtualkeyboard"));
                                  
                                      QApplication app(argc, argv);
                                      //QApplication app2 = static_cast<QApplication>(app);
                                  
                                      Form* f = new Form();
                                      f->show();
                                  
                                      QQuickView view(QString("qrc:/%2").arg(MAIN_QML));
                                      if (view.status() == QQuickView::Error)
                                          return -1;
                                      view.setResizeMode(QQuickView::SizeRootObjectToView);
                                      view.show();
                                      return app.exec();
                                  }
                                  
                                  I Offline
                                  I Offline
                                  IknowQT
                                  wrote on 23 Feb 2022, 06:40 last edited by
                                  #22

                                  @JKSH

                                  Please reply if there is another way.

                                  1 Reply Last reply
                                  0
                                  • J JKSH
                                    18 Feb 2022, 13:20

                                    @IknowQT said in How to use virtual keyboard on Raspberry Pi 4:

                                    I tried what you did, the result is that once you click on lineedit made into widget the keyboard appears

                                    ...

                                    It seems certain that the keyboard reacts when lineEdit is clicked.

                                    Great! You now have Qt Virtual Keyboard working with a QWidget.

                                    However, the keyboard appears within the quick screen UI area.

                                    I'm not sure what you mean -- the keyboard is always meant to appear in the bottom half of the screen.

                                    I Offline
                                    I Offline
                                    IknowQT
                                    wrote on 8 Mar 2022, 00:51 last edited by
                                    #23

                                    @JKSH
                                    If you don't know, answer that you don't know
                                    I think it's a courtesy to anyone waiting for an answer.

                                    J 1 Reply Last reply 8 Mar 2022, 06:41
                                    0
                                    • I IknowQT
                                      8 Mar 2022, 00:51

                                      @JKSH
                                      If you don't know, answer that you don't know
                                      I think it's a courtesy to anyone waiting for an answer.

                                      J Offline
                                      J Offline
                                      JKSH
                                      Moderators
                                      wrote on 8 Mar 2022, 06:41 last edited by
                                      #24

                                      @IknowQT said in How to use virtual keyboard on Raspberry Pi 4:

                                      @JKSH
                                      If you don't know, answer that you don't know
                                      I think it's a courtesy to anyone waiting for an answer.

                                      I'm sorry for keeping you waiting without a response.

                                      I don't know why your virtual keyboard appears inside the Qt Quick window; I was planning to investigate but my RPi was deployed to another task.

                                      Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

                                      1 Reply Last reply
                                      0
                                      • I Offline
                                        I Offline
                                        IknowQT
                                        wrote on 20 Apr 2022, 02:18 last edited by
                                        #25

                                        Can anyone suggest a solution to this problem?
                                        No one is interested. Is there no way or is it just being on the lookout?

                                        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