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 popup screen keyboard (Ubuntu)

How to popup screen keyboard (Ubuntu)

Scheduled Pinned Locked Moved Unsolved General and Desktop
9 Posts 5 Posters 1.5k 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.
  • S Offline
    S Offline
    seps
    wrote on 15 Mar 2023, 09:55 last edited by
    #1

    Hi, I would like to use the Ubuntu screen keyboard (note, not the QVirtualKeyboard) whenever a user clicks on a Input (QTextInput etc..).

    I enable the screen keyboard under Ubuntu settings, and the keyboard pops up when i click any application text input (e.g. browser, explorer).

    However, when I click any Qt input widgets, the keyboard does not show.

    I've searched the web but couldn't find a solution to popup the keyboard consistently.

    Any tip?

    Thanks

    1 Reply Last reply
    1
    • K Offline
      K Offline
      Kent-Dorfman
      wrote on 16 Mar 2023, 04:48 last edited by Kent-Dorfman
      #2

      google search for "qt activate screen keyboard" yields results.

      What did you search for?

      J S 2 Replies Last reply 16 Mar 2023, 09:00
      0
      • K Kent-Dorfman
        16 Mar 2023, 04:48

        google search for "qt activate screen keyboard" yields results.

        What did you search for?

        J Offline
        J Offline
        JonB
        wrote on 16 Mar 2023, 09:00 last edited by
        #3

        @Kent-Dorfman
        To be fair I searched for similar yesterday, and looked at that search now, and all I could find is about the Qt virtual keyboard, which the OP does not want.

        1 Reply Last reply
        0
        • K Kent-Dorfman
          16 Mar 2023, 04:48

          google search for "qt activate screen keyboard" yields results.

          What did you search for?

          S Offline
          S Offline
          seps
          wrote on 16 Mar 2023, 13:13 last edited by
          #4

          @Kent-Dorfman very helpful, thanks.

          Anyway, it seems that Qt doesn't work in general with Ubuntu 'screen keyboard'

          I've tried and installed qt applications from apt, and in these qt applications the Ubuntu 'screen keyboard' doesn't pop up, as opposed to 'native' GTK3 applications.

          J 1 Reply Last reply 16 Mar 2023, 14:14
          0
          • S seps
            16 Mar 2023, 13:13

            @Kent-Dorfman very helpful, thanks.

            Anyway, it seems that Qt doesn't work in general with Ubuntu 'screen keyboard'

            I've tried and installed qt applications from apt, and in these qt applications the Ubuntu 'screen keyboard' doesn't pop up, as opposed to 'native' GTK3 applications.

            J Offline
            J Offline
            JoeCFD
            wrote on 16 Mar 2023, 14:14 last edited by
            #5

            @seps typed: use onboard for input in qt linedit on ubuntu in ChatGPT
            got this

            #include <QApplication>
            #include <QHBoxLayout>
            #include <QLabel>
            #include <QLineEdit>
            #include <QProcess>
            #include <QX11EmbedContainer>
            #include <QX11EmbedWidget>
            #include <QWidget>
            
            int main(int argc, char *argv[])
            {
                QApplication app(argc, argv);
            
                // Create a widget with a layout
                QWidget widget;
                QHBoxLayout *layout = new QHBoxLayout(&widget);
            
                // Create a line edit and add it to the layout
                QLineEdit *lineEdit = new QLineEdit(&widget);
                layout->addWidget(lineEdit);
            
                // Create a label with a button to activate the keyboard
                QLabel *label = new QLabel("Click here to activate the on-screen keyboard", &widget);
                QPushButton *button = new QPushButton("Activate", &widget);
                QHBoxLayout *labelLayout = new QHBoxLayout(label);
                labelLayout->addWidget(button);
                labelLayout->addStretch();
                layout->addWidget(label);
            
                // Create a X11 embed container and widget
                QX11EmbedContainer *container = new QX11EmbedContainer(&widget);
                QX11EmbedWidget *embedWidget = new QX11EmbedWidget(container);
                container->embedClientWindow(embedWidget->winId());
            
                // Connect the button's clicked signal to a lambda function
                QObject::connect(button, &QPushButton::clicked, [=]() {
                    // Start the onboard process
                    QProcess::startDetached("onboard");
            
                    // Embed the onboard window into the X11 embed widget
                    embedWidget->embedClient("Onboard");
            
                    // Set the focus to the line edit
                    lineEdit->setFocus();
                });
            
                // Add the X11 embed container to the layout
                layout->addWidget(container);
            
                // Show the widget
                widget.show();
            
                return app.exec();
            }
            
            
            J S 2 Replies Last reply 16 Mar 2023, 15:08
            0
            • J JoeCFD
              16 Mar 2023, 14:14

              @seps typed: use onboard for input in qt linedit on ubuntu in ChatGPT
              got this

              #include <QApplication>
              #include <QHBoxLayout>
              #include <QLabel>
              #include <QLineEdit>
              #include <QProcess>
              #include <QX11EmbedContainer>
              #include <QX11EmbedWidget>
              #include <QWidget>
              
              int main(int argc, char *argv[])
              {
                  QApplication app(argc, argv);
              
                  // Create a widget with a layout
                  QWidget widget;
                  QHBoxLayout *layout = new QHBoxLayout(&widget);
              
                  // Create a line edit and add it to the layout
                  QLineEdit *lineEdit = new QLineEdit(&widget);
                  layout->addWidget(lineEdit);
              
                  // Create a label with a button to activate the keyboard
                  QLabel *label = new QLabel("Click here to activate the on-screen keyboard", &widget);
                  QPushButton *button = new QPushButton("Activate", &widget);
                  QHBoxLayout *labelLayout = new QHBoxLayout(label);
                  labelLayout->addWidget(button);
                  labelLayout->addStretch();
                  layout->addWidget(label);
              
                  // Create a X11 embed container and widget
                  QX11EmbedContainer *container = new QX11EmbedContainer(&widget);
                  QX11EmbedWidget *embedWidget = new QX11EmbedWidget(container);
                  container->embedClientWindow(embedWidget->winId());
              
                  // Connect the button's clicked signal to a lambda function
                  QObject::connect(button, &QPushButton::clicked, [=]() {
                      // Start the onboard process
                      QProcess::startDetached("onboard");
              
                      // Embed the onboard window into the X11 embed widget
                      embedWidget->embedClient("Onboard");
              
                      // Set the focus to the line edit
                      lineEdit->setFocus();
                  });
              
                  // Add the X11 embed container to the layout
                  layout->addWidget(container);
              
                  // Show the widget
                  widget.show();
              
                  return app.exec();
              }
              
              
              J Offline
              J Offline
              JonB
              wrote on 16 Mar 2023, 15:08 last edited by
              #6

              @JoeCFD
              But how did you know to use the word onboard to ask for this? It appears to be the key, I haven't heard of it?! :)

              J 1 Reply Last reply 16 Mar 2023, 16:01
              0
              • J JonB
                16 Mar 2023, 15:08

                @JoeCFD
                But how did you know to use the word onboard to ask for this? It appears to be the key, I haven't heard of it?! :)

                J Offline
                J Offline
                JoeCFD
                wrote on 16 Mar 2023, 16:01 last edited by
                #7

                @JonB A few queries will get there. I did use it before long time ago and therefore the name looks familiar.

                1 Reply Last reply
                1
                • J JoeCFD
                  16 Mar 2023, 14:14

                  @seps typed: use onboard for input in qt linedit on ubuntu in ChatGPT
                  got this

                  #include <QApplication>
                  #include <QHBoxLayout>
                  #include <QLabel>
                  #include <QLineEdit>
                  #include <QProcess>
                  #include <QX11EmbedContainer>
                  #include <QX11EmbedWidget>
                  #include <QWidget>
                  
                  int main(int argc, char *argv[])
                  {
                      QApplication app(argc, argv);
                  
                      // Create a widget with a layout
                      QWidget widget;
                      QHBoxLayout *layout = new QHBoxLayout(&widget);
                  
                      // Create a line edit and add it to the layout
                      QLineEdit *lineEdit = new QLineEdit(&widget);
                      layout->addWidget(lineEdit);
                  
                      // Create a label with a button to activate the keyboard
                      QLabel *label = new QLabel("Click here to activate the on-screen keyboard", &widget);
                      QPushButton *button = new QPushButton("Activate", &widget);
                      QHBoxLayout *labelLayout = new QHBoxLayout(label);
                      labelLayout->addWidget(button);
                      labelLayout->addStretch();
                      layout->addWidget(label);
                  
                      // Create a X11 embed container and widget
                      QX11EmbedContainer *container = new QX11EmbedContainer(&widget);
                      QX11EmbedWidget *embedWidget = new QX11EmbedWidget(container);
                      container->embedClientWindow(embedWidget->winId());
                  
                      // Connect the button's clicked signal to a lambda function
                      QObject::connect(button, &QPushButton::clicked, [=]() {
                          // Start the onboard process
                          QProcess::startDetached("onboard");
                  
                          // Embed the onboard window into the X11 embed widget
                          embedWidget->embedClient("Onboard");
                  
                          // Set the focus to the line edit
                          lineEdit->setFocus();
                      });
                  
                      // Add the X11 embed container to the layout
                      layout->addWidget(container);
                  
                      // Show the widget
                      widget.show();
                  
                      return app.exec();
                  }
                  
                  
                  S Offline
                  S Offline
                  seps
                  wrote on 16 Mar 2023, 19:40 last edited by seps
                  #8

                  @JoeCFD thanks for the help, but I already tried the chatgpt route before posting here. Posting here was my last try

                  onboard is not the standard Ubuntu screen keyboard. If I go in the 'onboard' route, I could as well write/ use my custom keyboard widget, that I would have more control over

                  Put simply, qt as a whole doesn't seem to support standard Ubuntu screen keyboard (GTK does)

                  1 Reply Last reply
                  0
                  • R Offline
                    R Offline
                    rYhcpcprDk
                    wrote on 28 May 2024, 15:27 last edited by
                    #9

                    @seps, did you find a solution?

                    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