Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
How to render focus indicators in an offscreen window?
DrummerB last edited by
I'm trying to implement a custom user interface in virtual reality using Qt. I'm using QQuickRenderControl to render some UI defined in QML into an OpenGL framebuffer.
The resulting texture is drawn onto a quad in my custom OpenGL scene. Mouse events are simulated using the motion controllers.
This all works great, but I cannot render the UI in an "active" or "focused" style. For example, if I activate a text field, there is no cursor and no blue outline, because the offscreen window (a QQuickWindow) is not considered an active window. It's never actually shown on the desktop - it only exists in memory.
If I force the window to be shown on the desktop and make it the front window of the application, then the active text field is rendered correctly with the focus outline and the cursor within the VR scene. However, I would like to avoid having to show this window on the desktop (it renders as an empty white window).
Is there a way to force a QQuickWindow to render as if it was the front window, even if that's not the case? Thanks!