Commit 1f369589 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Now we depend against qt5.13

parent 73fb2b21
Pipeline #21294 canceled with stage
......@@ -23,9 +23,7 @@
#include "kpimtextedit_export.h"
#include <QWidget>
#include <QTextDocument>
#if QT_VERSION >= QT_VERSION_CHECK(5, 13, 0)
#include <QRegularExpression>
#endif
namespace KPIMTextEdit {
class TextFindWidget;
class TextReplaceWidget;
......@@ -58,11 +56,7 @@ protected:
virtual bool viewIsReadOnly() const = 0;
virtual bool documentIsEmpty() const = 0;
virtual bool searchInDocument(const QString &text, QTextDocument::FindFlags searchOptions) = 0;
#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
virtual bool searchInDocument(const QRegExp &regExp, QTextDocument::FindFlags searchOptions) = 0;
#else
virtual bool searchInDocument(const QRegularExpression &regExp, QTextDocument::FindFlags searchOptions) = 0;
#endif
virtual void autoSearchMoveCursor() = 0;
bool event(QEvent *e) override;
......@@ -89,11 +83,7 @@ private Q_SLOTS:
protected:
QString mLastSearchStr;
#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
QRegExp mLastSearchRegExp;
#else
QRegularExpression mLastSearchRegExp;
#endif
TextFindWidget *mFindWidget = nullptr;
TextReplaceWidget *mReplaceWidget = nullptr;
bool mHideWhenClose = true;
......
......@@ -174,24 +174,6 @@ QString TextFindWidget::searchText() const
return mSearch->text();
}
#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
QRegExp TextFindWidget::searchRegExp() const
{
QRegExp reg;
if (mCaseSensitiveAct->isChecked()) {
reg.setCaseSensitivity(Qt::CaseSensitive);
} else {
reg.setCaseSensitivity(Qt::CaseInsensitive);
}
QString searchTextString = mSearch->text();
if (mWholeWordAct->isChecked()) {
searchTextString = QLatin1String("\\b") + searchTextString + QLatin1String("\\b");
}
reg.setPattern(searchTextString);
return reg;
}
#else
QRegularExpression TextFindWidget::searchRegExp() const
{
QRegularExpression reg;
......@@ -206,7 +188,6 @@ QRegularExpression TextFindWidget::searchRegExp() const
return reg;
}
#endif
QTextDocument::FindFlags TextFindWidget::searchOptions() const
{
QTextDocument::FindFlags opt = {};
......
......@@ -41,11 +41,7 @@ public:
void setFoundMatch(bool match);
bool isRegularExpression() const;
#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
Q_REQUIRED_RESULT QRegExp searchRegExp() const;
#else
Q_REQUIRED_RESULT QRegularExpression searchRegExp() const;
#endif
Q_REQUIRED_RESULT QString searchText() const;
......
......@@ -76,15 +76,6 @@ bool PlainTextEditFindBar::searchInDocument(const QString &text, QTextDocument::
return found;
}
#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
bool PlainTextEditFindBar::searchInDocument(const QRegExp &regExp, QTextDocument::FindFlags searchOptions)
{
const bool found = d->mView->find(regExp, searchOptions);
mFindWidget->setFoundMatch(found);
return found;
}
#else
bool PlainTextEditFindBar::searchInDocument(const QRegularExpression &regExp, QTextDocument::FindFlags searchOptions)
{
const bool found = d->mView->find(regExp, searchOptions);
......@@ -92,8 +83,6 @@ bool PlainTextEditFindBar::searchInDocument(const QRegularExpression &regExp, QT
return found;
}
#endif
void PlainTextEditFindBar::autoSearchMoveCursor()
{
QTextCursor cursor = d->mView->textCursor();
......
......@@ -43,11 +43,7 @@ protected:
bool viewIsReadOnly() const override;
bool documentIsEmpty() const override;
bool searchInDocument(const QString &text, QTextDocument::FindFlags searchOptions) override;
#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
bool searchInDocument(const QRegExp &regExp, QTextDocument::FindFlags searchOptions) override;
#else
bool searchInDocument(const QRegularExpression &regExp, QTextDocument::FindFlags searchOptions) override;
#endif
void autoSearchMoveCursor() override;
public Q_SLOTS:
......
......@@ -75,15 +75,6 @@ bool RichTextEditFindBar::searchInDocument(const QString &text, QTextDocument::F
return found;
}
#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
bool RichTextEditFindBar::searchInDocument(const QRegExp &regExp, QTextDocument::FindFlags searchOptions)
{
const bool found = d->mView->find(regExp, searchOptions);
mFindWidget->setFoundMatch(found);
return found;
}
#else
bool RichTextEditFindBar::searchInDocument(const QRegularExpression &regExp, QTextDocument::FindFlags searchOptions)
{
const bool found = d->mView->find(regExp, searchOptions);
......@@ -91,8 +82,6 @@ bool RichTextEditFindBar::searchInDocument(const QRegularExpression &regExp, QTe
return found;
}
#endif
void RichTextEditFindBar::autoSearchMoveCursor()
{
QTextCursor cursor = d->mView->textCursor();
......
......@@ -42,11 +42,7 @@ protected:
bool viewIsReadOnly() const override;
bool documentIsEmpty() const override;
bool searchInDocument(const QString &text, QTextDocument::FindFlags searchOptions) override;
#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
bool searchInDocument(const QRegExp &regExp, QTextDocument::FindFlags searchOptions) override;
#else
bool searchInDocument(const QRegularExpression &regExp, QTextDocument::FindFlags searchOptions) override;
#endif
void autoSearchMoveCursor() override;
public Q_SLOTS:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment