Qt 5.11 replaced its legacy MSAA-based Windows accessibility backend with a new implementation based on UI Automation. This seems to be causing some issues with NVDA. I'm currently investigating the following bug report, which includes a detailed description of the issues, as well as a sample project to reproduce them:
https://bugreports.qt.io/browse/QTBUG-69472
While some of the issues may result from bugs in our implementation, some others may require updates in the NVDA side, which uses a custom app module for Qt applications, which may no longer apply since Qt 5.11.
I took a look at NVDA sources and saw that it supports MSAA and UI Automation, and has app modules that add custom behavior and fixes for many applications and frameworks, including Qt. The Qt app module in NVDA is based on MSAA/IAccessible, used in previous Qt versions. When used with a Qt 5.11 application, NVDA is recognizing that it supports UI Automation and using its UI Automation module.
However, this module seems to be lacking some functionality. For instance, the automatic detection of changes in text selection seems to have been disabled for some reason. The Qt framework is raising "UIA_Text_TextSelectionChangedEventId" notifications to inform UIA clients of changes in selection. However, NVDA seems to be purposely ignoring it (the mapping from UIA_Text_TextSelectionChangedEventId to the "caret" event is commented out in the _UIAHandler.py source). Also, NVDA's UIA module uses the "EditableTextWithoutAutoSelectDetection" class, instead of the "EditableTextWithAutoSelectDetection" used on the IAccessible module. I tried enabling the UIA_Text_TextSelectionChangedEventId mapping and changing the UIA module to use EditableTextWithAutoSelectDetection, and some of the compatibility issues reported, like NVDA failing to speak the mouse selection, or the lack of updates in the Braille display where fixed. However, I'm not familiar with the NVDA code, and that change will likely break other stuff.
I would suggest keeping the current custom app module in place for supporting Qt versions prior to 5.11 and using the UIA module for >= 5.11 (i.e. whenever UIA support is detected), while enabling the necessary features to make it work properly. I can help with changes on the Qt side.
Also, please instead of creating a new custom app module for Qt 5.11+ to work around bugs in our implementation or behavior unexpected for a proper UI Automation server, please report them to us so we can have them fixed on our side instead (you can assign bug reports to me).
Note: the new accessibility backend is a pure UI Automation implementation. Legacy MSAA clients are supported through the UIA-to-MSAA bridge provided by the MS UIA framework in the middle. However, the use of the bridge was broken in the initial 5.11 release, but will be fixed in 5.11.2 (the fix is already in our 5.11 branch, if you build Qt yourself). However, the use through the bridge does not provide all functionality that may be required. In particular, it does not provide IAccessible2 support, only IAccessible. Some features like caret movement detection are in IAccessible2, so I think a proper UI Automation interfacing is the way to go, instead of trying to use it in MSAA mode (also, even going through this legacy mode would also require changes in NVDA, as it detects the UI Automation support in Qt 5.11 and seems to ignore the MSAA-based app module).
Qt 5.11 replaced its legacy MSAA-based Windows accessibility backend with a new implementation based on UI Automation. This seems to be causing some issues with NVDA. I'm currently investigating the following bug report, which includes a detailed description of the issues, as well as a sample project to reproduce them:
https://bugreports.qt.io/browse/QTBUG-69472
While some of the issues may result from bugs in our implementation, some others may require updates in the NVDA side, which uses a custom app module for Qt applications, which may no longer apply since Qt 5.11.
I took a look at NVDA sources and saw that it supports MSAA and UI Automation, and has app modules that add custom behavior and fixes for many applications and frameworks, including Qt. The Qt app module in NVDA is based on MSAA/IAccessible, used in previous Qt versions. When used with a Qt 5.11 application, NVDA is recognizing that it supports UI Automation and using its UI Automation module.
However, this module seems to be lacking some functionality. For instance, the automatic detection of changes in text selection seems to have been disabled for some reason. The Qt framework is raising "UIA_Text_TextSelectionChangedEventId" notifications to inform UIA clients of changes in selection. However, NVDA seems to be purposely ignoring it (the mapping from UIA_Text_TextSelectionChangedEventId to the "caret" event is commented out in the _UIAHandler.py source). Also, NVDA's UIA module uses the "EditableTextWithoutAutoSelectDetection" class, instead of the "EditableTextWithAutoSelectDetection" used on the IAccessible module. I tried enabling the UIA_Text_TextSelectionChangedEventId mapping and changing the UIA module to use EditableTextWithAutoSelectDetection, and some of the compatibility issues reported, like NVDA failing to speak the mouse selection, or the lack of updates in the Braille display where fixed. However, I'm not familiar with the NVDA code, and that change will likely break other stuff.
I would suggest keeping the current custom app module in place for supporting Qt versions prior to 5.11 and using the UIA module for >= 5.11 (i.e. whenever UIA support is detected), while enabling the necessary features to make it work properly. I can help with changes on the Qt side.
Also, please instead of creating a new custom app module for Qt 5.11+ to work around bugs in our implementation or behavior unexpected for a proper UI Automation server, please report them to us so we can have them fixed on our side instead (you can assign bug reports to me).
Note: the new accessibility backend is a pure UI Automation implementation. Legacy MSAA clients are supported through the UIA-to-MSAA bridge provided by the MS UIA framework in the middle. However, the use of the bridge was broken in the initial 5.11 release, but will be fixed in 5.11.2 (the fix is already in our 5.11 branch, if you build Qt yourself). However, the use through the bridge does not provide all functionality that may be required. In particular, it does not provide IAccessible2 support, only IAccessible. Some features like caret movement detection are in IAccessible2, so I think a proper UI Automation interfacing is the way to go, instead of trying to use it in MSAA mode (also, even going through this legacy mode would also require changes in NVDA, as it detects the UI Automation support in Qt 5.11 and seems to ignore the MSAA-based app module).