QWebEngineFindTextResult Class

The QWebEngineFindTextResult class encapsulates the result of a string search on a page. 更多...

頭: #include <QWebEngineFindTextResult>
CMake: find_package(Qt6 REQUIRED COMPONENTS WebEngineCore)
target_link_libraries(mytarget PRIVATE Qt6::WebEngineCore)
qmake: QT += webenginecore
實例化: FindTextResult

特性

公共函數

int activeMatch () const
int numberOfMatches () const

詳細描述

The string search can be initiated by the QWebEnginePage::findText () 或 WebEngineView.findText () method. The results of the search are highlighted in the view. The details of this result are passed as a QWebEngineFindTextResult object that can be used to show a status message, such as "2 of 2 matches". For example:

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

Results are passed to the user in the QWebEnginePage::findTextFinished () 和 WebEngineView.findTextFinished () 信號。

特性文檔編製

[read-only] activeMatch : const int

This property holds the index of the currently highlighted match.

訪問函數:

int activeMatch () const

[read-only] numberOfMatches : const int

This property holds the number of matches found.

訪問函數:

int numberOfMatches () const