PySide6.QtWebEngineCore.QWebEngineFind文本结果

class QWebEngineFindTextResult

QWebEngineFindTextResult 类封装了页面上字符串搜索的结果。更多

概要

属性

方法

注意

本文档可能包含从C++自动翻译到Python的代码片段。我们始终欢迎对代码片段翻译的贡献。如果您发现翻译问题,您也可以通过在我们的https:/bugreports.qt.io/projects/PYSIDE上创建工单来告知我们。

详细描述

字符串搜索可以通过findText()findText()方法启动。搜索结果会在视图中高亮显示。此结果的详细信息作为QWebEngineFindTextResult对象传递,该对象可用于显示状态消息,例如“2 of 2 matches”。例如:

QObject::connect(view.page(), &QWebEnginePage::findTextFinished, [](const QWebEngineFindTextResult &result) {
    qInfo() << result.activeMatch() << "of" << result.numberOfMatches() << "matches";
});

结果通过findTextFinished()findTextFinished()信号传递给用户。

注意

当使用from __feature__ import true_property时,属性可以直接使用,否则通过访问器函数使用。

property activeMatchᅟ: int

此属性保存当前高亮匹配的索引。

Access functions:
property numberOfMatchesᅟ: int

此属性保存找到的匹配项的数量。

Access functions:
__init__()
__init__(other)
Parameters:

其他QWebEngineFindTextResult

activeMatch()
Return type:

整数

属性 activeMatchᅟ 的获取器。

numberOfMatches()
Return type:

整数

属性 numberOfMatchesᅟ 的获取器。