Mac OS Option Key cannot be used for AltModifier



  • (Edit: Changed the title to highlight the root issue. In Qt4.x, the Mac user who pressed Option+key produced that key, e.g. Key_3, with AltModifier. This was platform-independent, the app got the identical keyEvent values in any platform with a defined Alt key. Now in 5.x, the values from Mac OS are different from other platforms. This breaks platform independence with respect to keyPressEvent processing.)

    I am working on Mac OSX 10.9. I have an existing app based on Qt4 and am rewriting it for Qt5.

    A widget with a keyPressEvent() method gets different values in the keyEvent. In the Qt4 version, when I press the Option and 3 keys together, the event contains Key_3 and Alt_Modifier. In Qt5.2, the same code receives Key_sterling (0xa3) and Alt_Modifier.

    Now, the Mac OS does support users entering special characters using the Option key. If you open the Mac Keyboard Viewer and hold down Option, yes, it shows the pound sterling symbol on the 3 key. But the Qt4-based code, in the exact same OS environment, gets the "raw" keystroke value in its keyEvent, while the Qt5-based code gets the "cooked" version.

    Is this an intentional change in the key event handling for Qt5? Is there any way of turning it off and going back to the previous behavior? I have looked at http://qt-project.org/doc/qt-5/macosx-issues.html and don't see anything relevant.


  • Lifetime Qt Champion

    Hi,

    Did you also took a look at the "bug report system":http://bugreports.qt-project.org ?

    If you can't find anything, please open a new report providing a minimal compilable examples that shows the problem.


Log in to reply
 

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