QAccessibleEvent Class
QAccessibleEvent 类是辅助功能通知的基类。更多
头文件: | #include <QAccessibleEvent> |
CMake: | find_package(Qt6 REQUIRED COMPONENTS Gui) target_link_libraries(mytarget PRIVATE Qt6::Gui) |
qmake: | QT += gui |
继承者: | QAccessibleAnnouncementEvent,QAccessibleStateChangeEvent,QAccessibleTableModelChangeEvent,QAccessibleTextCursorEvent, 以及QAccessibleValueChangeEvent |
- 所有成员(包括继承成员)的列表
- QAccessibleEvent 属于辅助功能类。
公共函数
QAccessibleEvent(QAccessibleInterface *interface, QAccessible::Event type) | |
QAccessibleEvent(QObject *object, QAccessible::Event type) | |
virtual | ~QAccessibleEvent() |
virtual QAccessibleInterface * | accessibleInterface() const |
int | child() const |
QObject * | object() const |
void | setChild(int child) |
QAccessible::Event | type() const |
详细说明
该类与QAccessible::updateAccessibility() 一起使用。
事件类型是QAccessible::Event 的值之一。有许多子类可用于提供有关事件的更多细节。
例如,在重新实现QWidget::setFocus 时,要通知焦点变化,可按如下方式使用该事件:
void MyWidget::setFocus(Qt::FocusReason reason) { // handle custom focus setting... QAccessibleEvent event(f, QAccessible::Focus); QAccessible::updateAccessibility(&event); }
要启用进程中屏幕阅读器,所有事件都必须在改变发生后发送。
成员函数文档
QAccessibleEvent::QAccessibleEvent(QAccessibleInterface *interface, QAccessible::Event type)
构造一个 QAccessibleEvent 来通知interface 已发生变化。事件type 会描述发生了哪些变化。如果您已经有QAccessibleInterface 或没有QObject ,请使用此函数,否则请考虑重载,因为使用QObject 参数可能更便宜。
QAccessibleEvent::QAccessibleEvent(QObject *object, QAccessible::Event type)
构造一个 QAccessibleEvent 来通知object 已发生变化。事件type 会描述发生了哪些变化。
[virtual noexcept]
QAccessibleEvent::~QAccessibleEvent()
摧毁事件。
[virtual]
QAccessibleInterface *QAccessibleEvent::accessibleInterface() const
返回与事件相关的QAccessibleInterface 。
int QAccessibleEvent::child() const
返回子索引。
另请参见 setChild()。
QObject *QAccessibleEvent::object() const
返回事件对象。
void QAccessibleEvent::setChild(int child)
将子索引设置为child 。
另请参阅 child() 。
QAccessible::Event QAccessibleEvent::type() const
返回事件类型。
© 2025 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.