Important: Please read the Qt Code of Conduct -

Mac dead keys and QInputMethodEvent

  • Hey there Qt experts ;-)

    I have a rather special question: as far as I understood, dead key composition on the Mac is being done via the QInputMethodEvent. At least that's what I'm seeing in the debugger: if I enter a tilde ('~') for instance, I have to press space afterwards, to make it a distinct character. In that case, no QKeyEvents arrive, but a QInputMethodEvent if I finally press the space bar. It will then contain whatever char or string results from the composition. So far, so good. Only, I want to explicitly use this in a QWindow and not a QWidget. Don't suggest otherwise, I have no choice, I have to use QWindow. Alas, QWindow will not receive QInputMethodEvents. In my tilde case, some QKeyEvents arrive at the QWindow, one of them being typed as Qt::Key_unknown. So my question is: how can I achieve dead key composition on the Mac without using the QWidget system?

    thanks a bunch,

  • Lifetime Qt Champion


    You could try with an eventFilter and handle QEvent::InputMethod in there

    Hope it helps