How to correctly apply WS_EX_NOREDIRECTIONBITMAP to a QWindow on Windows for transparency?
-
Hello everyone,
I'm working on a Qt application for Windows where I need to achieve high-performance per-pixel alpha transparency for a QWindow subclass that I'm rendering into using a custom Direct3D/DXGI setup (similar to approaches using QQuickRenderControl or direct rendering).
From my research (https://learn.microsoft.com/en-us/archive/msdn-magazine/2014/june/windows-with-c-high-performance-window-layering-using-the-windows-composition-engine), it seems essential for high-performance transparency via the Windows Composition Engine (DirectComposition) to create the underlying native window (HWND) without the default opaque redirection bitmap allocated by the DWM. This is typically done by including the WS_EX_NOREDIRECTIONBITMAP extended style when calling CreateWindowEx.
My challenge is applying this specific style when using a QWindow. Since Qt manages the creation of the native HWND internally, I'm unsure of the correct way to ensure WS_EX_NOREDIRECTIONBITMAP is present during the CreateWindowEx call made by Qt's Windows platform plugin.
Could anyone provide guidance on the recommended or correct way to apply WS_EX_NOREDIRECTIONBITMAP to a QWindow in a Qt application on Windows? Is there a specific Qt-provided API, a standard pattern for influencing native window creation parameters, or does it require a more involved platform-specific approach?
-
Hi,
From a quick look at the code, I would say that you'd need to build a custom windows platform plug-in to add that parameter.
That said, did you check the new QRhi classes ? They might provide something that fits your need.