Important: Please read the Qt Code of Conduct -

QPlatformInputContext::filterEvent not called

  • I wrote my own inputcontext class derived from QPlatformInputContext. But on one of my linux devices the filterEvent method is not called in case I press a key. But the keystrokes from external keyboard goes into my widgets as expected - text is written.
    On my desktop machine (Windows + VMware + Ubuntu 12.04) everything is fine.
    Any reasons for this behaviour?

  • Lifetime Qt Champion


    You should give more information about the setup where the filter is not working compared to the one where it's currently working.

  • The difference is X11 versus embedded.

    One desktop X11 is available. Thus the xcb plugin is used.
    One the other system eglfs is used. The call of the application is ./MyApp -platform eglfs -plugin evdevkeyboard
    I can debug into the plugin and the keystrokes are handled there and following plugin method is called.
    But the event does not reach by plugin.

    void QEvdevKeyboardHandler::processKeyEvent(int nativecode, int unicode, int qtcode,
                                                Qt::KeyboardModifiers modifiers, bool isPress, bool autoRepeat)
        QWindowSystemInterface::handleExtendedKeyEvent(0, (isPress ? QEvent::KeyPress : QEvent::KeyRelease),
                                                       qtcode, modifiers, nativecode + 8, 0, int(modifiers),
                                                       (unicode != 0xffff ) ? QString(unicode) : QString(), autoRepeat);


  • Lifetime Qt Champion

    What do you mean by "the event does not reach by plugin" ?

  • @SGaist
    My plugin derives from QPlatformInputContext. The method QPlatformInputContext::filterEvent(const QEvent *event) is called for events in case I use qxcb. I want to achieve the same behaviour in case I use eglfs. In eglfs the plugin generic/ is loaded, which containts the code in my previous post.
    Either there is a specific setting possible or I have to read the keyboard outcome by myself.


  • Lifetime Qt Champion

    From a quick look it seems that the QEvdevKeyboardHandler class doesn't take QPlatformInputContext at all while it's integrated in the xcb backend. You could try adding it to QEvdevKeyboardHandler

Log in to reply