Congratulations to our 2022 Qt Champions!

Using QWindowSurface for a heads up display

  • Good morning,

    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.

    Any suggestions?

    • 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
    • Mingw-dtm


Log in to reply