Feature request: Expose QApplication.nativeInterface

Phil Thompson phil at riverbankcomputing.com
Tue Aug 19 21:15:22 BST 2025


Yes but I'm obviously not going to provide wrappers for Wayland and XCB. 
How are you actually going to use the values?

Phil

On 19/08/2025 18:31, Zach Pearson wrote:
> In the Qt6 C++ documentation, QX11Application.connection() returns the
> X connection of the application (for XCB), and
> QWaylandApplication.display() returns the wl_display connection of the
> application.
> 
> (X11) https://doc.qt.io/qt-6/qnativeinterface-qx11application.html
> (Wayland) 
> https://doc.qt.io/qt-6/qnativeinterface-qwaylandapplication.html
> 
> — Zach
> 
>> On 19 Aug 2025, at 03:32, Phil Thompson <phil at riverbankcomputing.com> 
>> wrote:
>> 
>> On 18/08/2025 21:59, Zach Pearson wrote:
>>> Hello,
>>> I was experimenting with making a toy Vulkan renderer with Python
>>> bindings, but I hit a roadblock creating surfaces on Linux. On macOS
>>> or Windows, you only need your desired window’s window_id to create a
>>> surface on it. But when you go to generate Vulkan surfaces on Linux
>>> you have to pass in handles to the program’s connection to the
>>> windowing system, and you have to get those from
>>> QApplication.instance().nativeInterface(). Depending on whether 
>>> you’re
>>> using ‘wayland’ as your qt platform or ‘xcb’, you get back either
>>> QWaylandApplication or QX11Application, and then you can call
>>> display() or connection() respectively to get the data you need.
>>> On PySide6 using ‘xcb’ as the qt platform, you get a native interface
>>> back when you call QApplication.instance().nativeInterface(), though
>>> when using ‘wayland’ that call returns None (they plan to actually
>>> return QWaylandApplication in PySide6 6.10). On PyQt, I get an error
>>> ‘QApplication has no attribute nativeInterface’.
>>> Could you expose that attribute in a future release of PyQt6?
>> 
>> What would display() or connection() have to return to make them 
>> useful?
>> 
>> Phil


More information about the PyQt mailing list