7#include "richtextbrowserfindbar.h"
8#include "widgets/findutils.h"
9#include "widgets/textfindreplacewidget.h"
11#include <KLocalizedString>
12#include <TextUtils/ConvertText>
14#include <QRegularExpression>
15#include <QTextBrowser>
17using namespace TextCustomEditor;
18class Q_DECL_HIDDEN TextCustomEditor::RichTextBrowserFindBarPrivate
21 RichTextBrowserFindBarPrivate(QTextBrowser *view)
26 QTextBrowser *
const mView;
31 , d(new TextCustomEditor::RichTextBrowserFindBarPrivate(view))
35RichTextBrowserFindBar::~RichTextBrowserFindBar() =
default;
37void RichTextBrowserFindBar::slotSearchText(
bool backward,
bool isAutoSearch)
40 searchText(backward, isAutoSearch);
43bool RichTextBrowserFindBar::viewIsReadOnly()
const
48bool RichTextBrowserFindBar::documentIsEmpty()
const
50 return d->mView->document()->isEmpty();
53bool RichTextBrowserFindBar::searchInDocument(
const QString &text, TextEditFindBarBase::FindFlags searchOptions)
56 if (searchOptions & TextEditFindBarBase::FindRespectDiacritics) {
57 found = d->mView->find(text, FindUtils::convertTextEditFindFlags(searchOptions));
59 found = FindUtils::find(d->mView, text, FindUtils::convertTextEditFindFlags(searchOptions));
61 mFindWidget->setFoundMatch(found);
65bool RichTextBrowserFindBar::searchInDocument(
const QRegularExpression ®Exp, TextEditFindBarBase::FindFlags searchOptions)
67 const bool found = d->mView->find(regExp, FindUtils::convertTextEditFindFlags(searchOptions));
68 mFindWidget->setFoundMatch(found);
72void RichTextBrowserFindBar::autoSearchMoveCursor()
74 QTextCursor
cursor = d->mView->textCursor();
76 d->mView->setTextCursor(
cursor);
79void RichTextBrowserFindBar::slotReplaceText()
84void RichTextBrowserFindBar::slotReplaceAllText()
89#include "moc_richtextbrowserfindbar.cpp"
The TextEditFindBarBase class.