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

Can not display qt virtual keyboard.



  • Could somebody give me a help? Thanks!

    Recently, I am designing a QT Widgets Application for fun. But there is a problem I can't fix.

    I want to use qtvirtualkeuboard. It works at the begining.

    But when I change the application to full screen, it doesn't work. I think the qtvirtualkeyboard is opened but not displayed topmost.

    The code is shown as bellow.

    When I use w.show(), it works. It can open virtualkeyboard when click a QLineEdit.

    int main(int argc, char *argv[])
    {
    qputenv("QT_IM_MODULE", QByteArray("qtvirtualkeyboard"));

    QApplication a(argc, argv);
    
    MainWindow w;
    w.show();
    
    return a.exec();
    

    }

    When I use w.showFullScreen(), it doesn't work. It can't open virtualkeyboard when click a QLineEdit.

    int main(int argc, char *argv[])
    {
    qputenv("QT_IM_MODULE", QByteArray("qtvirtualkeyboard"));

    QApplication a(argc, argv);
    
    MainWindow w;
    w.showFullScreen();
    
    return a.exec();
    

    }

    I don't the reason. Could somebody tell me the reason and teach me how to change the code of my application or the source code of qtvirtualkeyboard, please?

    Thanks!


  • Lifetime Qt Champion

    Hi,

    What version of Qt are you using ?
    On what platform ?
    With which compiler ?



  • @SGaist
    Hi SGaist,

    I use Qt5.9.1.
    And it doesn't work on either Windows 7 or Ubuntu 16.04.
    For Windows 7, I use MSVC2013 64bit. And for Ubuntu 16.04, I use GCC 64bit.

    By the way, I find out something. On Windows 7. If I use opengl in my application code, such as QOpenGLWidget and QOpenGLFunctions_2_0, it will not work. But if I don't use opengl, it will work.
    But on Ubuntu 16.04, no matter I use opengl whether or not, it doen't work.

    Windows 7
    0_1537233531185_954aaa48-0d49-45c8-9840-49bdc1b54e7d-image.png
    0_1537233623671_6063dacc-063e-4df2-a3c2-df6b215fed82-image.png

    Ubuntu 16.04
    0_1537233786276_c740aa90-6089-49a3-b3b2-bb94fc0ab794-image.png
    0_1537233895577_b2aefcce-f20c-49d6-bafa-010d24b0280e-image.png

    Thanks!


  • Lifetime Qt Champion

    What happens if you maximize the window after the keyboard is shown ?



  • @SGaist
    I don't understand you clearly.

    If I use w.show(), it works normally, no matter maximize or normal the window.

    If I use w.showFullScreen(), it doesn't work. And I can't change the size of the window.

    Maybe, you mean I use w.show() first, after the virtualkeyboard appears, I change the window to maximize by setting windows flags. Am I right? I didn't try this.

    Thank you!


  • Lifetime Qt Champion

    Yes, that's that. Start using show, and after that go full screen.


Log in to reply