CopperSpice API
1.9.2
|
The QAccessible class provides enums and static functions relating to accessibility. More...
Classes | |
class | State |
Structure which defines bit flags that indicate the state of an accessible object More... | |
Public Typedefs | |
using | Id = unsigned |
using | InterfaceFactory = QAccessibleInterface *(*)(const QString &key, QObject *) |
using | Relation = QFlags< RelationFlag > |
Public Types | |
enum | Event |
enum | InterfaceType |
enum | RelationFlag |
enum | Role |
enum | Text |
enum | TextBoundaryType |
Static Public Methods | |
static QAccessibleInterface * | accessibleInterface (Id uniqueId) |
static void | deleteAccessibleInterface (Id uniqueId) |
static void | installFactory (InterfaceFactory factory) |
static RootObjectHandler | installRootObjectHandler (RootObjectHandler handler) |
static bool | isActive () |
static QAccessibleInterface * | queryAccessibleInterface (QObject *object) |
static Id | registerAccessibleInterface (QAccessibleInterface *interfaceId) |
static void | removeFactory (InterfaceFactory factory) |
static void | setRootObject (QObject *object) |
static Id | uniqueId (QAccessibleInterface *interfaceId) |
static void | updateAccessibility (QAccessibleEvent *event) |
The QAccessible class provides enums and static functions relating to accessibility.
Accessible applications can be used by people who are not able to use applications by conventional means.
The functions in this class are used for communication between accessible applications (also called AT Servers) and accessibility tools (AT Clients), such as screen readers and braille displays. Clients and servers communicate in the following way:
The communication between servers and clients is initialized by the setRootObject() function. Function pointers can be installed to replace or extend the default behavior of the static functions in QAccessible.
CopperSpice supports Microsoft Active Accessibility (MSAA), Mac OS X Accessibility, and the Unix/X11 AT-SPI standard. Other backends can be supported using QAccessibleBridge.
In addition to QAccessible's static functions, CopperSpice offers one generic interface, QAccessibleInterface, that can be used to wrap all widgets and objects (e.g., QPushButton). This single interface provides all the metadata necessary for the assistive technologies. CopperSpice provides implementations of this interface for its built-in widgets as plugins.
When you develop custom widgets, you can create custom subclasses of QAccessibleInterface and distribute them as plugins (using QAccessiblePlugin) or compile them into the application. Likewise, the CopperSpice predefined accessibility support can be built as plugin (the default) or directly into the CopperSpice library. The main advantage of using plugins is the accessibility classes are only loaded into memory if they are actually used. They do not slow down the common case where no assistive technology is being used.
CopperSpice includes two classes, QAccessibleObject and QAccessibleWidget, which inherit from QAccessibleInterface and provide the lowest basic metadata. You can use these base classes when creating your custom QObject or QWidget subclasses.
This is a typedef for unsigned, used by the QAccessibleInterface cache.
This is a typedef for a pointer to a method with the following signature.
The call back function receives a QString and a QObject pointer, where the QString is the key identifying the interface. The QObject is passed to the QAccessibleInterface. If the key and the QObject do not have a corresponding QAccessibleInterface a null pointer will be returned.
Installed factories are called by queryAccessibleInterface() until one provides an interface.
Typedef for QFlags<RelationFlag> which contains an OR combination of RelationFlag values.
Refer to QAccessible::RelationFlag for the enum documentation.
enum QAccessible::Event |
This enum type defines accessible event types.
Constant | Value | Description |
---|---|---|
QAccessible::AcceleratorChanged | 0x80C0 | The keyboard accelerator for an action has been changed. |
QAccessible::ActionChanged | 0x0101 | An action has been changed. |
QAccessible::ActiveDescendantChanged | 0x0102 | |
QAccessible::Alert | 0x0002 | A system alert (e.g., a message from a QMessageBox) |
QAccessible::AttributeChanged | 0x0103 | |
QAccessible::ContextHelpEnd | 0x000D | Context help (QWhatsThis) for an object is finished. |
QAccessible::ContextHelpStart | 0x000C | Context help (QWhatsThis) for an object is initiated. |
QAccessible::DefaultActionChanged | 0x80B0 | The default QAccessible::Action for the accessible object has changed. |
QAccessible::DescriptionChanged | 0x800D | The object's QAccessible::Description changed. |
QAccessible::DialogEnd | 0x0011 | A dialog (QDialog) has been hidden |
QAccessible::DialogStart | 0x0010 | A dialog (QDialog) has been set visible. |
QAccessible::DocumentContentChanged | 0x0104 | The contents of a text document have changed. |
QAccessible::DocumentLoadComplete | 0x0105 | A document has been loaded. |
QAccessible::DocumentLoadStopped | 0x0106 | A document load has been stopped. |
QAccessible::DocumentReload | 0x0107 | A document reload has been initiated. |
QAccessible::DragDropEnd | 0x000F | A drag and drop operation is about to finished. |
QAccessible::DragDropStart | 0x000E | A drag and drop operation is about to be initiated. |
QAccessible::Focus | 0x8005 | An object has gained keyboard focus. |
QAccessible::ForegroundChanged | 0x0003 | A window has been activated (i.e., a new window has gained focus on the desktop). |
QAccessible::HelpChanged | 0x80A0 | The QAccessible::Help text property of an object has changed. |
QAccessible::HyperlinkEndIndexChanged | 0x0108 | The end position of the display text for a hypertext link has changed. |
QAccessible::HyperlinkNumberOfAnchorsChanged | 0x0109 | The number of anchors in a hypertext link has changed, perhaps because the display text has been split to provide more than one link. |
QAccessible::HyperlinkSelectedLinkChanged | 0x010A | The link for the selected hypertext link has changed. |
QAccessible::HyperlinkStartIndexChanged | 0x010D | The start position of the display text for a hypertext link has changed. |
QAccessible::HypertextChanged | 0x010E | The display text for a hypertext link has changed. |
QAccessible::HypertextLinkActivated | 0x010B | A hypertext link has been activated, perhaps by being clicked or via a key press. |
QAccessible::HypertextLinkSelected | 0x010C | A hypertext link has been selected. |
QAccessible::HypertextNLinksChanged | 0x010F | |
QAccessible::LocationChanged | 0x800B | An object's location on the screen has changed. |
QAccessible::MenuCommand | 0x0018 | A menu item is triggered. |
QAccessible::MenuEnd | 0x0005 | A menu has been closed (CopperSpice uses PopupMenuEnd for all menus). |
QAccessible::MenuStart | 0x0004 | A menu has been opened on the menubar (CopperSpice uses PopupMenuStart for all menus). |
QAccessible::NameChanged | 0x800C | The QAccessible::Name property of an object has changed. |
QAccessible::ObjectAttributeChanged | 0x0110 | |
QAccessible::ObjectCreated | 0x8000 | A new object is created. |
QAccessible::ObjectDestroyed | 0x8001 | An object is deleted. |
QAccessible::ObjectHide | 0x8003 | An object is hidden, for example with QWidget::hide(). |
QAccessible::ObjectReorder | 0x8004 | A layout or item view has added, removed, or moved an object (CopperSpice does not use this event). |
QAccessible::ObjectShow | 0x8002 | An object is displayed; for example, with QWidget::show(). |
QAccessible::PageChanged | 0x0111 | |
QAccessible::ParentChanged | 0x800F | An object's parent object changed. |
QAccessible::PopupMenuEnd | 0x0007 | A pop-up menu has closed. |
QAccessible::PopupMenuStart | 0x0006 | A pop-up menu has opened. |
QAccessible::ScrollingEnd | 0x0013 | A scrollbar scroll operation has ended (the mouse has released the slider handle). |
QAccessible::ScrollingStart | 0x0012 | A scrollbar scroll operation is about to start; this may be caused by a mouse press on the slider handle, for example. |
QAccessible::SectionChanged | 0x0112 | |
QAccessible::SelectionAdd | 0x8007 | An item has been added to the selection in an item view. |
QAccessible::SelectionRemove | 0x8008 | An item has been removed from an item view selection. |
QAccessible::Selection | 0x8006 | The selection has changed in a menu or item view. |
QAccessible::SelectionWithin | 0x8009 | Several changes to a selection has occurred in an item view. |
QAccessible::SoundPlayed | 0x0001 | A sound has been played by an object |
QAccessible::StateChanged | 0x800A | The QAccessible::State of an object has changed. |
QAccessible::TableCaptionChanged | 0x0113 | A table caption has been changed. |
QAccessible::TableColumnDescriptionChanged | 0x0114 | The description of a table column, typically found in the column's header, has been changed. |
QAccessible::TableColumnHeaderChanged | 0x0115 | A table column header has been changed. |
QAccessible::TableModelChanged | 0x0116 | The model providing data for a table has been changed. |
QAccessible::TableRowDescriptionChanged | 0x0117 | The description of a table row, typically found in the row's header, has been changed. |
QAccessible::TableRowHeaderChanged | 0x0118 | A table row header has been changed. |
QAccessible::TableSummaryChanged | 0x0119 | The summary of a table has been changed. |
QAccessible::TextAttributeChanged | 0x011A | |
QAccessible::TextCaretMoved | 0x011B | The caret has moved in an editable widget. The caret represents the cursor position in an editable widget with the input focus. |
QAccessible::TextColumnChanged | 0x011D | Text column has been changed. |
QAccessible::TextInserted | 0x011E | Text has been inserted into an editable widget. |
QAccessible::TextRemoved | 0x011F | Text has been removed from an editable widget. |
QAccessible::TextSelectionChanged | 0x0121 | The selected text has changed in an editable widget. |
QAccessible::TextUpdated | 0x0120 | Text has been update in an editable widget. |
QAccessible::ValueChanged | 0x800E | QAccessible::Value of an object has changed. |
QAccessible::VisibleDataChanged | 0x0122 |
The values for this enum are defined to be the same as those defined in the "AccessibleEventID.idl File Reference" (IAccessible2) and "Microsoft Active Accessibility Event Constants" (MSAA) specifications.
QAccessibleInterface supports several sub interfaces. In order to provide more information about some objects, their accessible representation should implement one or more of these interfaces. When subclassing one of these interfaces, QAccessibleInterface::interface_cast() needs to be implemented.
Constant | Value | Description |
---|---|---|
QAccessible::TextInterface | 0 | For text that supports selections or is more than one line. Simple labels do not need to implement this interface. For text that can be edited by the user. |
QAccessible::ValueInterface | 2 | For objects that are used to manipulate a value, for example slider or scroll bar. |
QAccessible::ActionInterface | 3 | For interactive objects that allow the user to trigger an action. Basically everything that allows for example mouse interaction. For objects that represent an image. This interface is generally less important. |
QAccessible::TableInterface | 5 | For lists, tables and trees. |
QAccessible::TableCellInterface | 6 | For cells in a TableInterface object. |
This enum defines the relationships between objects on the screen.
Constant | Value | Description |
---|---|---|
QAccessible::Label | 0x00000001 | First object is the label for the second object |
QAccessible::Labelled | 0x00000002 | Second object is the label for the first object |
QAccessible::Controller | 0x00000004 | First object controls the second object |
QAccessible::Controlled | 0x00000008 | Second object controls the first object |
QAccessible::AllRelations | 0xffffffff | Used as a mask to query for information about all relations |
enum QAccessible::Role |
This enum defines the role of an accessible object.
Constant | Value | Description |
---|---|---|
QAccessible::AlertMessage | 0x00000008 | An object that is used to alert the user. |
QAccessible::Animation | 0x00000036 | An object that displays an animation. |
QAccessible::Application | 0x0000000E | The application's main window. |
QAccessible::Assistant | 0x00000020 | An object that provides interactive help. |
QAccessible::Border | 0x00000013 | An object that represents a border. |
QAccessible::ButtonDropDown | 0x00000038 | A button that drops down a list of items. |
QAccessible::ButtonDropGrid | 0x0000003A | A button that drops down a grid. |
QAccessible::ButtonMenu | 0x00000039 | A button that drops down a menu. |
QAccessible::Canvas | 0x00000035 | An object that displays graphics that the user can interact with. |
QAccessible::Caret | 0x00000007 | An object that represents the system caret (text cursor). |
QAccessible::Cell | 0x0000001D | A cell in a table. |
QAccessible::Chart | 0x00000011 | An object that displays a graphical representation of data. |
QAccessible::CheckBox | 0x0000002C | An object that represents an option that can be checked or unchecked. Some options provide a "mixed" state, e.g. neither checked nor unchecked. |
QAccessible::Client | 0x0000000A | The client area in a window. |
QAccessible::Clock | 0x0000003D | A clock displaying time. |
QAccessible::Column | 0x0000001B | A column of cells, usually within a table. |
QAccessible::ColumnHeader | 0x00000019 | A header for a column of data. |
QAccessible::ComboBox | 0x0000002E | A list of choices that the user can select from. |
QAccessible::Cursor | 0x00000006 | An object that represents the mouse cursor. |
QAccessible::Desktop | 0x00000041 | The object represents the desktop or workspace. |
QAccessible::Dial | 0x00000031 | An object that represents a dial or knob. |
QAccessible::Dialog | 0x00000012 | A dialog box. |
QAccessible::Document | 0x0000000F | A document window, usually in an MDI environment. |
QAccessible::EditableText | 0x0000002A | Editable text |
QAccessible::Equation | 0x00000037 | An object that represents a mathematical equation. |
QAccessible::Graphic | 0x00000028 | A graphic or picture, e.g. an icon. |
QAccessible::Grip | 0x00000004 | A grip that the user can drag to change the size of widgets. |
QAccessible::Grouping | 0x00000014 | An object that represents a logical grouping of other objects. |
QAccessible::HelpBalloon | 0x0000001F | An object that displays help in a separate, short lived window. |
QAccessible::HotkeyField | 0x00000032 | A hotkey field that allows the user to enter a key sequence. |
QAccessible::Indicator | 0x00000027 | An indicator that represents a current value or item. |
QAccessible::LayeredPane | 0x0000003F | An object that can contain layered children, e.g. in a stack. |
QAccessible::Link | 0x0000001E | A link to something else. |
QAccessible::List | 0x00000021 | A list of items, from which the user can select one or more items. |
QAccessible::ListItem | 0x00000022 | An item in a list of items. |
QAccessible::MenuBar | 0x00000002 | A menu bar from which menus are opened by the user. |
QAccessible::MenuItem | 0x0000000C | An item in a menu or menu bar. |
QAccessible::NoRole | 0x00000000 | Object has no role. This usually indicates an invalid object. |
QAccessible::PageTab | 0x00000025 | A page tab that the user can select to switch to a different page in a dialog. |
QAccessible::PageTabList | 0x0000003C | A list of page tabs. |
QAccessible::Pane | 0x00000010 | A generic container. |
QAccessible::PopupMenu | 0x0000000B | A menu which lists options that the user can select to perform an action. |
QAccessible::ProgressBar | 0x00000030 | Object displays the progress of an operation in progress. |
QAccessible::PropertyPage | 0x00000026 | A property page where the user can change options and settings. |
QAccessible::PushButton | 0x0000002B | A button. |
QAccessible::RadioButton | 0x0000002D | An object that represents an option that is mutually exclusive with other options. |
QAccessible::Row | 0x0000001C | A row of cells, usually within a table. |
QAccessible::RowHeader | 0x0000001A | A header for a row of data. |
QAccessible::ScrollBar | 0x00000003 | A scroll bar, which allows the user to scroll the visible area. |
QAccessible::Separator | 0x00000015 | A separator that divides space into logical areas. |
QAccessible::Slider | 0x00000033 | A slider that allows the user to select a value within a given range. |
QAccessible::Sound | 0x00000005 | An object that represents a sound. |
QAccessible::SpinBox | 0x00000034 | A spin box widget that allows the user to enter a value within a given range. |
QAccessible::Splitter | 0x0000003E | A splitter distributing available space between its child widgets. |
QAccessible::StaticText | 0x00000029 | Static text, such as labels for other widgets. |
QAccessible::StatusBar | 0x00000017 | A status bar. |
QAccessible::Table | 0x00000018 | A table representing data in a grid of rows and columns. |
QAccessible::Terminal | 0x00000040 | A terminal or command line interface. |
QAccessible::TitleBar | 0x00000001 | The title bar caption of a window. |
QAccessible::ToolBar | 0x00000016 | A toolbar, which groups widgets that the user accesses frequently. |
QAccessible::ToolTip | 0x0000000D | A tool tip which provides information about other objects. |
QAccessible::Tree | 0x00000023 | A list of items in a tree structure. |
QAccessible::TreeItem | 0x00000024 | An item in a tree structure. |
QAccessible::UserRole | 0x0000ffff | The first value to be used for user defined roles. |
QAccessible::Whitespace | 0x0000003B | Blank space between other objects. |
QAccessible::Window | 0x00000009 | A top level window. |
enum QAccessible::Text |
This enum specifies string information that an accessible object returns.
Constant | Value | Description |
---|---|---|
QAccessible::Name | 0 | The name of the object, can be used both an identifier or a short description by accessible clients. |
QAccessible::Description | 1 | A short text describing the object. |
QAccessible::Value | 2 | The value of the object. |
QAccessible::Help | 3 | A longer text giving information about how to use the object. |
QAccessible::Accelerator | 4 | The keyboard shortcut that executes the object's default action. |
QAccessible::UserText | 0x0000ffff | The first value to be used for user defined text. |
This enum describes different types of text boundaries. It follows the IAccessible2 API and is used in the QAccessibleTextInterface.
Constant | Value | Description |
---|---|---|
QAccessible::CharBoundary | 0 | Use individual characters as boundary. |
QAccessible::WordBoundary | 1 | Use words as boundaries. |
QAccessible::SentenceBoundary | 2 | Use sentences as boundary. |
QAccessible::ParagraphBoundary | 3 | Use paragraphs as boundary. |
QAccessible::LineBoundary | 4 | Use newlines as boundary. |
QAccessible::NoBoundary | 5 | No boundary (use the whole text). |
|
static |
Returns the QAccessibleInterface belonging to the uniqueId. Returns nullptr if the id is invalid.
|
static |
Removes the interface belonging to this uniqueId from the cache and deletes it. The id becomes invalid and may be reused by the cache.
|
static |
Installs the InterfaceFactory factory. The last factory added is the first one used by queryAccessibleInterface().
|
static |
Installs the given handler as the function to be used by setRootObject(), and returns the previously installed handler.
|
static |
Returns true if an accessibility implementation has been requested during the runtime of the application, otherwise returns false. Use this method to prevent potentially expensive notifications via updateAccessibility().
|
static |
If a QAccessibleInterface implementation exists for the given object, this function returns a pointer to the implementation, otherwise it returns a nullptr.
The function calls all installed factory functions (from most recently installed to least recently installed) until one is found that provides an interface for the class of object. If no factory can provide an accessibility implementation for the class the function loads installed accessibility plugins, and tests if any of the plugins can provide the implementation.
If no implementation for the object's class is available, the function tries to find an implementation for the object's parent class, using the above strategy.
|
static |
Call this method to ensure manually created interfaces are properly memory managed.
Must only be called exactly once per interface interfaceId. This is implicitly called when calling queryAccessibleInterface, calling this method is only required when QAccessibleInterfaces are instantiated with the "new" operator. This is not recommended, whenever possible use the default methods and let queryAccessibleInterface() take care of this.
When it is necessary to reimplement QAccessibleInterface::child(), call this method before returning the new child.
|
static |
Removes factory from the list of installed InterfaceFactories.
|
static |
Sets the root accessible object of this application to object. All other accessible objects in the application can be reached by the client using object navigation.
You should never need to call this method. CopperSpice sets the QApplication object as the root object immediately before the event loop is entered in QApplication::exec(). Use QAccessible::installRootObjectHandler() to redirect the method to a customized handler function.
|
static |
Returns the unique ID for the QAccessibleInterface interfaceId.
|
static |
Notifies about a change which might be relevant for accessibility clients. The event provides details about the change. These include the source of the change and the nature of the change. The event should contain enough information to give meaningful notifications. For example, the type ValueChange indicates that the position of a slider has been changed.
Call this method whenever the state of your accessible object or one of its sub-elements has been changed either programmatically, by calling a method such as QLabel::setText(), or by user interaction.
If there are no accessibility tools listening to this event, the performance penalty for calling this method is small, but if determining the parameters of the call is expensive you can test isActive() to avoid unnecessary computations.