QAccessibleInterface 類

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

頭: #include <QAccessibleInterface>
qmake: QT += gui
繼承者: QAccessibleObject

公共函數

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
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 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

保護函數

virtual ~QAccessibleInterface ()

詳細描述

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

此類屬於 QWidget 應用程序的可訪問性 .

可訪問性工具 (也稱 AT 客戶端),譬如:屏幕閱讀器或盲文顯示,要求應用程序可訪問對象的有關高級信息。可訪問對象提供專用輸入/輸齣方法,使用戶在應用程序啓用時 (AT 服務器),能夠使用可訪問性工具。

用戶需要與之交互或作齣反應的每個元素都是可訪問對象,並應提供此信息。這些主要是視覺對象 (如:Widget 和 Widget 元素),但也可以是內容 (如:聲音)。

AT 客戶端使用 3 種基本概念,來獲取有關應用程序中任何可訪問對象的信息:

  • 特性 客戶端可以讀取可訪問對象的有關信息。在某些情況下,客戶端還可以修改這些屬性 (譬如:在行編輯中的文本)。
  • 動作 The client can invoke actions like pressing a button or.
  • 關係和導航 客戶端可以從一可訪問對象遍曆到另一可訪問對象,使用對象之間的關係。

The QAccessibleInterface defines the API for these three concepts.

關係和導航

函數 childCount () 和 indexOfChild () 返迴可訪問對象的子級數,及子級對象在其父級中的索引。 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 () 用於命中測試 (查找在鼠標下的對象)。

The relations () 函數提供對象與其它對象之間關係的有關信息,而 parent () 和 child () 允許從一個對象到另一個對象的遍曆。

特性

可訪問對象的中心特性是什麼 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.

對象的 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.

接口

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 .

另請參閱 QAccessible , QAccessibleActionInterface , QAccessibleTextInterface , QAccessibleValueInterface ,和 QAccessibleTableInterface .

成員函數文檔編製

[virtual protected] QAccessibleInterface:: ~QAccessibleInterface ()

銷毀 QAccessibleInterface .

QAccessibleActionInterface *QAccessibleInterface:: actionInterface ()

[虛擬] QColor QAccessibleInterface:: backgroundColor () const

返迴可訪問背景色若適用,或無效 QColor .

另請參閱 foregroundColor ().

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

返迴可訪問子級,采用索引 index . 0-based index. The number of children of an object can be checked with childCount .

返迴 nullptr when asking for an invalid child (e.g. when the child became invalid in the meantime).

另請參閱 childCount () 和 parent ().

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

返迴 QAccessibleInterface of a child that contains the screen coordinates ( x , y ). If there are no children at this position this function returns nullptr . The returned accessible must be a child, but not necessarily a direct child.

This function is only relyable for visible objects (invisible object might not be laid out correctly).

所有視覺對象提供此信息。

A default implementation is provided for objects inheriting QAccessibleObject . This will iterate over all children. If the widget manages its children (e.g. a table) it will be more efficient to write a specialized implementation.

另請參閱 rect ().

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

Returns 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.

所有對象提供此信息。

另請參閱 indexOfChild ().

[虛擬] QAccessibleInterface *QAccessibleInterface:: focusChild () const

返迴擁有鍵盤聚焦的對象。

返迴對象可以是任何後代,包括自身。

[虛擬] QColor QAccessibleInterface:: foregroundColor () const

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

另請參閱 backgroundColor ().

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

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.

另請參閱 childCount ().

[虛擬] void *QAccessibleInterface:: interface_cast ( QAccessible::InterfaceType type )

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 .

Qt 的 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);
}
					

另請參閱 QAccessible::InterfaceType , QAccessibleTextInterface , QAccessibleValueInterface , QAccessibleActionInterface , QAccessibleTableInterface ,和 QAccessibleTableCellInterface .

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

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

另請參閱 object ().

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

返迴指針指嚮 QObject 此接口實現用於提供信息。

另請參閱 isValid ().

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

返迴 QAccessibleInterface 在可訪問對象層次結構中的父級。

返迴 nullptr 若不存在父級 (如:對於頂層應用程序對象)。

另請參閱 child ().

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

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).

所有視覺對象提供此信息。

另請參閱 childAt ().

[虛擬] 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.

另請參閱 parent () 和 child ().

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

Returns the role of the object. The role of an object is usually static.

所有可訪問對象擁有角色。

另請參閱 text () 和 state ().

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

設置文本特性 t 的對象到 text .

Note that the text properties of most objects are read-only so calling this function might have no effect.

另請參閱 text ().

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

返迴對象的當前狀態。返迴值是 QAccessible::StateFlag 枚舉中標誌的組閤。

所有可訪問對象擁有狀態。

另請參閱 text () 和 role ().

QAccessibleTableCellInterface *QAccessibleInterface:: tableCellInterface ()

QAccessibleTableInterface *QAccessibleInterface:: tableInterface ()

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

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 don't, 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 .

另請參閱 setText (), role (),和 state ().

QAccessibleTextInterface *QAccessibleInterface:: textInterface ()

QAccessibleValueInterface *QAccessibleInterface:: valueInterface ()

[虛擬] QWindow *QAccessibleInterface:: window () const

返迴窗口關聯的底層對象。例如, QAccessibleWidget 重實現這並返迴 windowHandle() 為 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 指針)。

默認實現返迴 nullptr .