Qt 4.8
Classes | Functions
qaccessible_mac_p.h File Reference
#include <qglobal.h>
#include <private/qt_mac_p.h>
#include <qaccessible.h>
#include <qwidget.h>
#include <qdebug.h>

Go to the source code of this file.

Classes

class  QAccessibleHierarchyManager
 
class  QAccessibleInterfaceWrapper
 
class  QAElement
 
class  QAInterface
 
class  QInterfaceFactory
 

Functions

Q_AUTOTEST_EXPORT bool isItInteresting (const QAInterface &interface)
 
Q_AUTOTEST_EXPORT QDebug operator<< (QDebug debug, const QAInterface &interface)
 

Function Documentation

◆ isItInteresting()

Q_AUTOTEST_EXPORT bool isItInteresting ( const QAInterface interface)

Definition at line 631 of file qaccessible_mac.mm.

Referenced by QMultipleHIObjectFactory::registerChildren(), QAccessibleHierarchyManager::registerInterface(), and QAccessible::updateAccessibility().

632 {
633  // Mac accessibility does not have an attribute that corresponds to the Invisible/Offscreen
634  // state, so we disable the interface here.
635  const QAccessible::State state = interface.state();
636  if (state & QAccessible::Invisible ||
637  state & QAccessible::Offscreen )
638  return false;
639 
640  const QAccessible::Role role = interface.role();
641 
642  if (QObject * const object = interface.object()) {
643  const QString className = QLatin1String(object->metaObject()->className());
644 
645  // VoiceOver focusing on tool tips can be confusing. The contents of the
646  // tool tip is avalible through the description attribute anyway, so
647  // we disable accessibility for tool tips.
648  if (className == QLatin1String("QTipLabel"))
649  return false;
650 
651  // Hide TabBars that has a QTabWidget parent (the tab widget handles the accessibility)
652  if (isEmbeddedTabBar(interface))
653  return false;
654 
655  // Hide docked dockwidgets. ### causes infinitie loop in the apple accessibility code.
656  /* if (QDockWidget *dockWidget = qobject_cast<QDockWidget *>(object)) {
657  if (dockWidget->isFloating() == false)
658  return false;
659  }
660  */
661  }
662 
663  // Client is a generic role returned by plain QWidgets or other
664  // widgets that does not have separate QAccessible interface, such
665  // as the TabWidget. Return false unless macRole gives the interface
666  // a special role.
667  if (role == QAccessible::Client && macRole(interface) == CFStringRef(QAXUnknownRole))
668  return false;
669 
670  // Some roles are not interesting:
671  if (role == QAccessible::Border || // QFrame
672  role == QAccessible::Application || // We use the system-provided application element.
673  role == QAccessible::MenuItem) // The system also provides the menu items.
674  return false;
675 
676  // It is probably better to access the toolbar buttons directly than having
677  // to navigate through the toolbar.
678  if (role == QAccessible::ToolBar)
679  return false;
680 
681  return true;
682 }
const struct __CFString * CFStringRef
static bool isEmbeddedTabBar(const QAInterface &interface)
Role
This enum defines the role of an accessible object.
Definition: qaccessible.h:188
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
The QString class provides a Unicode character string.
Definition: qstring.h:83
The QObject class is the base class of all Qt objects.
Definition: qobject.h:111
const char * className
Definition: qwizard.cpp:137
#define QAXUnknownRole
State state() const
QObject * object() const
Role role() const
State
Definition: qaudio.h:59
static CFStringRef macRole(const QAInterface &interface)

◆ operator<<()

Q_AUTOTEST_EXPORT QDebug operator<< ( QDebug  debug,
const QAInterface interface 
)

Definition at line 397 of file qaccessible_mac.mm.

398 {
399  if (interface.isValid() == false)
400  debug << "invalid interface";
401  else
402  debug << interface.object() << "id" << interface.id() << "role" << hex << interface.role();
403  return debug;
404 }
bool isValid() const
QObject * object() const
Role role() const
int id() const
QTextStream & hex(QTextStream &stream)
Calls QTextStream::setIntegerBase(16) on stream and returns stream.