本页内容

QHelpContentModel Class

QHelpContentModel 类提供了一个向视图提供内容的模型。更多内容...

标题: #include <QHelpContentModel>
CMake: find_package(Qt6 REQUIRED COMPONENTS Help)
target_link_libraries(mytarget PRIVATE Qt6::Help)
qmake: QT += help
继承自: QAbstractItemModel

公共函数

virtual ~QHelpContentModel() override
QHelpContentItem *contentItemAt(const QModelIndex &index) const
void createContents(const QString &filter)
(since 6.8) void createContentsForCurrentFilter()
bool isCreatingContents() const

重新实现的公共函数

virtual int columnCount(const QModelIndex &parent = {}) const override
virtual QVariant data(const QModelIndex &index, int role) const override
virtual QModelIndex index(int row, int column, const QModelIndex &parent = {}) const override
virtual QModelIndex parent(const QModelIndex &index) const override
virtual int rowCount(const QModelIndex &parent = {}) const override

信号

详细说明

成员函数文档

[override virtual noexcept] QHelpContentModel::~QHelpContentModel()

删除帮助内容模型。

[override virtual] int QHelpContentModel::columnCount(const QModelIndex &parent = {}) const

重写了:QAbstractItemModel::columnCount(const QModelIndex &parent) const。

返回给定parent 下的列数。目前始终返回 1。

QHelpContentItem *QHelpContentModel::contentItemAt(const QModelIndex &index) const

返回位于模型索引位置index 的帮助内容条目。

[signal] void QHelpContentModel::contentsCreated()

当内容创建完成后,会发出此信号。

[signal] void QHelpContentModel::contentsCreationStarted()

当内容生成开始时,会发出此信号。从此时起,当前内容将失效,直至发出contentsCreated()信号为止。

另请参阅 isCreatingContents()。

void QHelpContentModel::createContents(const QString &filter)

通过查询帮助系统,根据自定义名称“filter ”所指定的内容,创建新内容。

[since 6.8] void QHelpContentModel::createContentsForCurrentFilter()

通过查询帮助系统中针对当前过滤器指定的内容,创建新内容。

该函数于 Qt 6.8 中引入。

[override virtual] QVariant QHelpContentModel::data(const QModelIndex &index, int role) const

重写:QAbstractItemModel::data(const QModelIndex& index, int role) const。

返回存储在给定role 下的数据,该索引对应于index 所引用的项目。

[override virtual] QModelIndex QHelpContentModel::index(int row, int column, const QModelIndex &parent = {}) const

重写:QAbstractItemModel::index(int row, int column, const QModelIndex &parent) const。

返回由给定的row 、column 和parent 索引指定的模型中该项的索引。

bool QHelpContentModel::isCreatingContents() const

如果内容当前正在重建,则返回 true;否则返回 false。

[override virtual] QModelIndex QHelpContentModel::parent(const QModelIndex &index) const

重写:QAbstractItemModel::parent(const QModelIndex &index) const。

返回具有给定index 的模型项的父项;如果该模型项没有父项,则返回 QModelIndex()。

[override virtual] int QHelpContentModel::rowCount(const QModelIndex &parent = {}) const

重写:QAbstractItemModel::rowCount(const QModelIndex &parent) const。

返回给定parent 下方的行数。

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