How to popup screen keyboard (Ubuntu)
-
wrote on 15 Mar 2023, 09:55 last edited by
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
-
wrote on 16 Mar 2023, 04:48 last edited by Kent-Dorfman
google search for "qt activate screen keyboard" yields results.
What did you search for?
-
google search for "qt activate screen keyboard" yields results.
What did you search for?
wrote on 16 Mar 2023, 09:00 last edited by@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. -
google search for "qt activate screen keyboard" yields results.
What did you search for?
wrote on 16 Mar 2023, 13:13 last edited by@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.
-
@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.
wrote on 16 Mar 2023, 14:14 last edited by@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(); }
-
@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(); }
-
@JoeCFD
But how did you know to use the wordonboard
to ask for this? It appears to be the key, I haven't heard of it?! :) -
@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(); }
wrote on 16 Mar 2023, 19:40 last edited by seps@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)
-
wrote on 28 May 2024, 15:27 last edited by
@seps, did you find a solution?