
We bake cookies in your browser for a better experience. Using this site means that you consent.Read More
TheQAccessibleInterface class defines an interface that exposes information about accessible objects.More...
| Header: | #include <QAccessibleInterface> |
| Inherits: | QAccessible |
| Inherited By: |
| virtual | ~QAccessibleInterface() |
| virtual QString | actionText(int action, Text t, int child) const = 0 |
| virtual int | childAt(int x, int y) const = 0 |
| virtual int | childCount() const = 0 |
| virtual bool | doAction(int action, int child, const QVariantList & params = QVariantList()) = 0 |
| virtual int | indexOfChild(const QAccessibleInterface * child) const = 0 |
| QVariant | invokeMethod(Method method, int child = 0, const QVariantList & params = QVariantList()) |
| virtual bool | isValid() const = 0 |
| virtual int | navigate(RelationFlag relation, int entry, QAccessibleInterface ** target) const = 0 |
| virtual QObject * | object() const = 0 |
| virtual QRect | rect(int child) const = 0 |
| virtual Relation | relationTo(int child, const QAccessibleInterface * other, int otherChild) const = 0 |
| virtual Role | role(int child) const = 0 |
| virtual void | setText(Text t, int child, const QString & text) = 0 |
| virtual State | state(int child) const = 0 |
| QSet<Method> | supportedMethods() |
| virtual QString | text(Text t, int child) const = 0 |
| virtual int | userActionCount(int child) const = 0 |
TheQAccessibleInterface 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:
TheQAccessibleInterface defines the API for these three concepts.
The functionschildCount() andindexOfChild() return the number of children of an accessible object and the index a child object has in its parent. ThechildAt() function returns the index of a child at a given position.
TherelationTo() function provides information about how two different objects relate to each other, andnavigate() allows traversing from one object to another object with a given relationship.
The central property of an accessible objects is whatrole() it has. Different objects can have the same role, e.g. both the "Add line" element in a scroll bar and theOK 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'sstate() 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.
Thetext() 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 thetext() property through thesetText() function, but this information is in most cases read-only.
Therect() property provides information about the geometry of an accessible object. This information is usually only available for visual objects.
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, andactionText() returns textual information about those actions.doAction() invokes an action.
Objects that support selections can define actions to change the selection.
AQAccessibleInterface provides information about the accessible object, and can also provide information for the children of that object if those children don't provide aQAccessibleInterface 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 oneQAccessibleInterface, 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 inQAccessibleInterface 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 alsoQAccessible.
[virtual]QAccessibleInterface::~QAccessibleInterface()Destroys the object.
[pure virtual]QString QAccessibleInterface::actionText(int action,Text t,int child) constReturns the text propertyt of the actionaction supported by the object, or of the object's child ifchild is not 0.
See alsotext() anduserActionCount().
[pure virtual]int QAccessibleInterface::childAt(int x,int y) constReturns the 1-based index of the child that contains the screen coordinates (x,y). This function returns 0 if the point is positioned on the object itself. If the tested point is outside the boundaries of the object this function returns -1.
This function is only relyable for visible objects (invisible object might not be laid out correctly).
All visual objects provide this information.
See alsorect().
[pure virtual]int QAccessibleInterface::childCount() constReturns the number of children that belong to this object. A child can provide accessibility information on its own (e.g. a child widget), or be a sub-element of this accessible object.
All objects provide this information.
See alsoindexOfChild().
[pure virtual]bool QAccessibleInterface::doAction(int action,int child, constQVariantList & params = QVariantList())Asks the object, or the object'schild ifchild is not 0, to executeaction using the parameters,params. Returns true if the action could be executed; otherwise returns false.
action can be a predefined or a custom action.
See alsouserActionCount() andactionText().
[pure virtual]int QAccessibleInterface::indexOfChild(constQAccessibleInterface * child) constReturns the 1-based index of the objectchild in this object's children list, or -1 ifchild is not a child of this object. 0 is not a possible return value.
All objects provide this information about their children.
See alsochildCount().
Invokes amethod onchild with the given parametersparams and returns the result of the operation asQVariant.
Note that the type of the returnedQVariant depends on the action.
Returns an invalidQVariant if the object doesn't support the action.
This function was introduced in Qt 4.2.
[pure virtual]bool QAccessibleInterface::isValid() constReturns true if all the data necessary to use this interface implementation is valid (e.g. all pointers are non-null); otherwise returns false.
See alsoobject().
[pure virtual]int QAccessibleInterface::navigate(RelationFlag relation,int entry,QAccessibleInterface ** target) constNavigates from this object to an object that has a relationshiprelation to this object, and returns the respective object intarget. It is the caller's responsibility to delete *target after use.
If an object is found,target is set to point to the object, and the index of the child oftarget is returned. The return value is 0 iftarget itself is the requested object.target is set to null if this object is the target object (i.e. the requested object is a handled by this object).
If no object is foundtarget is set to null, and the return value is -1.
Theentry parameter has two different meanings:
The following code demonstrates how to use this function to navigate to the first child of an object:
QAccessibleInterface*child=0;int targetChild= object->navigate(Accessible::Child,1,&child);if (child) {// ...delete child;}
Note that theDescendent value forrelation is not supported.
All objects support navigation.
See alsorelationTo() andchildCount().
[pure virtual]QObject * QAccessibleInterface::object() constReturns a pointer to theQObject this interface implementation provides information for.
See alsoisValid().
[pure virtual]QRect QAccessibleInterface::rect(int child) constReturns the geometry of the object, or of the object's child ifchild is not 0. 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 alsochildAt().
[pure virtual]Relation QAccessibleInterface::relationTo(int child, constQAccessibleInterface * other,int otherChild) constReturns the relationship between this object'schild and theother object'sotherChild. Ifchild is 0 the object's own relation is returned.
The returned value indicates the relation of the called object to theother object, e.g. if this object is a child ofother the return value will beChild.
The return value is a combination of the bit flags in theQAccessible::Relation enumeration.
All objects provide this information.
See alsoindexOfChild() andnavigate().
[pure virtual]Role QAccessibleInterface::role(int child) constReturns the role of the object, or of the object's child ifchild is not 0. The role of an object is usually static.
All accessible objects have a role.
[pure virtual]void QAccessibleInterface::setText(Text t,int child, constQString & text)Sets the text propertyt of the object, or of the object's child ifchild is not 0, totext.
Note that the text properties of most objects are read-only.
See alsotext().
[pure virtual]State QAccessibleInterface::state(int child) constReturns the current state of the object, or of the object's child ifchild is not 0. The returned value is a combination of the flags in theQAccessible::StateFlag enumeration.
All accessible objects have a state.
Returns aQSet ofMethods that are supported by this accessible interface.
This function was introduced in Qt 4.3.
See alsoQAccessible::Method andinvokeMethod().
[pure virtual]QString QAccessibleInterface::text(Text t,int child) constReturns the value of the text propertyt of the object, or of the object's child ifchild is not 0.
TheName 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'sDescription 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.
TheValue 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 don't, and some objects have a state that already is the value, e.g. toggle buttons.
TheHelp text provides information about the function and usage of an accessible object. Not all objects provide this information.
TheAccelerator 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 forName.
See alsosetText(),role(), andstate().
[pure virtual]int QAccessibleInterface::userActionCount(int child) constReturns the number of custom actions of the object, or of the object's child ifchild is not 0.
TheAction type enumerates predefined actions: these are not included in the returned value.
See alsoactionText() anddoAction().
© 2016 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of theGNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.