summaryrefslogtreecommitdiffstats
path: root/src/core/api/qwebenginefindtextresult.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/api/qwebenginefindtextresult.cpp')
-rw-r--r--src/core/api/qwebenginefindtextresult.cpp24
1 files changed, 18 insertions, 6 deletions
diff --git a/src/core/api/qwebenginefindtextresult.cpp b/src/core/api/qwebenginefindtextresult.cpp
index ce1be359e..c0adc6177 100644
--- a/src/core/api/qwebenginefindtextresult.cpp
+++ b/src/core/api/qwebenginefindtextresult.cpp
@@ -44,7 +44,7 @@ QT_BEGIN_NAMESPACE
class QWebEngineFindTextResultPrivate : public QSharedData {
public:
int numberOfMatches = 0;
- int activeMatchOrdinal = 0;
+ int activeMatch = 0;
};
/*!
@@ -54,6 +54,18 @@ public:
\inmodule QtWebEngineCore
+ The string search can be initiated by the \l QWebEnginePage::findText() or
+ \l{WebEngineView::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:
+
+ \code
+ QObject::connect(view.page(), &QWebEnginePage::findTextFinished, [](const QWebEngineFindTextResult &result) {
+ qInfo() << result.activeMatch() << "of" << result.numberOfMatches() << "matches";
+ });
+ \endcode
+
Results are passed to the user in the
\l QWebEnginePage::findTextFinished() and
\l{WebEngineView::findTextFinished()}{WebEngineView.findTextFinished()} signals.
@@ -67,11 +79,11 @@ QWebEngineFindTextResult::QWebEngineFindTextResult()
/*! \internal
*/
-QWebEngineFindTextResult::QWebEngineFindTextResult(int numberOfMatches, int activeMatchOrdinal)
+QWebEngineFindTextResult::QWebEngineFindTextResult(int numberOfMatches, int activeMatch)
: d(new QWebEngineFindTextResultPrivate)
{
d->numberOfMatches = numberOfMatches;
- d->activeMatchOrdinal = activeMatchOrdinal;
+ d->activeMatch = activeMatch;
}
/*! \internal
@@ -103,12 +115,12 @@ int QWebEngineFindTextResult::numberOfMatches() const
}
/*!
- \property QWebEngineFindTextResult::activeMatchOrdinal
+ \property QWebEngineFindTextResult::activeMatch
\brief The index of the currently highlighted match.
*/
-int QWebEngineFindTextResult::activeMatchOrdinal() const
+int QWebEngineFindTextResult::activeMatch() const
{
- return d->activeMatchOrdinal;
+ return d->activeMatch;
}
QT_END_NAMESPACE