Accessibility Mac: Implement setting focus

[ChangeLog][QtGui][Accessibility] Allow assistive apps such as VoiceOver
to set the focus on widgets and controls.

Change-Id: I657bf7d827c5e5293cfd628dbb6b8f0592a84f24
Reviewed-by: Morten Johan Sørvig <morten.sorvig@digia.com>
bb10
Frederik Gladhorn 2014-03-18 10:52:41 +01:00 committed by The Qt Project
parent b8c96f2eb9
commit d9697df4e0
1 changed files with 8 additions and 2 deletions

View File

@ -268,7 +268,10 @@
- (BOOL)accessibilityIsAttributeSettable:(NSString *)attribute {
if ([attribute isEqualToString:NSAccessibilityFocusedAttribute]) {
return NO; // YES to handle keyboard input
QAccessibleInterface *iface = QAccessible::accessibleInterface(axid);
if (!iface)
return nil;
return iface->state().focusable ? YES : NO;
} else {
return NO;
}
@ -277,7 +280,10 @@
- (void)accessibilitySetValue:(id)value forAttribute:(NSString *)attribute {
Q_UNUSED(value);
if ([attribute isEqualToString:NSAccessibilityFocusedAttribute]) {
QAccessibleInterface *iface = QAccessible::accessibleInterface(axid);
if (!iface || !iface->actionInterface())
return;
iface->actionInterface()->doAction(QAccessibleActionInterface::setFocusAction());
}
}