Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Show keyboard when QTextEdit is activated



  • Hello!

    I am developing a tablet application with Windows 10. I have some data inputs and I want to show the keyboard when I push on them. I don't know why, but in some cases, the keyboard appears automatically and in other cases it doesn't appear.

    Do you know how to fix it?

    Thank you very much!!



  • Are you using QtWidgets or QtQuick (QML)?



  • @VRonin I am using QtWidgets



  • Hi @ivanicy

    Which Qt version are you using?

    Are you using the Qt Virtual Keyboard?
    How are you displaying your keyboard , can you share a sample code?



  • @mostefa No, I want to show the system keyboard ( I am running the program in a tablet). I have observed that if the echoMode property of the QLineEdit is "password" when I push on it, the windows keyboard appears automatically, but, if the echoMode property is any other, the keyboard doesn't appear.



  • @ivanicy said in Show keyboard when QTextEdit is activated:

    @mostefa No, I want to show the system keyboard ( I am running the program in a tablet). I have observed that if the echoMode property of the QLineEdit is "password" when I push on it, the windows keyboard appears automatically, but, if the echoMode property is any other, the keyboard doesn't appear.

    Ok ,

    I don't know if what i will describe will help you , cause in my case i was not using android , i was a virtual keyboard on imx6 embedded card,

    The Qt Doc speak about RequestSoftwareInputPanel

    This enum describes under what circumstances a software input panel will be requested by input capable widgets.

    to know how to use this enum , you can get inspired from this post:

    https://forum.qt.io/topic/20313/how-to-set-qstyle-requestsoftwareinputpanel-to-qstyle-rsip_onmouseclick

    I hope this can help you!

    I have just another question :

    Have you the problem with all input widgets , (such as : QLineEdit, QTextEdit..) or just with QTextEdit?



  • @mostefa Thank you for your answer. I am running the app in a Windows tablet. The problem is with all input widgets. Only when this widgets are password echoMode, it works correctly. I will try your solution, and I hope it to work!



  • @ivanicy said in Show keyboard when QTextEdit is activated:

    @mostefa Thank you for your answer. I am running the app in a Windows tablet. The problem is with all input widgets. Only when this widgets are password echoMode, it works correctly. I will try your solution, and I hope it to work!

    Hi again @ivanicy

    I think that you are having this Qt bug in windows tablet !



  • @ivanicy ,

    Whenever if you click inside the textedit, application will show the on screen keyboard.
    Try this code.

    MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
    {
    ui->setupUi(this);
    connect(ui->textEdit,SIGNAL(selectionChanged()),this,SLOT(SLT_TextEditActivated()));
    connect(this,SIGNAL(SGN_ShowKeyboard()),this,SLOT(SLT_ShowKeyboard()));

    }
    void MainWindow::SLT_ShowKeyboard(){
    qDebug()<<"Showing Keyboard"<<endl;
    QProcess *myProcess = new QProcess(this);
    myProcess->startDetached("C:\Windows\System32\osk.exe");
    }

    void MainWindow::SLT_TextEditActivated(){
    qDebug()<<"TextEdit Activated"<<endl;
    emit SGN_ShowKeyboard();
    }



  • @Vinod-Kuntoji It could be a temporal solution. This solution shows this keyboard:

    0_1510143694966_teclado malo.png

    but, it shows the administrator window before open it. I want to show the pop-up keyboard:

    0_1510143761725_teclado bueno.png

    that is shown automatically. This keyboard only appears when the QLineEdit has "password" echoMode.


Log in to reply