Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Using QWindowSurface for a heads up display
jsprenkle last edited by
I'm implementing a heads up display (a "HUD") that's overlaid on a 3d rendered scene. I'd like to be able to display and interact with Qt widgets in the overlaid HUD. I need some advice/help to get moving again.
I've been able to create a bitmap that shared between a QImage and the 3d code. I can render controls to the bitmap using the render() method on the controls and they display nicely in the HUD. I have to manually manage and repaint these controls and there's no way to use a mouse to manipulate them.
My first attempt:
I created a custom QWindowSurface that renders to my shared bitmap. QImage is a valid QPaintDevice.
Then I create a tree of controls that use that surface. This doesn't seem to work.
The methods in the Surface are never called.
- I'd like to be able to send mouse events to these controls so I can drag them around on the HUD.
- I'd like them to manage their own repainting.
- I'd like something Qt 5 compatible as I probably will switch
- Might QGraphicsScene work for this? Can you add QWidgets to a QGraphicsScene?
- Qt 4.7