本页内容

QAccessibleAttributesInterface Class

QAccessibleAttributesInterface 类实现了对可访问对象属性报告的支持。更多内容...

头文件: #include <QAccessibleAttributesInterface>
CMake: find_package(Qt6 REQUIRED COMPONENTS Gui)
target_link_libraries(mytarget PRIVATE Qt6::Gui)
qmake: QT += gui
自: Qt 6.8

公共函数

QAccessibleAttributesInterface()
virtual ~QAccessibleAttributesInterface()
virtual QList<QAccessible::Attribute> attributeKeys() const = 0
virtual QVariant attributeValue(QAccessible::Attribute key) const = 0

详细说明

属性是键值对。值存储在QVariant 中。

QAccessible::Attribute 枚举描述了可用的键,并记录了每个键的值应使用何种类型。

虽然由QAccessibleTextInterface::attributes 处理的文本特定属性仅适用于实现文本的对象,并且与特定的文本位置/偏移量相关,但由QAccessibleAttributesInterface 处理的属性可用于任何角色的对象,并适用于整个对象。

已经为文本特定属性实现了QAccessibleTextInterface 的类,可能还需额外实现QAccessibleAttributesInterface 以处理对象特定属性。

成员函数文档

[constexpr noexcept default] QAccessibleAttributesInterface::QAccessibleAttributesInterface()

默认——构造一个QAccessibleAttributesInterface 的实例。

[virtual noexcept] QAccessibleAttributesInterface::~QAccessibleAttributesInterface()

销毁QAccessibleAttributesInterface 。

[pure virtual] QList<QAccessible::Attribute> QAccessibleAttributesInterface::attributeKeys() const

返回该对象支持的所有属性的键。QAccessible::Attribute 枚举描述了可用的键。

[pure virtual] QVariant QAccessibleAttributesInterface::attributeValue(QAccessible::Attribute key) const

返回此对象的key 属性的值。

如果该对象已设置此属性,则会通过QVariant 返回一个值,其类型与QAccessible::Attribute 枚举文档中针对该键所记录的类型一致。

否则,将返回一个无效的QVariant 。

© 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.