diff options
author | Peter Varga <pvarga@inf.u-szeged.hu> | 2019-10-01 08:17:50 +0200 |
---|---|---|
committer | Peter Varga <pvarga@inf.u-szeged.hu> | 2019-10-19 18:00:33 +0000 |
commit | 43f26916a5716ddcd2270c513f15a62b183929bb (patch) | |
tree | 1c2566d93e39f9e61dafbc8ca7771c501416cf6f /src/core/api/qwebenginefindtextresult.cpp | |
parent | 0ce522cb43813a2a557c4197e0bc672596080a10 (diff) |
Improve QWebEngineFindTextResult APIv5.14.0-beta2
Implements suggestions from 5.14 API review:
- Rename activeMatchOrdinal to activeMatch
- Extend documentation
- Change QML import version number to 1.10
Task-number: QTBUG-77839
Change-Id: I5eae659cfb5355af8d0c878d3b5f00654c9d6d13
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'src/core/api/qwebenginefindtextresult.cpp')
-rw-r--r-- | src/core/api/qwebenginefindtextresult.cpp | 24 |
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 |