QTextBlockUserData Class

QTextBlockUserData 类用于将自定义数据与文本块关联起来。更多

Header: #include <QTextBlockUserData>
CMake: find_package(Qt6 REQUIRED COMPONENTS Gui)
target_link_libraries(mytarget PRIVATE Qt6::Gui)
qmake: QT += gui

注意:该类中的所有函数都是可重入的

公共函数

详细说明

QTextBlockUserData 为容器类提供了一个抽象接口,容器类用于将特定于应用程序的用户数据与QTextDocument 中的文本块关联起来。

一般来说,该类的子类提供允许存储和检索数据的函数,并使用QTextBlock::setUserData() 将实例附加到文本块。这样就可以为每个文本块存储更多数据,而且应用程序可以安全地检索这些数据。

每个子类都应重新实现析构函数,以确保在删除用户数据对象时自动清理任何私有数据。

另请参阅 QTextBlock

成员函数文档

[virtual noexcept] QTextBlockUserData::~QTextBlockUserData()

销毁用户数据。

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