QAccessible::setActive call VERY slow, hanging UI for many seconds - Qt5.15 / Windows10
-
Hi,
Our cross platform project has quite a complex interface. I'm finding that many basic operations like clicking on a button to open a Popup menu will cause the app to hang for many seconds. Running in a debugger, I'm pretty sure the culprit is this method
void QAccessible::setActive(bool active)
{
for (int i = 0; i < qAccessibleActivationObservers()->count() ;++i)
qAccessibleActivationObservers()->at(i)->accessibilityActiveChanged(active);
}qAccessibleActivationObservers()->count() here is around 1500 in our case, and it will take up to 10s to complete on my system. It seems to be walking around a parallel object tree that belongs to the QAccessible if I go a bit lower down. This is a bit baffling, because although our interface is quite heavy there aren't nearly this many Control/Text/Label/TextField items in there (I've checked by printing debug output on the object tree). As far as I can tell, Control/Text/Label/TextField items are the only ones that are 'activation observers' in the Accessible system.
The problem does not affect the Win11 or Linux builds for this project, though I'm not sure if it's the desktop set-up itself that is causing this. Also Qt6 on Win10 is fine (we are updating to 6.5 but it's a way off production yet). I have tried turning off all the Easy Access features on Win10 but the problem persists.
This is the first time I've encountered QAccessible after developing with Qt for many years. It seems like the public API does not let you disable or intervene in the mechanism, so I'm a bit stumped on how to resolve this. Also I don't understand how the Windows desktop settings affect what's going on in Qt, if at all. Any pointers or tips?
Many thanks,
Ted
-
I've managed to get to the bottom of this. We have extended the qml Text item with our own type and use it for building menus, labelling buttons and other widgets. It turns out this extended Text item has a ToolTip added in by us ... this must be a big no-no, because thanks to the heavy use of this Text item we instance 1500 text items and therefor 1500 of the ToolTips .... it's those tool tips that are registering somewhere in the QAccessible system (I think because they inherit PopUp, and I think on Windows a PopUp is a Window which make themselves known to QAccessible). This is killing the performance in that setActive method, I suppose 1500 hidden windows is probably a bit excessive!
(I realise I contradicted myself in the OP about the number of Text items, it turns out I wasn't counting them correctly in the first place.)
-