[webkit-qt] Custom keycodes not accepted

Massimo Callegari massimocallegari at yahoo.it
Fri Sep 5 04:01:34 PDT 2014

Hi everyone,
I have a problem with QtWebKit 5.3.1 not forwarding custom keycodes to the Javascript layer. Basically the "onkeypress" event is not fired.

I am developing my own IR remote control driver inside the eglfs plugin. I submit the keycodes to the upper layers like this:

QWindowSystemInterface::handleKeyEvent(0, QEvent::KeyPress, keyCode, Qt::NoModifier);

QWindowSystemInterface::handleKeyEvent(0, QEvent::KeyRelease, keyCode, Qt::NoModifier);

As long as I send Qt keycodes (like Qt::Key_0, Qt::Key_Up, etc..) I receive the Javascript event. When I send custom keycodes like 61506, 61507, etc, they get marked as not accepted. I guess by the QWebView class.
In my previous system I was using QtWebKit 2.3.3 + Qt 4.8.6 + DirectFB and it was working fine with the same keycodes.

In my simple browser application I redefined the keyPressEvent method like this:

void MainWindow::keyPressEvent(QKeyEvent *ev)
    qDebug() << "key pressed:" << ev->key() << "accepted:" << ev->isAccepted();
    if (ev->isAccepted())
        qDebug()  << "Event accepted";
        qDebug()  << "Event NOT accepted";

m_view is a pointer to QWebView.

I receive all the keycodes and at the beginning of the function the events are still marked as accepted. 
But even if I try to force to accept them, when they enter the QWebView they are always not accepted, thus not forwarded to the Javascript layer.

Is there a particular reason for this or is there a way to workaround it ?

Thanks in advance,
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.webkit.org/pipermail/webkit-qt/attachments/20140905/5867d43d/attachment.html>

More information about the webkit-qt mailing list