Accessibility Mac: implement min/max value

This commit fixes QProgressBar reading by VoiceOver.

Task-number: QTBUG-38272

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

View File

@ -168,6 +168,14 @@
// TODO: multi-selection: NSAccessibilitySelectedTextRangesAttribute,
}
if (iface->valueInterface()) {
[attributes addObjectsFromArray: [[NSArray alloc] initWithObjects:
NSAccessibilityMinValueAttribute,
NSAccessibilityMaxValueAttribute,
nil
]];
}
return [attributes autorelease];
}
@ -191,6 +199,19 @@
return [QCocoaAccessibleElement elementWithId: parentId];
}
- (id) minValueAttribute:(QAccessibleInterface*)iface {
if (QAccessibleValueInterface *val = iface->valueInterface())
return [NSNumber numberWithDouble: val->minimumValue().toDouble()];
return nil;
}
- (id) maxValueAttribute:(QAccessibleInterface*)iface {
if (QAccessibleValueInterface *val = iface->valueInterface())
return [NSNumber numberWithDouble: val->maximumValue().toDouble()];
return nil;
}
- (id)accessibilityAttributeValue:(NSString *)attribute {
QAccessibleInterface *iface = QAccessible::accessibleInterface(axid);
if (!iface) {
@ -272,6 +293,10 @@
return [NSNumber numberWithInt: textBeforeCursor.count(QLatin1Char('\n'))];
}
return nil;
} else if ([attribute isEqualToString:NSAccessibilityMinValueAttribute]) {
return [self minValueAttribute:iface];
} else if ([attribute isEqualToString:NSAccessibilityMaxValueAttribute]) {
return [self maxValueAttribute:iface];
}
return nil;