diff options
author | Frederik Gladhorn <frederik.gladhorn@digia.com> | 2013-06-07 13:53:21 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-06-24 22:48:42 +0200 |
commit | 5e4627fb852d13b57659a0889a65a177206be2cc (patch) | |
tree | 9dbc94c7564f566102ca2ed00001e2abff0eb64b /src/plugins/platforms/cocoa/qcocoaaccessibility.mm | |
parent | 47ab2edd01787761e637e403d83b2094daa2722d (diff) |
Mac Accessibility: unify child functions
Both ways of getting the children are the same for
nsview and qcocoaaccessibleelement.
Factor out a function.
Change-Id: I4be091c6acde0de519a358f879c24eae04ec4c8d
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@digia.com>
Diffstat (limited to 'src/plugins/platforms/cocoa/qcocoaaccessibility.mm')
-rw-r--r-- | src/plugins/platforms/cocoa/qcocoaaccessibility.mm | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/plugins/platforms/cocoa/qcocoaaccessibility.mm b/src/plugins/platforms/cocoa/qcocoaaccessibility.mm index 2f9d828d8b..5649f3ad73 100644 --- a/src/plugins/platforms/cocoa/qcocoaaccessibility.mm +++ b/src/plugins/platforms/cocoa/qcocoaaccessibility.mm @@ -223,6 +223,26 @@ bool shouldBeIgnored(QAccessibleInterface *interface) return false; } +NSArray *unignoredChildren(id parentObject, QAccessibleInterface *interface) +{ + int numKids = interface->childCount(); + // qDebug() << "Children for: " << axid << iface << " are: " << numKids; + + NSMutableArray *kids = [NSMutableArray arrayWithCapacity:numKids]; + for (int i = 0; i < numKids; ++i) { + QAccessibleInterface *child = interface->child(i); + Q_ASSERT(child); + if (child->state().invalid || child->state().invisible) + continue; + + QAccessible::Id childId = QAccessible::uniqueId(child); + //qDebug() << " kid: " << childId << child; + QCocoaAccessibleElement *element = [QCocoaAccessibleElement createElementWithId:childId parent:parentObject]; + [kids addObject: element]; + [element release]; + } + return NSAccessibilityUnignoredChildren(kids); +} /* Translates a predefined QAccessibleActionInterface action to a Mac action constant. Returns 0 if the Qt Action has no mac equivalent. Ownership of the NSString is |