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();
    ev->accept();
    m_view->event(ev);
    if (ev->isAccepted())
        qDebug()  << "Event accepted";
    else
        qDebug()  << "Event NOT accepted";
    QWidget::keyPressEvent(ev);
}

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,
Massimo
_______________________________________________
webkit-qt mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-qt

Reply via email to