Hello,
I have two windows : one QQuickView and one QGLWidget. The process of key events are made in the root item of the main window QQuickView, so it is made in qml with a javascript function (handler Keys.onPressed).
So now I also want to catch keyevents in QGLWidget, it works well with “keyPressEvent(QKeyEvent* event)”, and I want to forward it to my root item in QQuickView.
Here is my code :
void MyGLWindow::keyPressEvent(QKeyEvent* event)
{
QKeyEvent* eventCopy = new QKeyEvent(event->type(), event->key(), event->modifiers());
QApplication::postEvent(quickView->rootObject(), eventCopy);
}
It does not work, does anyone understand why ?
↧