内容表

上一话题

QAbstractTextDocumentLayout

下一话题

QAccessibleEditableTextInterface

QAccessible

QAccessible class provides enums and static functions related to accessibility. 更多

Inheritance diagram of PySide2.QtGui.QAccessible

概要

静态函数

详细描述

This class is part of Accessibility for QWidget Applications.

可访问应用程序可以由不能通过常规方式,使用应用程序的人使用。

此类中的函数被用于可访问应用程序 (也称 AT 服务器) 和可访问工具 (AT 客户机) (如屏幕阅读器和盲文显示) 之间的通信。客户端和服务器采有以下办法通信:

服务器和客户端之间的通信被初始化,通过 setRootObject() function. Function pointers can be installed to replace or extend the default behavior of the static functions in QAccessible .

Qt 支持 MSAA (微软活动可访问性)、macOS 可访问性和 Unix/X11 AT-SPI 标准。使用 QAccessibleBridge 可以支持其它后端。

在 Unix/X11 AT-SPI 实现中,应用程序变为可访问当满足 2 条件时:

  • org.a11y.Status.IsEnabled DBus 特性为 true

  • org.a11y.Status.ScreenReaderEnabled DBus 特性为 true

设置 DBus AT-SPI 特性的替代是设置 QT_LINUX_ACCESSIBILITY_ALWAYS_ON 环境变量。

除了 QAccessible ‘s static functions, Qt offers one generic interface, QAccessibleInterface ,可用于包裹所有 Widget 和对象 (如 QPushButton )。此单一接口为辅助技术,提供所有必要元数据。Qt 为内置 Widget 作为插件提供此接口的实现。

当开发自定义 Widget 时,可以创建自定义子类为 QAccessibleInterface 并将它们分发作为插件 (使用 QAccessiblePlugin ) or compile them into the application. Likewise, Qt’s predefined accessibility support can be built as plugin (the default) or directly into the Qt library. The main advantage of using plugins is that the accessibility classes are only loaded into memory if they are actually used; they don’t slow down the common case where no assistive technology is being used.

Qt 还包括 2 方便类: QAccessibleObject and QAccessibleWidget ,继承自 QAccessibleInterface 并提供最小元数据公分母 (如:Widget 几何图形、窗口标题、基本帮助文本)。可以把它们用作基类,当包裹自定义 QObject or QWidget 子类。

PySide2.QtGui.QAccessible. Event

此枚举类型定义可访问事件类型。

常量

描述

QAccessible.AcceleratorChanged

动作的键盘加速键已改变。

QAccessible.ActionChanged

动作已改变。

QAccessible.ActiveDescendantChanged

QAccessible.Alert

系统警报 (如:消息来自 QMessageBox )

QAccessible.AttributeChanged

QAccessible.ContextHelpEnd

上下文帮助 ( QWhatsThis ) 对于已完成对象而言。

QAccessible.ContextHelpStart

上下文帮助 ( QWhatsThis ) 对于已初始对象而言。

QAccessible.DefaultActionChanged

可访问对象的默认 QAccessible::Action 已改变。

QAccessible.DescriptionChanged

The object’s 描述 改变。

QAccessible.DialogEnd

对话框 ( QDialog ) 已被隐藏

QAccessible.DialogStart

对话框 ( QDialog ) 已被设为可见。

QAccessible.DocumentContentChanged

文本文档的内容已改变。

QAccessible.DocumentLoadComplete

文档已加载。

QAccessible.DocumentLoadStopped

文档加载已停止。

QAccessible.DocumentReload

文档重新加载已初始。

QAccessible.DragDropEnd

拖放操作即将完成。

QAccessible.DragDropStart

拖放操作即将被初始。

QAccessible.Focus

对象已获得键盘聚焦。

QAccessible.ForegroundChanged

窗口已被激活 (即:新窗口已获得桌面聚焦)。

QAccessible.HelpChanged

Help 对象的文本特性已改变。

QAccessible.HyperlinkEndIndexChanged

超文本链接的显示文本的结束位置已改变。

QAccessible.HyperlinkNumberOfAnchorsChanged

超文本链接中的锚点数已变化,或许因为显示文本已被拆分以提供多个链接。

QAccessible.HyperlinkSelectedLinkChanged

选中的超文本链接的链接已改变。

QAccessible.HyperlinkStartIndexChanged

超文本链接的显示文本的起始位置已改变。

QAccessible.HypertextChanged

用于超文本链接的显示文本已改变。

QAccessible.HypertextLinkActivated

超文本链接已被激活,或许是通过单击或凭借键按下。

QAccessible.HypertextLinkSelected

超文本链接已被选中。

QAccessible.HypertextNLinksChanged

QAccessible.LocationChanged

An object’s location on the screen has changed.

QAccessible.MenuCommand

菜单项被触发。

QAccessible.MenuEnd

A menu has been closed (Qt uses for all menus).

QAccessible.MenuStart

A menu has been opened on the menubar (Qt uses for all menus).

QAccessible.NameChanged

Name 对象的特性已改变。

QAccessible.ObjectAttributeChanged

QAccessible.ObjectCreated

新对象被创建。

QAccessible.ObjectDestroyed

对象被删除。

QAccessible.ObjectHide

对象被隐藏;例如,采用 hide() . Any children the object that is hidden has do not send this event. It is not sent when an object is hidden as it is being obcured by others.

QAccessible.ObjectReorder

布局或项视图已添加、移除或移动对象 (Qt 不使用此事件)。

QAccessible.ObjectShow

对象被显示;例如,采用 show() .

QAccessible.PageChanged

QAccessible.ParentChanged

An object’s parent object changed.

QAccessible.PopupMenuEnd

弹出菜单已关闭。

QAccessible.PopupMenuStart

弹出菜单已打开。

QAccessible.ScrollingEnd

滚动条卷动操作已结束 (鼠标已释放滑块手柄)。

QAccessible.ScrollingStart

滚动条卷动操作即将开始;例如,这可能是由鼠标在滑块上按下而引起。

QAccessible.SectionChanged

QAccessible.SelectionAdd

项已被添加到项视图选定中。

QAccessible.SelectionRemove

项已从项视图选定中被移除。

QAccessible.Selection

在菜单或项视图中的选定已改变。

QAccessible.SelectionWithin

项视图中的选定已有几处改变。

QAccessible.SoundPlayed

声音已由对象播放

QAccessible.TableCaptionChanged

表格标题已改变。

QAccessible.TableColumnDescriptionChanged

The description of a table column, typically found in the column’s header, has been changed.

QAccessible.TableColumnHeaderChanged

表格列标题已改变。

QAccessible.TableRowDescriptionChanged

The description of a table row, typically found in the row’s header, has been changed.

QAccessible.TableRowHeaderChanged

表格行标题已改变。

QAccessible.TableSummaryChanged

表格摘要已改变。

QAccessible.TextColumnChanged

文本列已改变。

QAccessible.VisibleDataChanged

The values for this enum are defined to be the same as those defined in the IAccessible2 and MSAA specifications.

PySide2.QtGui.QAccessible. Role

此枚举定义可访问对象的角色。角色包括:

常量

描述

QAccessible.AlertMessage

用于提醒用户的对象。

QAccessible.Animation

显示动画的对象。

QAccessible.Application

The application’s main window.

QAccessible.Assistant

提供交互帮助的对象。

QAccessible.Border

表示边框的对象。

QAccessible.ButtonDropDown

下拉项列表的按钮。

QAccessible.ButtonDropGrid

下拉栅格的按钮。

QAccessible.ButtonMenu

下拉菜单的按钮。

QAccessible.Canvas

用户可以与之交互,显示图形的对象。

QAccessible.Caret

表示系统插入符号 (文本光标) 的对象。

QAccessible.Cell

表格中的单元格。

QAccessible.Chart

显示数据图形表示的对象。

QAccessible.CheckBox

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

在窗口中的客户端区域。

QAccessible.Clock

显示时间的时钟。

QAccessible.ColorChooser

让用户选择颜色的对话框。

QAccessible.Column

单元格的列,通常在表格中。

QAccessible.ColumnHeader

用于数据列的 Header 头。

QAccessible.ComboBox

用户可以从其中选择的抉择列表。

QAccessible.ComplementaryContent

与主要内容互补的文档或网页的一部分,通常是地标 (见 WAI-ARIA)。

QAccessible.Cursor

表示鼠标光标的对象。

QAccessible.Desktop

表示桌面或工作空间的对象。

QAccessible.Dial

表示表盘或旋钮的对象。

QAccessible.Dialog

对话框。

QAccessible.Document

文档 (例如:在办公应用程序中)。

QAccessible.EditableText

可编辑的文本 (譬如:行编辑或文本编辑)。

QAccessible.Equation

数学方程式表示对象。

QAccessible.Footer

在页面中的页脚 (通常在文档中)。

QAccessible.Form

包含控件的 Web 表单。

QAccessible.Graphic

图形或图片 (如:图标)。

QAccessible.Grip

用户可以拖曳能改变 Widget 大小的握把。

QAccessible.Grouping

表示其它对象逻辑分组的对象。

QAccessible.Heading

文档中的标题。

QAccessible.HelpBalloon

在单独短期窗口中显示帮助的对象。

QAccessible.HotkeyField

允许用户键入键序列的热键字段。

QAccessible.Indicator

表示当前值或项的指示器。

QAccessible.LayeredPane

可以包含分层子级的对象 (如:在堆栈中)。

QAccessible.Link

指向其它内容的链接。

QAccessible.List

用户可从中选择一项或多项的项列表。

QAccessible.ListItem

在项列表中的项。

QAccessible.MenuBar

用户从中打开菜单的菜单栏。

QAccessible.MenuItem

在菜单或菜单栏中的项。

QAccessible.NoRole

对象没有角色。这通常指示无效对象。

QAccessible.Note

其内容在括号内或辅助资源的主要内容的区间。

QAccessible.Notification

通知表示对象 (如:在系统托盘中)。此角色仅在 Linux 起作用。

QAccessible.PageTab

用户可以在对话框中选择切换到不同页面的页面选项卡。

QAccessible.PageTabList

页面选项卡列表。

QAccessible.Paragraph

文本段落 (通常在文档中找到)。

QAccessible.Pane

通用容器。

QAccessible.PopupMenu

列表用户可以选择履行动作的选项的菜单。

QAccessible.ProgressBar

正在进行中操作进度的显示对象。

QAccessible.PropertyPage

用户可以在其中改变选项、设置的特性页面。

QAccessible.Button

按钮。

QAccessible.RadioButton

与其它选项相互排斥的选项的表示对象。

QAccessible.Row

单元格行 (通常在表格中)。

QAccessible.RowHeader

用于数据行的 Header 头。

QAccessible.ScrollBar

允许用户滚动可见区域的滚动条。

QAccessible.Section

章节 (在文档中)。

QAccessible.Separator

将空间划分成逻辑区域的分隔符。

QAccessible.Slider

允许用户选择给定范围值的滑块。

QAccessible.Sound

表示声音的对象。

QAccessible.SpinBox

允许用户录入给定范围值的自旋框 Widget。

QAccessible.Splitter

在其子级 Widget 之间分配可用空间的分割器。

QAccessible.StaticText

静态文本 (譬如:其它 Widget 的标签)。

QAccessible.StatusBar

状态栏。

QAccessible.Table

以行、列栅格表示数据的表格。

QAccessible.Terminal

终端或命令行接口。

QAccessible.TitleBar

窗口的标题栏标题。

QAccessible.ToolBar

用于分组用户频繁访问 Widget 的工具栏。

QAccessible.ToolTip

提供其它对象有关信息的工具提示。

QAccessible.Tree

树结构中的项列表。

QAccessible.TreeItem

树结构中的项。

QAccessible.UserRole

要使用的第一值 (对于用户定义角色而言)。

QAccessible.WebDocument

HTML 文档,通常在浏览器中。

QAccessible.Whitespace

在其它对象之间的空白空间。

QAccessible.Window

顶层窗口。

PySide2.QtGui.QAccessible. 文本

此枚举指定可访问对象返回的字符串信息。

常量

描述

QAccessible.Name

对象的名称。这可以用作标识符或短描述通过可访问客户端。

QAccessible.Description

描述对象的短文字。

QAccessible.Value

对象的值。

QAccessible.Help

给出如何使用对象的有关信息的更长文本。

QAccessible.Accelerator

The keyboard shortcut that executes the object’s default action.

QAccessible.UserText

用于用户定义文本的第一值。

PySide2.QtGui.QAccessible. RelationFlag

此枚举类型定义可以组合以指示 2 可访问对象间关系的位标志。

常量

描述

QAccessible.Label

第 1 个对象是第 2 个对象的标签。

QAccessible.Labelled

第 1 个对象被第 2 个对象所标签化。

QAccessible.Controller

第 1 个对象控制第 2 个对象。

QAccessible.Controlled

第 1 个对象被第 2 个对象所控制。

QAccessible.AllRelations

用作掩码以指定对所有关系的有关信息感兴趣

Relations() 的实现返回这些标志的组合。某些值相互排斥。

PySide2.QtGui.QAccessible. InterfaceType

QAccessibleInterface 支持几个子接口。为提供有关某些对象的更多信息,它们的可访问表示应实现这些接口中一个或多个。

注意

当子类化这些接口之一时, interface_cast() needs to be implemented.

常量

描述

QAccessible.TextInterface

对于支持选定或多于一行的文本而言。简单标签不需要实现此接口。

QAccessible.ValueInterface

对于用来操纵值的对象而言 (例如:滑块或滚动条)。

QAccessible.ActionInterface

对于允许用户触发动作的交互对象而言。基本上所有东西都允许 (例如:鼠标交互)。

QAccessible.TableInterface

对于列表、表格和树而言。

QAccessible.TableCellInterface

For cells in a object.

PySide2.QtGui.QAccessible. TextBoundaryType

此枚举描述文本边界的不同类型。它遵循 IAccessible2 API 并用于 QAccessibleTextInterface .

常量

描述

QAccessible.CharBoundary

使用单个字符作为边界。

QAccessible.WordBoundary

使用单词作为边界。

QAccessible.SentenceBoundary

使用句子作为边界。

QAccessible.ParagraphBoundary

使用段落作为边界。

QAccessible.LineBoundary

使用换行符作为边界。

QAccessible.NoBoundary

无边界 (使用整个文本)。

static PySide2.QtGui.QAccessible. accessibleInterface ( uniqueId )
参数

uniqueId – long

返回类型

QAccessibleInterface

返回 QAccessibleInterface 属于 id .

返回 None 若 ID 无效。

static PySide2.QtGui.QAccessible. cleanup ( )
static PySide2.QtGui.QAccessible. deleteAccessibleInterface ( uniqueId )
参数

uniqueId – long

移除接口属于此 id 来自缓存且删除它。ID 变为无效,通过缓存可重用。

static PySide2.QtGui.QAccessible. isActive ( )
返回类型

bool

返回 true 若平台请求可访问性信息。

此函数将返回 false,直到工具 (譬如:屏幕阅读器) 访问可访问性框架。仍可能使用 queryAccessibleInterface() even if accessibility is not active. But there will be no notifications sent to the platform.

推荐使用此函数来阻止昂贵通知凭借 updateAccessibility() when they are not needed.

static PySide2.QtGui.QAccessible. qAccessibleTextBoundaryHelper ( cursor , boundaryType )
参数
返回类型

getBoundaries is a helper function to find the accessible text boundaries for QTextCursor based documents. documentCursor a valid cursor bound to the document (not null). It needs to ba at the position to look for the boundary boundaryType the type of boundary to find Returns the boundaries as pair

static PySide2.QtGui.QAccessible. queryAccessibleInterface ( arg__1 )
参数

arg__1 QObject

返回类型

QAccessibleInterface

QAccessibleInterface 实现存在为给定 object ,此函数返回指向实现的指针;否则返回 None .

函数调用所有已安装工厂函数 (从最近安装到至少最近安装),直到找到某一提供接口,对于类 object 。若没有工厂可以为类提供可访问性实现,函数将加载已安装的可访问性插件,并测试是否有任何插件可以提供实现。

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 PySide2.QtGui.QAccessible. registerAccessibleInterface ( iface )
参数

iface QAccessibleInterface

返回类型

long

调用此函数,以确保手动创建接口正确管理内存。

必须只准确调用一次,对于每接口 iface 。这是隐式调用当调用 queryAccessibleInterface , calling this function is only required when QAccessibleInterfaces are instantiated with the “new” operator. This is not recommended, whenever possible use the default functions and let queryAccessibleInterface() take care of this.

当有必要重实现 child() function and returning the child after constructing it, this function needs to be called.

static PySide2.QtGui.QAccessible. setActive ( active )
参数

active bool

另请参阅

isActive()

static PySide2.QtGui.QAccessible. setRootObject ( object )
参数

object QObject

将此应用程序可访问对象的根对象设为 object 。可以到达所有其它可访问对象,使用来自根对象的对象导航。

Normally, it isn’t necessary to call this function, because Qt sets the QApplication 对象立即作为根对象,之后才进入事件循环在 exec() .

Use to redirect the function call to a customized handler function.

static PySide2.QtGui.QAccessible. uniqueId ( iface )
参数

iface QAccessibleInterface

返回类型

long

返回唯一 ID 为 QAccessibleInterface iface .

static PySide2.QtGui.QAccessible. updateAccessibility ( event )
参数

event QAccessibleEvent

通知可能与可访问性客户端相关的即将改变。

event 提供改变的有关细节。这些包括改变的来源和改变的性质。 event 应包含足够信息以给出有意义通知。

例如,类型 ValueChange 指示滑块位置已改变。

调用此函数,每当可访问对象或其某一子元素的状态以编程方式改变时 (如:通过调用 setText() ) or by user interaction.

若没有可访问性工具监听此事件,调用此函数的性能损失很小,但是,若确定调用的参数很昂贵,可以测试 isActive() to avoid unnecessary computation.