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 可访问性 页面。

运行范例

要运行范例从 Qt Creator ,打开 Welcome 模式,然后选择范例从 Examples 。更多信息,拜访 构建和运行范例 .

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, Text types inside the example also identify themselves:

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

范例工程 @ code.qt.io