It is not possible to do this using pure Qt
methods, as far as I know.
However, depending on your platform, you can distinguish keys using QKeyEvent::nativeScanCode()
instead of QKeyEvent::key()
.
For example, on Windows, you can check which Ctrl key was pressed as follows:
if (event->nativeScanCode() == VK_LCONTROL) { // left control pressed } else if (event->nativeScanCode() == VK_RCONTROL) { // right control pressed }
source share