Passing synthetic keyboard events to the QQuickWindow
QQuickWindow is created from QQuickRenderControl and used as GUI overlay for an application. Input event loop is outside of Qt, so the events are sent manually through QCoreApplication::sendEvent.
Injecting mouse with QCoreApplication::instance()->sendEvent(quickWindow, event) works for push/release/move: can click buttons and select text in TextFields.
But I can't get the keyboard to work: it's not possible to edit the text in the TextField, cursor doesn't appear.
I've tried sending QFocusEvent, but it does nothing.
Also tried to setFocus and send QFocusEvent to the window and specific TextField. That got TextField into focus, but I'm not going to reimplement the focus rules.
How it's supposed to work?
Re: Passing synthetic keyboard events to the QQuickWindow
Well, usually events are not injected that way, e.g. the platform integration publishes them to the Qt event system which then distributes them.
But if you must tack this on like this then check if there is a focusObject: QGuiApplication::focusObject().
Cheers,
_
Re: Passing synthetic keyboard events to the QQuickWindow
Quote:
Originally Posted by
anda_skoa
Well, if the QQuickWindow::activeFocusItem isn't getting it then there'll be nothing in QGuiApplication::focusObject() either.