Cocoa: Don’t cache accessibility role
The object role may in some cases (e.g. when using Qt Quick Loaders) be changed after construction, and we don’t have RoleChanged events. Change-Id: Idb246c1c1206221cacd93c83cbd07a0e3d98cb0e Fixes: QTBUG-72967 Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io> Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>bb10
parent
70b3e1fcc5
commit
64e8e69d25
|
|
@ -100,7 +100,6 @@ static void convertLineOffset(QAccessibleTextInterface *text, int *line, int *of
|
|||
}
|
||||
|
||||
@implementation QMacAccessibilityElement {
|
||||
NSString *role;
|
||||
QAccessible::Id axid;
|
||||
}
|
||||
|
||||
|
|
@ -110,9 +109,6 @@ static void convertLineOffset(QAccessibleTextInterface *text, int *line, int *of
|
|||
self = [super init];
|
||||
if (self) {
|
||||
axid = anId;
|
||||
QAccessibleInterface *iface = QAccessible::accessibleInterface(axid);
|
||||
Q_ASSERT(iface);
|
||||
role = QCocoaAccessible::macRole(iface);
|
||||
}
|
||||
|
||||
return self;
|
||||
|
|
@ -276,11 +272,12 @@ static void convertLineOffset(QAccessibleTextInterface *text, int *line, int *of
|
|||
}
|
||||
|
||||
if ([attribute isEqualToString:NSAccessibilityRoleAttribute]) {
|
||||
return role;
|
||||
return QCocoaAccessible::macRole(iface);
|
||||
} else if ([attribute isEqualToString:NSAccessibilitySubroleAttribute]) {
|
||||
return QCocoaAccessible::macSubrole(iface);
|
||||
} else if ([attribute isEqualToString:NSAccessibilityRoleDescriptionAttribute]) {
|
||||
return NSAccessibilityRoleDescription(role, [self accessibilityAttributeValue:NSAccessibilitySubroleAttribute]);
|
||||
return NSAccessibilityRoleDescription(QCocoaAccessible::macRole(iface),
|
||||
[self accessibilityAttributeValue:NSAccessibilitySubroleAttribute]);
|
||||
} else if ([attribute isEqualToString:NSAccessibilityChildrenAttribute]) {
|
||||
return QCocoaAccessible::unignoredChildren(iface);
|
||||
} else if ([attribute isEqualToString:NSAccessibilityFocusedAttribute]) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue