CopperSpice API  1.7.2
QAccessibleInterface Class Referenceabstract

Defines an interface that exposes information about accessible objects. More...

Inheritance diagram for QAccessibleInterface:
QAccessibleObject QAccessibleWidget

Public Methods

QAccessibleActionInterfaceactionInterface ()
 
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
 
virtual QAccessibleInterface * focusChild () const
 
virtual QColor foregroundColor () const
 
virtual int indexOfChild (const QAccessibleInterface *child) const = 0
 
virtual void * interface_cast (QAccessible::InterfaceType type)
 
virtual bool isValid () const = 0
 
virtual QObjectobject () 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
 
QAccessibleTableCellInterfacetableCellInterface ()
 
QAccessibleTableInterfacetableInterface ()
 
virtual QString text (QAccessible::Text t) const = 0
 
QAccessibleTextInterfacetextInterface ()
 
QAccessibleValueInterfacevalueInterface ()
 
virtual QWindowwindow () const
 

Protected Methods

virtual ~QAccessibleInterface ()
 

Detailed Description

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

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 the index of a child at a given position.

The relationTo() function provides information about how two different objects relate to each other, and navigate() allows traversing from one object to another object with a given relationship.

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.

Actions and Selection

To enable the user to interact with an accessible object the object must expose information about the actions that it can perform. userActionCount() returns the number of actions supported by an accessible object, and actionText() returns textual information about those actions. doAction() invokes an action.

Objects that support selections can define actions to change the selection.

Objects and Children

A QAccessibleInterface provides information about the accessible object, and can also provide information for the children of that object if those children do not provide a QAccessibleInterface implementation themselves. This is practical if the object has many similar children (e.g. items in a list view), or if the children are an integral part of the object itself, for example, the different sections in a scroll bar.

If an accessible object provides information about its children through one QAccessibleInterface, the children are referenced using indexes. The index is 1-based for the children, i.e. 0 refers to the object itself, 1 to the first child, 2 to the second child, and so on.

All functions in QAccessibleInterface that take a child index relate to the object itself if the index is 0, or to the child specified. If a child provides its own interface implementation (which can be retrieved through navigation) asking the parent for information about that child will usually not succeed.

See also
QAccessible, QAccessibleActionInterface, QAccessibleTextInterface, QAccessibleValueInterface, QAccessibleTableInterface

Constructor & Destructor Documentation

QAccessibleInterface::~QAccessibleInterface ( )
protectedvirtual

Destroys the object.

Method Documentation

QAccessibleActionInterface * QAccessibleInterface::actionInterface ( )
inline

Returns a pointer to a QAccessibleActionInterface if one is available, otherwise returns a nullptr.

QColor QAccessibleInterface::backgroundColor ( ) const
virtual

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

See also
foregroundColor()
QAccessibleInterface * QAccessibleInterface::child ( int  index) const
pure virtual

Returns the accessible child with the given index. The number of children of an object can be checked with childCount. This method will returns a nullptr when asking for an invalid child.

See also
childCount(), parent()
QAccessibleInterface * QAccessibleInterface::childAt ( int  x,
int  y 
) const
pure virtual

Returns a pointer to the QAccessibleInterface of a child located at the screen coordinates x and y. If there are no children at this position this function returns a nullptr. The returned accessible must be a child but not necessarily a direct child.

This function is only valid for visible objects. An invisible object might not have a valid location.

A default implementation is provided for objects inheriting from a QAccessibleObject. The default implementation will iterate over all children. If the widget manages its children it will be more efficient to write a specialized implementation.

See also
rect()

Implemented in QAccessibleObject.

int QAccessibleInterface::childCount ( ) const
pure virtual

Returns the number of children which belong to this object. A child can provide accessibility information on its own or be a sub-element of this accessible object.

See also
indexOfChild()
QAccessibleInterface * QAccessibleInterface::focusChild ( ) const
virtual

Returns the object that has the keyboard focus. The object returned can be any descendant, including itself.

QColor QAccessibleInterface::foregroundColor ( ) const
virtual

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

See also
backgroundColor()
int QAccessibleInterface::indexOfChild ( const QAccessibleInterface *  child) const
pure virtual

Returns an "1 based" index of the object child in this object's list of children. Returns -1 if the given child is not a child of this object. The value of 0 is not a possible return value.

See also
childCount()

Returns the 0-based index of the object child in this object's children list, or -1 if child is not a child of this object. All objects provide this information about their children.

See also
childCount()
void * QAccessibleInterface::interface_cast ( QAccessible::InterfaceType  type)
inlinevirtual

Returns a specialized accessibility interface type from the generic QAccessibleInterface. This function must be reimplemented when providing more information about a widget or object through the specialized interfaces. For example a line edit should implement the QAccessibleTextInterface.

The QLineEdit for example has its accessibility support implemented in QAccessibleLineEdit.

void QAccessibleLineEdit::interface_cast(QAccessible::InterfaceType t) { if (t == QAccessible::TextInterface) { return static_cast<QAccessibleTextInterface>(this); }

return QAccessibleWidget::interface_cast(t); }

See also
QAccessible::InterfaceType, QAccessibleTextInterface, QAccessibleValueInterface, QAccessibleActionInterface, QAccessibleTableInterface, QAccessibleTableCellInterface
bool QAccessibleInterface::isValid ( ) const
pure virtual

Returns true if all the data necessary to use this interface implementation is valid (e.g. all pointers are non-null); otherwise returns false.

See also
object()

Implemented in QAccessibleObject.

QObject * QAccessibleInterface::object ( ) const
pure virtual

Returns a pointer to the QObject corresponding to this interface.

See also
isValid()

Implemented in QAccessibleObject.

QAccessibleInterface * QAccessibleInterface::parent ( ) const
pure virtual

Returns the QAccessibleInterface of the parent in the accessible object hierarchy. Returns a nullptr if no parent exists for the top level application object.

See also
child()
QRect QAccessibleInterface::rect ( ) const
pure virtual

Returns the geometry of the object. The geometry is in screen coordinates. This function is only reliable for visible objects (invisible objects might not be laid out correctly). All visual objects provide this information.

See also
childAt()

Implemented in QAccessibleObject.

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

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(), child()
QAccessible::Role QAccessibleInterface::role ( ) const
pure virtual

Returns the role of the object. The role of an object is usually static. All accessible objects have a role.

See also
text(), state()
void QAccessibleInterface::setText ( QAccessible::Text  t,
const QString text 
)
pure virtual

Sets the text property t of the object to text. The text properties of most objects are read-only so calling this function might have no effect.

See also
text()

Implemented in QAccessibleObject.

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

Returns the current state of the object. The returned value is a combination of the flags in the QAccessible::StateFlag enumeration.

All accessible objects have a state.

See also
text(), role()
QAccessibleTableCellInterface * QAccessibleInterface::tableCellInterface ( )
inline

Returns a pointer to a QAccessibleTableCellInterface if one is available, otherwise returns a nullptr.

QAccessibleTableInterface * QAccessibleInterface::tableInterface ( )
inline

Returns a pointer to a QAccessibleTableTableInterface if one is available, otherwise returns a nullptr.

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

Returns the value of the text property t of the object.

The QAccessible::Name is a string used by clients to identify, find, or announce an accessible object for the user. All objects must have a name that is unique within their container. The name can be used differently by clients, so the name should both give a short description of the object and be unique.

An accessible object's QAccessible::Description provides textual information about an object's visual appearance. The description is primarily used to provide greater context for vision-impaired users, but is also used for context searching or other applications. Not all objects have a description. An "OK" button would not need a description, but a tool button that shows a picture of a smiley would.

The QAccessible::Value of an accessible object represents visual information contained by the object, e.g. the text in a line edit. Usually, the value can be modified by the user. Not all objects have a value, e.g. static text labels do not, and some objects have a state that already is the value, e.g. toggle buttons.

The QAccessible::Help text provides information about the function and usage of an accessible object. Not all objects provide this information.

The QAccessible::Accelerator is a keyboard shortcut that activates the object's default action. A keyboard shortcut is the underlined character in the text of a menu, menu item or widget, and is either the character itself, or a combination of this character and a modifier key like Alt, Ctrl or Shift. Command controls like tool buttons also have shortcut keys and usually display them in their tooltip.

All objects provide a string for QAccessible::Name.e.

See also
setText(), role(), state()
QAccessibleTextInterface * QAccessibleInterface::textInterface ( )
inline

Pending documentation.

QAccessibleValueInterface * QAccessibleInterface::valueInterface ( )
inline

Pending documentation.

QWindow * QAccessibleInterface::window ( ) const
virtual

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 a nullptr.