Important: Please read the Qt Code of Conduct -

Shield Key Arrow and Space

  • I am writing a program of keyboard test.
    alt text
    How to shield arrow keys of move between QWidgets and space of press QPushButton ?
    And distinguish left and right same fuction key (Ctrl, Alt, Shift, win) ?
    And distinguish numpad key ?

  • @sonichy given that you're using standard QKeyEvent class, I'd say you may want to derive from it and create your own MyKeyEvent where you can distinguish between left and right Shift keys and so on.

    You'll also may want to specialize the Qt::Key enum to add Qt::Key_Shift_L and Qt::Key_Shift_R and so on.

    Then, in your mainwindow.cpp whenever you detect the left Shift key is pressed you'll use your extensions.

    In any case, I wonder why you need this given that the Qt developers did not so far, and they have already abstracted the keyboard functionality of several OS...

Log in to reply