W3cubDocs

/Qt

QWebEngineFindTextResult Class

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

Header: #include <QWebEngineFindTextResult>
CMake: find_package(Qt6 COMPONENTS WebEngineCore REQUIRED) target_link_libraries(mytarget PRIVATE Qt6::WebEngineCore)
qmake: QT += webenginecore
Since: Qt 5.14
Instantiated By: FindTextResult

Properties

Public Functions

int activeMatch() const
int numberOfMatches() const

Detailed Description

The string search can be initiated by the QWebEnginePage::findText() or 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() and WebEngineView.findTextFinished() signals.

Property Documentation

[read-only] activeMatch : const int

This property holds the index of the currently highlighted match.

Access functions:

int activeMatch() const

[read-only] numberOfMatches : const int

This property holds the number of matches found.

Access functions:

int numberOfMatches() const

© The Qt Company Ltd
Licensed under the GNU Free Documentation License, Version 1.3.
https://doc.qt.io/qt-6.2/qwebenginefindtextresult.html