12#include <QWebEnginePage>
13#include <QWebEngineView>
14#include <QWebEngineFindTextResult>
35 QWebEngineView *
const WebView_;
36 QString PreviousFindText_;
59 static QWebEnginePage::FindFlags
ToPageFlags (FindFlags findFlags)
61 QWebEnginePage::FindFlags pageFlags;
62 auto check = [&pageFlags, findFlags] (
FindFlag ourFlag, QWebEnginePage::FindFlag pageFlag)
64 if (findFlags & ourFlag)
65 pageFlags |= pageFlag;
72 void ClearFindResults ()
74 PreviousFindText_.clear ();
75 WebView_->page ()->findText ({});
78 void HandleNext (
const QString& text, FindFlags findFlags)
override
80 if (PreviousFindText_ != text)
83 PreviousFindText_ = text;
86 WebView_->page ()->findText (text,
ToPageFlags (findFlags),
87 [
this] (
const QWebEngineFindTextResult& found) {
SetSuccessful (found.numberOfMatches ()); });
FindNotification(const ICoreProxy_ptr &proxy, QWidget *near)
Creates the search widget in parent layout of near.
void SetSuccessful(bool successful)
Updates the widget to show whether the search has been successful.
void HandleNext(const QString &text, FindFlags findFlags) override
Called each time the user requests a search.
static QWebEnginePage::FindFlags ToPageFlags(FindFlags findFlags)
Converts the given findFlags to WebKit find flags.
FindNotificationWE(const ICoreProxy_ptr &proxy, QWebEngineView *near)
Constructs the find notification using the given proxy and near widget.
std::shared_ptr< ICoreProxy > ICoreProxy_ptr