Qt5 doesn’t grab keyboard strokes



  • I already posted this message, but perhaps in the wrong sub forum...

    I made a small test app in C++ (no QML). The main widget is a QWidget. It has 1 QLineEdit, 1 QSpinBox and 2 QPushButton. One to quit, the other to show the “About Qt” dialog.

    I can type text and numbers in QLineEdit and QSpinBox as long as I change the focus with the tab key. If I use the mouse to change the focus or if I show the “About Qt” dialog, the characters I type go to the console instead of my Qt app : I can see them when I quit.

    I run the app with the CLI option : -platform eglfs, kernel v3.6, Raspbian Wheezy, RPi model B.

    Any idea ?



  • I have a QML/WebView in Qt5, where I see a similar behavior when I enter text in text boxes in web pages. The text does get picked up by webkit and all the events seem to be ok. However, there are two interesting issues:

    1. key strokes get repeated in the console when I exit the application (didn't verify if it happens on-the-fly or after - but looks like the same as your issue)
    2. when pressing/releasing the shift key, strange unicode characters are entered in the strings I am editing - very frustrating (they are not visible - but breaks some code I did).


  • I did not have a chance to dig into it again, but I just tested it is the same when the program is started with and without the X server.



  • It has sure been a few months since this was first asked, I wonder if any of you got around this problem....

    I'm running a Qt 5 QML app on a Raspberry Pi without running the Xserver and while all things seem to work alright I get nasty behavior such as the application quitting when Ctrl + C is pressed. And ultimately if you write something like "sudo reboot" you end up being able to reboot the RPi from within the app..

    I've tried having catching events in a Root element and setting the event as accepted, I've also tried redirecting the application's output to a file when running it but it just won't budge.

    I was thinking of looking into ways to completely disable the terminal (my application is supposed to run in a kind of "kiosk" mode so I wouldn't mind crippling the Linux underneath, but I still think there should be a way of doing it direclty from Qt, hopefully you guys managed to solve it...

    Thanks in advance,

    Wolf


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.