iOS: Always insert created a11y elements to the cache

By having all known a11y elements in the cache, the iOS Screen Reader will
stay up-to-date with the UI elements that are currently present.
Do ensure this behavior, the ctor is made private.

Fixes: QTBUG-126622
Pick-to: 6.8 6.7
Change-Id: I23452ffd60128889a49e5844a6fc17d45683cee5
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
This commit is contained in:
Jan Moeller 2024-06-24 12:29:28 +02:00
parent cc0937877f
commit 9a6c32bed1
2 changed files with 1 additions and 3 deletions

View File

@ -13,7 +13,6 @@
@property (readonly) QAccessible::Id axid;
- (instancetype)initWithId:(QAccessible::Id)anId withAccessibilityContainer:(id)view;
+ (instancetype)elementWithId:(QAccessible::Id)anId;
@end

View File

@ -13,9 +13,8 @@
if (!iface || iface->state().invisible || (iface->text(QAccessible::Name).isEmpty() && iface->text(QAccessible::Value).isEmpty() && iface->text(QAccessible::Description).isEmpty()))
return;
QAccessible::Id accessibleId = QAccessible::uniqueId(iface);
UIAccessibilityElement *elem = [[QT_MANGLE_NAMESPACE(QMacAccessibilityElement) alloc] initWithId:accessibleId withAccessibilityContainer:self];
UIAccessibilityElement *elem = [QT_MANGLE_NAMESPACE(QMacAccessibilityElement) elementWithId:accessibleId];
[m_accessibleElements addObject:elem];
[elem release];
}
- (void)createAccessibleContainer:(QAccessibleInterface *)iface