Nominate our 2022 Qt Champions!

Using QT with keyboard but without benefit of the mouse

  • Under Linux I have to deliver an application that does not use the mouse. I believe I setup everything ok, and here is the problem.
    On one system, on program startup, the keyboard is active and the Qt MainWindow application recognizes the keyboard input as expected.

    On some other Linux systems, including the one on which I am developing, (I am trying different test platforms), the identical Qt from same 4.74 version and identical source code is blocked. By blocked, I mean that the application does not recognize keyboard entries until a) I use the alt-tab to move to another desktop and return, or b) if I click anywhere on active Qt application screen with the mouse, from then on the Qt application recognizes the keyboard.

    Any clues as to what I can do to circumvent this initialisation problem? The application is using buttons throughout. Tabbing to the button and hitting enter works once past initialisation.

    I am a true beginner in C++ (I come from 25 years of C programming), so I am experiencing a new world of C++ and Qt.

    This is my trains of thought, after reading about mouseevents.
    a) create a method in MainWindow::InitializeKeyboard() and have that method signal a mouseclick using coordinates of the first button. I believe that by doing this action, it will initialize the Qt code and also the keyboard recognition.

    b) Call for help from this forum

    c) Both a) and b).

    If you can help, I will be grateful. I am already late for resolving this problem.

    I will be cross posting to Installation and Deployment.

    Thanks in advance

  • Please don't post the same question twice in defferent subforums.

    I'm closing this one.

    Continue on "this thread": please.

Log in to reply