Accessibility Mac: Make value interface settable

This will let VoiceOver announce QLineEdit as editable text.
It also implements setting of values for value interfaces (eg sliders).

Task-number: QTBUG-38258

Change-Id: Ic30c10abc4dc0c4f3c5fe922ac5b0a4bbf4b1e5f
Reviewed-by: Jan Arve Sæther <jan-arve.saether@digia.com>
This commit is contained in:
Frederik Gladhorn 2014-04-10 14:57:29 +02:00 committed by The Qt Project
parent aa920e6274
commit 8abf98345a

View File

@ -359,6 +359,12 @@
if ([attribute isEqualToString:NSAccessibilityFocusedAttribute]) {
return iface->state().focusable ? YES : NO;
} else if ([attribute isEqualToString:NSAccessibilityValueAttribute]) {
if (iface->textInterface() && iface->state().editable)
return YES;
if (iface->valueInterface())
return YES;
return NO;
} else if ([attribute isEqualToString:NSAccessibilitySelectedTextRangeAttribute]) {
return iface->textInterface() ? YES : NO;
}
@ -372,6 +378,14 @@
if ([attribute isEqualToString:NSAccessibilityFocusedAttribute]) {
if (QAccessibleActionInterface *action = iface->actionInterface())
action->doAction(QAccessibleActionInterface::setFocusAction());
} else if ([attribute isEqualToString:NSAccessibilityValueAttribute]) {
if (iface->textInterface()) {
QString text = QString::fromNSString((NSString *)value);
iface->setText(QAccessible::Value, text);
} else if (QAccessibleValueInterface *valueIface = iface->valueInterface()) {
double val = [value doubleValue];
valueIface->setCurrentValue(val);
}
} else if ([attribute isEqualToString:NSAccessibilitySelectedTextRangeAttribute]) {
if (QAccessibleTextInterface *text = iface->textInterface()) {
NSRange range = [value rangeValue];