内容表

上一话题

重要 Qt Quick 概念 - 位置

下一话题

Qt Quick Examples - Right to Left

Qt Quick Examples - Accessibility

This example demonstrates the implementation of accessible buttons.

可访问性 demonstrates QML types that are augmented with meta-data for accessibility systems. For more information, visit the Accessibility page.

运行范例

要运行范例从 Qt Creator ,打开 欢迎 模式,然后选择范例从 范例 . For more information, visit Building and Running an Example.

Implementing Accessible Buttons

The button identifies itself and its functionality to the accessibility system:

Accessible.name: text
Accessible.description: "This button does " + text
Accessible.role: Accessible.Button
Accessible.onPressAction: {
    button.clicked()
}
											

Similarly, 文本 types inside the example also identify themselves:

Accessible.role: Accessible.StaticText
Accessible.name: text
											

范例工程 @ code.qt.io