本页内容

Qt Quick 示例 - 无障碍设计

本示例演示了无障碍按钮的实现。

“无障碍”部分展示了为无障碍系统添加了元数据的 QML 类型。如需了解更多信息,请访问“无障碍”页面。

运行示例

您可以通过以下方式运行示例:

实现无障碍按钮

按钮会向辅助功能系统声明其自身身份及其功能:

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

同样,示例中的Text 类型也会声明自身:

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

示例项目 @ code.qt.io

© 2026 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.