Accessibility Mac: Return textArea as role for multi line text.

Change-Id: I88eb4746463b7372c2dfe089ba74ea4cb0098396
Reviewed-by: Morten Johan Sørvig <morten.sorvig@digia.com>
Reviewed-by: Jan Arve Sæther <jan-arve.saether@digia.com>
This commit is contained in:
Frederik Gladhorn 2012-11-15 17:01:15 +01:00 committed by The Qt Project
parent 1dff3d1d83
commit a7647939f1
4 changed files with 8 additions and 5 deletions

View File

@ -77,7 +77,7 @@ namespace QCocoaAccessible {
demand.
*/
NSString *macRole(QAccessible::Role);
NSString *macRole(QAccessibleInterface *interface);
bool shouldBeIgnrored(QAccessibleInterface *interface);
NSString *getTranslatedAction(const QString &qtAction);
NSMutableArray *createTranslatedActionsList(const QStringList &qtActions);

View File

@ -149,8 +149,9 @@ static void populateRoleMap()
Returns a Mac accessibility role for the given interface, or
NSAccessibilityUnknownRole if no role mapping is found.
*/
NSString *macRole(QAccessible::Role qtRole)
NSString *macRole(QAccessibleInterface *interface)
{
QAccessible::Role qtRole = interface->role();
QMacAccessibiltyRoleMap &roleMap = *qMacAccessibiltyRoleMap();
if (roleMap.isEmpty())
@ -160,6 +161,8 @@ NSString *macRole(QAccessible::Role qtRole)
if (roleMap.contains(qtRole)) {
// MAC_ACCESSIBILTY_DEBUG() << "return" << roleMap[qtRole];
if (roleMap[qtRole] == NSAccessibilityTextFieldRole && interface->state().multiLine)
return NSAccessibilityTextAreaRole;
return roleMap[qtRole];
}
@ -190,7 +193,7 @@ bool shouldBeIgnrored(QAccessibleInterface *interface)
role == QAccessible::ToolBar) // Access the tool buttons directly.
return true;
NSString *mac_role = macRole(interface->role());
NSString *mac_role = macRole(interface);
if (mac_role == NSAccessibilityWindowRole || // We use the system-provided window elements.
mac_role == NSAccessibilityGroupRole ||
mac_role == NSAccessibilityUnknownRole)

View File

@ -59,7 +59,7 @@ static QAccessibleInterface *acast(void *ptr)
self = [super init];
if (self) {
accessibleInterface = anQAccessibleInterface;
role = QCocoaAccessible::macRole(acast(accessibleInterface)->role());
role = QCocoaAccessible::macRole(acast(accessibleInterface));
parent = aParent;
}

View File

@ -62,7 +62,7 @@
- (id)accessibilityAttributeValue:(NSString *)attribute {
if ([attribute isEqualToString:NSAccessibilityRoleAttribute]) {
if (m_accessibleRoot)
return QCocoaAccessible::macRole(m_accessibleRoot->role());
return QCocoaAccessible::macRole(m_accessibleRoot);
return NSAccessibilityUnknownRole;
} else if ([attribute isEqualToString:NSAccessibilityRoleDescriptionAttribute]) {
return NSAccessibilityRoleDescriptionForUIElement(self);