Qt World Summit: Register Today!

QLineEdit and QTextEdit misread OS X Keystroke events

  • My app uses both QLineEdit and QTextEdit running in Mac OS X 10.6. These widgets mis-read input key events that are generated by "PopChar":http://www.ergonis.com/products/popcharx/ and "Typinator":http://www.ergonis.com/products/typinator/, two popular add-ons from Ergonis Gmbh.

    When I attempt to input a Unicode character using PopChar, or when Typinator attempts to insert the expansion of a keystroke macro, all that appears in the input field is a lowercase letter a.

    (Edit: Qt also ignores keystroke input from the Apple Keyboard Viewer. To test this,

    • open System Preferences
    • select the Language and Text pane
    • at the bottom, set the check box "Show input menu in menu bar"

    Now from the menu bar you can open a Character Viewer that allows you to view and enter all Unicode chars, or a Keyboard Viewer that shows you all the special characters entered with modifier keys. Either method of inserting characters is ignored by Qt (and some other apps) but supported by BBEdit and by official Apple apps such as TextEdit. /edit)

    I queried Ergonis support and this was the reply:

    bq. Both PopChar and Typinator use an event mechanism that was introduced with Mac OS X 10.4. For more information, please see the Quartz Event Services Reference: http://tinyurl.com/77buqql
    Look for the CGEventKeyboardGetUnicodeString function....Both PopChar and Typinator use this technique to transmit characters or entire phrases to the current application. For example, Typinator breaks expansions into 20 character pieces and sends these fragments as separate keyboard events. The key code is irrelevant here, as there is not a single key that represents the character or string.

    There seems to be a problem with Qt's handling of this type of event. Can anyone suggest a workaround?

Log in to reply