How to intercept Cntrl+Alt+F1 and Cntr+Alt+Backspace ?
-
Hi,
AFAIR, these are system shortcuts to switch to the first tty and the other to kill the X11 session. Nothing that even reaches Qt.
As for your Qt version, it's not just old, it's way past its death bed. If you are locked to Qt 4, then at least move to Qt 4.8.7 which is the latest and last of that series. Otherwise, please use Qt 5.
-
As I said, these are system shortcut that application have no access to.
Why Qt 5 ? Because Qt 4 has reached end of life years ago already. Even more Qt 6 is around the corner.
As already written, you are not even using the latest version of Qt 4.
If that's not enough, you are using a version that does not have had all the bug fixes and more important security fixes that have been added through the years.
-
Hi
But does Cntrl+Alt+F1 and Cntr+Alt+Backspace work with you for your app using event filters ? -
Qt does not have any problem with handling Ctrl+Alt+F1 and Ctrl+Alt+Backspace. These would usually work perfectly fine on Windows systems. However, even when your application is in focus all keyboard and mouse events first go to the operating system. The operating system will then decide what to do with these. In normal circumstances it will forward everything to the currently active app. If your shortcuts are not working as expected it is most likely that you are using Linux (since you added the 'embedded' tag this is very likely). Linux as the operating system gets first dips on the shortcuts, recognizes them and applies them. Hence, there is no forwarding to your application. You would need to register your shortcuts (or rather override) with the operating system. This is outside of the scope of Qt. I am also not sure how this would work. For testing you could turn off these system shortcuts on your Linux install. However, it is better to avoid these shortcuts alltogether as they might introduce "bugs" after deployment.
-
@mrjj I intentionally filtered all events in the eventFilter function of my EventFilter(QObject Type) class and set the event filter for the qt application itself. Surprisingly, it did filter Cntrl+Alt+F1 and Cntrl+Alt+Backspace Events.(Or It didn't switch the terminal or killed itself).But I was unable to filter only these events.But From @SGaist 's reply, what I understood is it is outside the scope of Qt. I saw some solutions for X11 based system.We use frame buffers instead.Any idea ?
-
@SimonSchroeder ![alt text]( image url)
This solution may work for Cntrl+Alt+Backspace.But For that driver name is required.How can I find which driver is loaded (in linux) for keyboard?
-
@prinzkm I don't have any experience with Qt on embedded devices. However, on the same page you provided the screenshot it has a section on "Available Keyboard Drivers". These are Qt-specific drivers, as far as I understand. It seems that currently only two drivers are available:
TTY
andLinuxInput
. By default Qt is only compiled with support forTTY
. Unfortunately, this is also the driver which intercepts Ctrl+Alt+F1 and Ctrl+Alt+Backspace. Therefore, you should have a look at the other driver. My understanding is that for this to work you need to compile Qt yourself with theLinuxInput
driver enabled (by providing the command line option-qt-kbd-linuxinput
when configuring Qt before compilation. I hope, somebody else can help you with these keyboard drivers.