QAccessibleSelectionInterface Class

QAccessibleSelectionInterface 类实现了对选择处理的支持。更多

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

公共函数

virtual ~QAccessibleSelectionInterface()
virtual bool clear() = 0
virtual bool isSelected(QAccessibleInterface *childItem) const
virtual bool select(QAccessibleInterface *childItem) = 0
virtual bool selectAll() = 0
virtual QAccessibleInterface *selectedItem(int selectionIndex) const
virtual int selectedItemCount() const = 0
virtual QList<QAccessibleInterface *> selectedItems() const = 0
virtual bool unselect(QAccessibleInterface *childItem) = 0

详细说明

QAccessibleSelectionInterface 是无障碍类的一部分,它提供了检索当前选区和修改选区的方法。

仅支持直接子代的选择。

成员函数文档

[virtual noexcept] QAccessibleSelectionInterface::~QAccessibleSelectionInterface()

摧毁QAccessibleSelectionInterface.

[pure virtual] bool QAccessibleSelectionInterface::clear()

取消选择所有可访问的子项目。

返回是否所有可访问的子项目都已从选区中移除,即调用此方法后选区是否为空。

[virtual] bool QAccessibleSelectionInterface::isSelected(QAccessibleInterface *childItem) const

返回childItem 是否属于当前选择的一部分。

默认实现会检查childItem 是否包含在QAccessibleSelectionInterface::selectedItems 获取的项目列表中。

[pure virtual] bool QAccessibleSelectionInterface::select(QAccessibleInterface *childItem)

childItem 添加到选区。返回childItem 是否已实际添加到选区中。

对于只允许单个选区的实现,这可能会替换当前选区。

[pure virtual] bool QAccessibleSelectionInterface::selectAll()

选择所有可访问的子项目。

返回是否所有可访问的子项目都已添加到选区中。

[virtual] QAccessibleInterface *QAccessibleSelectionInterface::selectedItem(int selectionIndex) const

返回选区中索引为selectionIndex 的选定可访问项。

请注意,索引指的是第 n 个选定的可访问条目(即当前选区中的索引),这通常不同于为检索同一条目而传递给QAccessibleInterface::child() 的索引。

默认实现使用selectionIndexQAccessibleSelectionInterface::selectedItems() 获取的选中项列表中检索项目。

特别是对于处理许多选定项的实现,出于性能考虑,最好以更有效的方式重新实现该方法。

[pure virtual] int QAccessibleSelectionInterface::selectedItemCount() const

返回所选可访问项目的总数。

[pure virtual] QList<QAccessibleInterface *> QAccessibleSelectionInterface::selectedItems() const

返回所选可访问项目的列表。

[pure virtual] bool QAccessibleSelectionInterface::unselect(QAccessibleInterface *childItem)

从选中移除childItem

返回可访问项是否已从选区中删除。

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