[Interest] Focus and synthetic keyboard events with QQuickWindow

Velkan S velorums at gmail.com
Tue Jan 5 18:56:41 CET 2016


Hi,

QQuickWindow is created from QQuickRenderControl and used as GUI
overlay for an application. Input event loop is outside of Qt (it's
SDL), 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.
QWindow::requestActivate() on QQuickWindow doesn't help and doesn't
change the outcome of QWindow::isActive().

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?

Thanks in advance.



More information about the Interest mailing list