How do I get the XCB connection (xcb_connection_t*
) for a given QWindow
in Qt5?
Right now I'm using QX11Info::connection()
to retrieve this pointer, but that depends on libQt5X11Extras.so
, which might not be available on every target system. Alternatively, I could use QPlatformNativeInterface::nativeResourceForWindow()
with "connection" as the first argument, but QPlatformNativeInterface
is non-stable and might change between minor Qt releases.
Background: I'm integrating a wgpu-based renderer in a Qt application and need the native handle of the QWindow (window ID and connection pointer) to create the swapchain surface. This is working so far, but I'd like to remove the dependency on libQt5X11Extras, if possible.