When sending an object:children-changed:add AT-SPI2 event, set the actual index of the child instead of always using the child count of its parent. If the new child were added at the end, its index would be "[child count] - 1", but the new child doesn't necessarily have to have been added at the end. Therefore, use the actual child index either already used as loop variable or retrieved via QAccessibleInterface::indexOfChild instead. The mismatch could e.g. be demonstrated with a simple pyatspi script when typing Enter in LibreOffice Writer to create new paragraphs. Script: #!/usr/bin/python3 import pyatspi def listener(e): if not e.host_application.name.startswith('soffice'): return print(e) print(f'index in parent set in event: {e.detail1}') print(f'index in parent reported by child: {e.any_data.get_index_in_parent()}') pyatspi.Registry.registerEventListener(listener, "object:children-changed:add") pyatspi.Registry.start() Sample output without this commit in place: object:children-changed:add(4, 0, [paragraph | ]) source: [document frame | Untitled 1 - LibreOfficeDev Document] host_application: [application | soffice.bin] sender: [application | soffice.bin] index in parent set in event: 4 index in parent reported by child: 2 Sample output with this commit in place: object:children-changed:add(2, 0, [paragraph | ]) source: [document frame | Untitled 1 - LibreOfficeDev Document] host_application: [application | soffice.bin] sender: [application | soffice.bin] index in parent set in event: 2 index in parent reported by child: 2 Pick-to: 6.8 Change-Id: I30316c59f8ad6fd018089a8dca8e7a8d1d92d7ec Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> (cherry picked from commit 5e7891f73fb1ba33a08ac9bd3fbcdab01d8a1193) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> (cherry picked from commit 33f8d0834320ffed5b5dd60fcc2fcfe378933d29)
…
Description
Languages
C++
84.3%
HTML
4.9%
C
3.9%
CMake
3.6%
Objective-C++
2%
Other
0.8%