diff options
author | Michael Weghorn <[email protected]> | 2025-05-01 19:04:10 +0200 |
---|---|---|
committer | Volker Hilsheimer <[email protected]> | 2025-06-03 05:34:43 +0000 |
commit | 5e7891f73fb1ba33a08ac9bd3fbcdab01d8a1193 (patch) | |
tree | 78baa4fc19c7b5fb696c4da6341f51be331361f6 /src/widgets/styles/qstylepainter.cpp | |
parent | e0130876ba376faf681b80d4a7dbb20a5e3c3bdb (diff) |
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.10 6.9 6.8
Change-Id: I30316c59f8ad6fd018089a8dca8e7a8d1d92d7ec
Reviewed-by: Volker Hilsheimer <[email protected]>
Diffstat (limited to 'src/widgets/styles/qstylepainter.cpp')
0 files changed, 0 insertions, 0 deletions