48 #include <private/qt_mac_p.h> 49 #include <private/qcocoaview_mac_p.h> 50 #include <private/qwidget_p.h> 53 #ifndef QT_NO_ACCESSIBILITY 55 #ifdef QT_MAC_USE_COCOA 61 #ifndef QT_NO_DEBUG_STREAM 62 #ifdef MAC_ACCESSIBILTY_DEVELOPER_MODE 63 #define MAC_ACCESSIBILTY_DEBUG QT_PREPEND_NAMESPACE(qDebug) 65 #define MAC_ACCESSIBILTY_DEBUG if (0) QT_PREPEND_NAMESPACE(qDebug) 68 #define MAC_ACCESSIBILTY_DEBUG if (0) QT_PREPEND_NAMESPACE(QNoDebug) 82 static void populateRoleMap()
84 QMacAccessibiltyRoleMap &roleMap = *qMacAccessibiltyRoleMap();
131 static NSString *macRoleForInterface(
QAInterface interface)
134 QMacAccessibiltyRoleMap &roleMap = *qMacAccessibiltyRoleMap();
136 if (roleMap.isEmpty())
139 MAC_ACCESSIBILTY_DEBUG() <<
"role for" << interface.
object() <<
"interface role" <<
hex << qtRole;
141 if (roleMap.contains(qtRole)) {
142 MAC_ACCESSIBILTY_DEBUG() <<
"return" << roleMap[qtRole];
143 return roleMap[qtRole];
146 MAC_ACCESSIBILTY_DEBUG() <<
"return NSAccessibilityUnknownRole";
147 return NSAccessibilityUnknownRole;
158 return (qobject_cast<QTabWidget *>(object->
parent()));
163 static bool isInterfaceIgnored(
QAInterface interface)
189 #ifndef MAC_ACCESSIBILTY_DEVELOPER_MODE 190 return [macRoleForInterface(interface) isEqualToString: NSAccessibilityUnknownRole];
198 @implementation QT_MANGLE_NAMESPACE(QCocoaView) (Accessibility)
200 - (BOOL)accessibilityIsIgnored
203 return isInterfaceIgnored(interface);
206 - (NSArray *)accessibilityAttributeNames
210 static NSArray *attributes = nil;
211 if (attributes == nil) {
212 attributes = [
super accessibilityAttributeNames];
218 - (id)accessibilityAttributeValue:(NSString *)attribute
220 MAC_ACCESSIBILTY_DEBUG() <<
"accessibilityAttributeValue" <<
self <<
227 if ([attribute isEqualToString:
@"AXRole"]) {
228 return macRoleForInterface(interface);
230 return [
super accessibilityAttributeValue:attribute];
236 #endif // QT_MAC_USE_COCOA 238 #endif // QT_NO_ACCESSIBILITY
const struct __CFString * CFStringRef
#define QT_END_NAMESPACE
This macro expands to.
static bool isEmbeddedTabBar(const QAInterface &interface)
Role
This enum defines the role of an accessible object.
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
The QString class provides a Unicode character string.
The QObject class is the base class of all Qt objects.
#define QT_BEGIN_NAMESPACE
This macro expands to.
#define Q_GLOBAL_STATIC(TYPE, NAME)
Declares a global static variable with the given type and name.
#define QT_PREPEND_NAMESPACE(name)
This macro qualifies identifier with the full namespace.
static QAccessibleInterface * queryAccessibleInterface(QObject *)
If a QAccessibleInterface implementation exists for the given object, this function returns a pointer...
#define QT_MANGLE_NAMESPACE(name)
QObject * parent() const
Returns a pointer to the parent object.
QTextStream & hex(QTextStream &stream)
Calls QTextStream::setIntegerBase(16) on stream and returns stream.
virtual const QMetaObject * metaObject() const
Returns a pointer to the meta-object of this object.
The QMap class is a template class that provides a skip-list-based dictionary.