6
votes

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?

1
Did you find a solution?Stefan Fabian
Unfortunately no. I switched to Unreal since then.Jawap

1 Answers

2
votes
m_quickWindow->setX(-m_quickWindow->width());
m_quickWindow->setY(-m_quickWindow->height());
m_quickWindow->setFlag(Qt::SplashScreen);
m_quickWindow->show();

It's was okay for Qt 5.11

m_quickWindow->setOpacity(0.f);
m_quickWindow->setFlags(Qt::SplashScreen | Qt::WindowTransparentForInput);
m_quickWindow->show();

Better solution - okay for Qt 5.15

But it doesn't look good.