In Qt’s QKeyEvent, I can check whether Ctrl was pressed by checking if ev->key() is Qt::Key_Control, but how can I distinguish between the left and right Ctrl keys?
I also need the same thing for Alt and Shift keys.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
There is no way to do this using pure
Qtmethods, as far as I know.Depending on your platform, however, you might be able to distinguish between the keys using the
QKeyEvent::nativeScanCode()method instead ofQKeyEvent::key().For example, on Windows you should be able to test which Ctrl key was pressed as follows: