Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. How to use virtual keyboard on Raspberry Pi 4
Qt 6.12 LTS is out! See what's new in the release blog

How to use virtual keyboard on Raspberry Pi 4

Scheduled Pinned Locked Moved Unsolved General and Desktop
25 Posts 4 Posters 10.7k 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

    @JKSH

    I saw this example too, but things are a little different
    My development environment is QWidget and the example is qml

    Do I have to use the virtual keyboard by using qml?
    Are there any examples of using virtual keyboard in qwidget?

    When running on Ubuntu, the keyboard works normally. However, when I put it on the Raspberry Pi 4 board, it does not appear.

    JKSHJ Offline
    JKSHJ Offline
    JKSH
    Moderators
    wrote on last edited by
    #5

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

    When running on Ubuntu, the keyboard works normally. However, when I put it on the Raspberry Pi 4 board, it does not appear.

    Do a sanity check first: Try to run the QML example on your Raspberry Pi.

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

    I 1 Reply Last reply
    0
    • JKSHJ JKSH

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

      When running on Ubuntu, the keyboard works normally. However, when I put it on the Raspberry Pi 4 board, it does not appear.

      Do a sanity check first: Try to run the QML example on your Raspberry Pi.

      I Offline
      I Offline
      IknowQT
      wrote on last edited by
      #6

      @JKSH

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

      JKSHJ 1 Reply Last reply
      0
      • I IknowQT

        @JKSH

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

        JKSHJ Offline
        JKSHJ Offline
        JKSH
        Moderators
        wrote on 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

        JKSHJ 1 Reply Last reply
        0
        • sierdzioS Offline
          sierdzioS Offline
          sierdzio
          Moderators
          wrote on 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
          0
          • sierdzioS sierdzio

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

            JKSHJ 1 Reply Last reply
            0
            • I IknowQT

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

              JKSHJ Offline
              JKSHJ Offline
              JKSH
              Moderators
              wrote on 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
              1
              • JKSHJ JKSH

                @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 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
                • JKSHJ JKSH

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

                  JKSHJ Offline
                  JKSHJ Offline
                  JKSH
                  Moderators
                  wrote on 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
                  0
                  • JKSHJ JKSH

                    @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 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
                    0
                    • I IknowQT

                      @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 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
                      0
                      • jsulmJ jsulm

                        @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 last edited by
                        #15

                        @jsulm

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

                        1 Reply Last reply
                        0
                        • I IknowQT

                          @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 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
                          0
                          • jsulmJ jsulm

                            @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 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();
                            }
                            
                            JKSHJ 1 Reply Last reply
                            0
                            • I IknowQT

                              @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();
                              }
                              
                              JKSHJ Offline
                              JKSHJ Offline
                              JKSH
                              Moderators
                              wrote on 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
                              0
                              • JKSHJ JKSH

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

                                JKSHJ 1 Reply Last reply
                                0
                                • I IknowQT

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

                                  JKSHJ Offline
                                  JKSHJ Offline
                                  JKSH
                                  Moderators
                                  wrote on 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
                                  0
                                  • JKSHJ JKSH

                                    @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 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
                                    0
                                    • I IknowQT

                                      @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 last edited by
                                      #22

                                      @JKSH

                                      Please reply if there is another way.

                                      1 Reply Last reply
                                      0
                                      • JKSHJ JKSH

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

                                        JKSHJ 1 Reply Last reply
                                        0
                                        • I IknowQT

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

                                          JKSHJ Offline
                                          JKSHJ Offline
                                          JKSH
                                          Moderators
                                          wrote on 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

                                          • Login

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