可訪問性

介紹

Accessibility in computer software is making applications usable for people with different abilities. It is important to take different people's needs into account, for example, in case of low vision, hearing, dexterity, or cognitive problems. Some examples of accessibility measures are keyboard shortcuts, a high-contrast user interface that uses specially selected colors and fonts, or support for assistive tools such as screen readers and braille displays.

任何應用程序都應瞄準的基本清單:

  • Usability - Usability and user centric design generally lead to more usable applications, including improvements for people with various abilities.
  • 字體 - Font settings should follow the system/platform. This allows users to select fonts for readability and increasing the font size.
  • 顔色 - Provide enough contrast and consider the most common cases of low vision and color blindness. Make sure that the application is usable, for example, for people with red/green blindness, and don't depend on colors only.
  • 可伸縮 UI - A user interface that works in various sizes and properly supports different fonts and accommodates size changes.
  • Sounds - Do not exclusively rely on sound notifications, provide a visual alternative when a sound signal is imperative to using the application.
  • Spelling - Offer spell checking wherever it makes sense, even when only a single word is expected.
  • Assistive Technology - Support the use of assistive tools (AT). Either use standard widgets/controls which support ATs out of the box, or make sure that your custom widgets and controls support accessibility properly. In order to learn more about this read on below.

This part of the documentation assumes that the basics for accessibility, which go hand in hand with usability, are already in good shape. The rest of this document focuses more specifically on supporting assistive technology.

Assistive Tools (or ATs) come in great variety and help users with different tasks. For this reason what individual applications offer (with the help of Qt) is a generic API that allows to inspect what is on screen in a semantic way and offers the typical interactions with the UI elements.

Applications do not usually communicate directly with the assistive tools, but through a platform specific API. Generally the communication with the ATs works though an IPC mechanism. Semantic information about user interface elements, such as buttons and scroll bars, is exposed to the assistive technologies. Qt supports Microsoft Active Accessibility (MSAA) and IAccessible2 on Windows, macOS Accessibility on macOS, and AT-SPI via DBus on Unix/X11. The platform specific technologies are abstracted by Qt, so that applications do not need any platform specific changes to work with the different native APIs. Qt tries to make adding accessibility support to your application as easy as possible, only a few changes from your side may be required to allow even more users to enjoy it.

The main reason to consult this documentation is to learn how to make custom QWidget subclasses and QQuickItem s accessible.

In this overview document, we will examine the overall Qt accessibility architecture, and how to implement accessibility for custom widgets and elements.

使應用程序可訪問

這 2 頁麵聚焦於給齣如何取得良好可達性的概述:

QWidget 應用程序的可訪問性

Qt Quick 應用程序的可訪問性

這些類為可訪問應用程序提供支持:

QAccessible 與可訪問性相關的枚舉和靜態函數
QAccessibleActionInterface 實現對可援引接口動作的支持
QAccessibleEditableTextInterface 實現對具有可編輯文本的對象的支持
QAccessibleEvent 用於可訪問性通知的基類
QAccessibleImageInterface Implements support for the IAccessibleImage interface
QAccessibleInterface 定義暴露有關可訪問對象的信息的接口
QAccessibleStateChangeEvent 通知可訪問性框架對象的狀態已改變
QAccessibleTableCellInterface 實現對 IAccessibleTable2 單元格接口的支持
QAccessibleTableInterface 實現對 IAccessibleTable2 接口的支持
QAccessibleTableModelChangeEvent 錶示錶格、列錶或樹中被添加 (或移除) 單元格的變化。若改變影響多行,firstColumn 和 lastColumn 將返迴 -1。同樣,對於列,行函數可能返迴 -1
QAccessibleTextCursorEvent 光標移動的通知
QAccessibleTextInsertEvent 正在插入文本的通知
QAccessibleTextInterface 實現對文本處理的支持
QAccessibleTextRemoveEvent 正被刪除文本的通知
QAccessibleTextSelectionEvent 對象文本選定改變的信號
QAccessibleTextUpdateEvent 有關文本改變的通知。這用於支持可編輯文本 (譬如:行編輯) 的可訪問。例如,此事件發生,當選中文本的一部分被粘貼新文本或在編輯器覆蓋模式下被替換時。
QAccessibleValueChangeEvent 描述可訪問對象的值改變
QAccessibleValueInterface 實現對操縱值對象的支持
QAccessibleObject 為 QObjects 實現 QAccessibleInterface 部分
QAccessiblePlugin 為用戶界麵元素提供可訪問性信息的插件的抽象基類
QPlatformAccessibility The base class for integrating accessibility backends
QAccessibleWidget 為 QWidgets 實現 QAccessibleInterface
Accessible 啓用 QML 項的可訪問性