QAccessibleInterface Class

The QAccessibleInterface class defines an interface that exposes information about accessible objects. More...

Header: #include <QAccessibleInterface>
qmake: QT += gui
Inherited By:

QAccessibleObject

Public Functions

QAccessibleActionInterface *actionInterface()
virtual QColor backgroundColor() const
virtual QAccessibleInterface *child(int index) const = 0
virtual QAccessibleInterface *childAt(int x, int y) const = 0
virtual int childCount() const = 0
QAccessibleEditableTextInterface *editableTextInterface()
virtual QAccessibleInterface *focusChild() const
virtual QColor foregroundColor() const
QAccessibleImageInterface *imageInterface()
virtual int indexOfChild(const QAccessibleInterface *) const = 0
virtual void *interface_cast(QAccessible::InterfaceType)
virtual bool isValid() const = 0
virtual QObject *object() const = 0
virtual QAccessibleInterface *parent() const = 0
virtual QRect rect() const = 0
virtual QVector<QPair<QAccessibleInterface *, QAccessible::Relation> > relations(QAccessible::Relation match = QAccessible::AllRelations) const
virtual QAccessible::Role role() const = 0
virtual void setText(QAccessible::Text t, const QString &text) = 0
virtual QAccessible::State state() const = 0
QAccessibleTableCellInterface *tableCellInterface()
QAccessibleTableInterface *tableInterface()
virtual QString text(QAccessible::Text t) const = 0
QAccessibleTextInterface *textInterface()
QAccessibleValueInterface *valueInterface()
virtual QWindow *window() const

Protected Functions

Detailed Description

The QAccessibleInterface class defines an interface that exposes information about accessible objects.

This class is part of Accessibility for QWidget Applications.

Accessibility tools (also called AT Clients), such as screen readers or braille displays, require high-level information about accessible objects in an application. Accessible objects provide specialized input and output methods, making it possible for users to use accessibility tools with enabled applications (AT Servers).

Every element that the user needs to interact with or react to is an accessible object, and should provide this information. These are mainly visual objects, such as widgets and widget elements, but can also be content, such as sounds.

The AT client uses three basic concepts to acquire information about any accessible object in an application:

  • Properties The client can read information about accessible objects. In some cases the client can also modify these properties; such as text in a line edit.
  • Actions The client can invoke actions like pressing a button or .
  • Relationships and Navigation The client can traverse from one accessible object to another, using the relationships between objects.

The QAccessibleInterface defines the API for these three concepts.

Relationships and Navigation

The functions childCount() and indexOfChild() return the number of children of an accessible object and the index a child object has in its parent. The childAt() function returns a child QAccessibleInterface that is found at a position. The child does not have to be a direct child. This allows bypassing intermediate layers when the parent already knows the top-most child. childAt() is used for hit testing (finding the object under the mouse).

The relations() function provides information about the relations an object has to other objects, and parent() and child() allows traversing from one object to another object.

Properties

The central property of an accessible objects is what role() it has. Different objects can have the same role, e.g. both the "Add line" element in a scroll bar and the OK button in a dialog have the same role, "button". The role implies what kind of interaction the user can perform with the user interface element.

An object's state() property is a combination of different state flags and can describe both how the object's state differs from a "normal" state, e.g. it might be unavailable, and also how it behaves, e.g. it might be selectable.

The text() property provides textual information about the object. An object usually has a name, but can provide extended information such as a description, help text, or information about any keyboard accelerators it provides. Some objects allow changing the text() property through the setText() function, but this information is in most cases read-only.

The rect() property provides information about the geometry of an accessible object. This information is usually only available for visual objects.

Interfaces

To enable the user to interact with an accessible object the object must implement QAccessibleActionInterface in addition to QAccessibleInterface. Objects that support selections can define actions to change the selection.

There are several other interfaces that should be implemented as required. QAccessibleTextInterface should be used for bigger texts edits such as document views. This interface should not be implemented for labels/single line edits.

For sliders, scrollbars and other numerical value selectors QAccessibleValueInterface should be implemented.

Lists, tables and trees should implement QAccessibleTableInterface.

See also QAccessible, QAccessibleActionInterface, QAccessibleTextInterface, QAccessibleValueInterface, and QAccessibleTableInterface.

Member Function Documentation

[virtual protected] QAccessibleInterface::~QAccessibleInterface()

Destroys the QAccessibleInterface.

QAccessibleActionInterface *QAccessibleInterface::actionInterface()

[virtual] QColor QAccessibleInterface::backgroundColor() const

Returns the accessible's background color if applicable or an invalid QColor.

See also foregroundColor().

[pure virtual] QAccessibleInterface *QAccessibleInterface::child(int index) const

[pure virtual] QAccessibleInterface *QAccessibleInterface::childAt(int x, int y) const

[pure virtual] int QAccessibleInterface::childCount() const

QAccessibleEditableTextInterface *QAccessibleInterface::editableTextInterface()

[virtual] QAccessibleInterface *QAccessibleInterface::focusChild() const

Returns the object that has the keyboard focus.

The object returned can be any descendant, including itself.

[virtual] QColor QAccessibleInterface::foregroundColor() const

Returns the accessible's foreground color if applicable or an invalid QColor.

See also backgroundColor().

QAccessibleImageInterface *QAccessibleInterface::imageInterface()

[pure virtual] int QAccessibleInterface::indexOfChild(const QAccessibleInterface *) const

[virtual] void *QAccessibleInterface::interface_cast(QAccessible::InterfaceType)

[pure virtual] bool QAccessibleInterface::isValid() const

[pure virtual] QObject *QAccessibleInterface::object() const

[pure virtual] QAccessibleInterface *QAccessibleInterface::parent() const

[pure virtual] QRect QAccessibleInterface::rect() const

[virtual] QVector<QPair<QAccessibleInterface *, QAccessible::Relation> > QAccessibleInterface::relations(QAccessible::Relation match = QAccessible::AllRelations) const

Returns the meaningful relations to other widgets. Usually this will not return parent/child relations, unless they are handled in a specific way such as in tree views. It will typically return the labelled-by and label relations.

It is possible to filter the relations by using match. It should never return itself.

See also parent() and child().

[pure virtual] QAccessible::Role QAccessibleInterface::role() const

[pure virtual] void QAccessibleInterface::setText(QAccessible::Text t, const QString &text)

See also text().

[pure virtual] QAccessible::State QAccessibleInterface::state() const

QAccessibleTableCellInterface *QAccessibleInterface::tableCellInterface()

QAccessibleTableInterface *QAccessibleInterface::tableInterface()

[pure virtual] QString QAccessibleInterface::text(QAccessible::Text t) const

See also setText().

QAccessibleTextInterface *QAccessibleInterface::textInterface()

QAccessibleValueInterface *QAccessibleInterface::valueInterface()

[virtual] QWindow *QAccessibleInterface::window() const

Returns the window associated with the underlying object. For instance, QAccessibleWidget reimplements this and returns the windowHandle() of the QWidget.

It is used on some platforms to be able to notify the AT client about state changes. The backend will traverse up all ancestors until it finds a window. (This means that at least one interface among the ancestors should return a valid QWindow pointer).

The default implementation returns 0.