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 Update on Monday, May 27th 2025

How to use virtual keyboard on Raspberry Pi 4

Scheduled Pinned Locked Moved Unsolved General and Desktop
25 Posts 4 Posters 4.7k Views
  • 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.
  • 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
                              • I Offline
                                I Offline
                                IknowQT
                                wrote on 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