mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-09 18:31:04 +00:00
Remove use of QRegExp
QRegexp has been replaced with QRegularExpression in Qt5. Now that we have dropped support for Qt4, there is no need for keeping it around.
This commit is contained in:
parent
88c1ed9e32
commit
263da2fa20
@ -34,9 +34,6 @@
|
||||
#include <QSortFilterProxyModel>
|
||||
#include <QStandardItemModel>
|
||||
#include <QTextFrame>
|
||||
#if QT_VERSION >= 0x060000
|
||||
#include <QtCore5Compat/QRegExp>
|
||||
#endif
|
||||
|
||||
using namespace lyx::support;
|
||||
|
||||
@ -273,11 +270,7 @@ QString CCItemDelegate::underlineFilter(QString const & s) const
|
||||
if (f.isEmpty())
|
||||
return s;
|
||||
QString r(s);
|
||||
#if QT_VERSION < 0x060000
|
||||
QRegExp pattern(charFilterRegExpC(f));
|
||||
#else
|
||||
QRegularExpression pattern(charFilterRegExpC(f));
|
||||
#endif
|
||||
r.replace(pattern, "<u><b>\\1</b></u>");
|
||||
return r;
|
||||
}
|
||||
|
@ -127,13 +127,8 @@ static QString release_notes()
|
||||
continue;
|
||||
|
||||
// detect links to the tracker
|
||||
#if QT_VERSION < 0x060000
|
||||
line.replace(QRegExp("(bug )(\\#)(\\d+)*"),
|
||||
"<a href=\"http://www.lyx.org/trac/ticket/\\3\">\\1\\3</a>");
|
||||
#else
|
||||
line.replace(QRegularExpression("(bug )(\\#)(\\d+)*"),
|
||||
"<a href=\"http://www.lyx.org/trac/ticket/\\3\">\\1\\3</a>");
|
||||
#endif
|
||||
|
||||
// headings
|
||||
if (line.startsWith("!!!")) {
|
||||
|
@ -111,7 +111,6 @@
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 10, 0))
|
||||
#include <QRandomGenerator>
|
||||
#endif
|
||||
#include <QRegExp>
|
||||
#include <QSessionManager>
|
||||
#include <QSettings>
|
||||
#include <QSocketNotifier>
|
||||
@ -2623,16 +2622,6 @@ void GuiApplication::createView(QString const & geometry_arg, bool autoShow,
|
||||
int x, y;
|
||||
int w, h;
|
||||
QChar sx, sy;
|
||||
#if QT_VERSION < 0x060000
|
||||
QRegExp re( "[=]*(?:([0-9]+)[xX]([0-9]+)){0,1}[ ]*(?:([+-][0-9]*)){0,1}(?:([+-][0-9]*)){0,1}" );
|
||||
re.indexIn(geometry_arg);
|
||||
w = re.cap(1).toInt();
|
||||
h = re.cap(2).toInt();
|
||||
x = re.cap(3).toInt();
|
||||
y = re.cap(4).toInt();
|
||||
sx = re.cap(3).isEmpty() ? '+' : re.cap(3).at(0);
|
||||
sy = re.cap(4).isEmpty() ? '+' : re.cap(4).at(0);
|
||||
#else
|
||||
QRegularExpression re( "[=]*(?:([0-9]+)[xX]([0-9]+)){0,1}[ ]*(?:([+-][0-9]*)){0,1}(?:([+-][0-9]*)){0,1}" );
|
||||
QRegularExpressionMatch match = re.match(geometry_arg);
|
||||
w = match.captured(1).toInt();
|
||||
@ -2641,7 +2630,7 @@ void GuiApplication::createView(QString const & geometry_arg, bool autoShow,
|
||||
y = match.captured(4).toInt();
|
||||
sx = match.captured(3).isEmpty() ? '+' : match.captured(3).at(0);
|
||||
sy = match.captured(4).isEmpty() ? '+' : match.captured(4).at(0);
|
||||
#endif
|
||||
|
||||
// Set initial geometry such that we can get the frame size.
|
||||
view->setGeometry(x, y, w, h);
|
||||
int framewidth = view->geometry().x() - view->x();
|
||||
|
@ -4002,13 +4002,8 @@ void GuiDocument::applyView()
|
||||
pdf.pagemode.clear();
|
||||
pdf.quoted_options = pdf.quoted_options_check(
|
||||
fromqstr(pdfSupportModule->optionsTE->toPlainText()));
|
||||
#if QT_VERSION < 0x060000
|
||||
bp_.document_metadata = qstring_to_ucs4(pdfSupportModule->metadataTE->toPlainText()
|
||||
.trimmed().replace(QRegExp("\n+"), "\n"));
|
||||
#else
|
||||
bp_.document_metadata = qstring_to_ucs4(pdfSupportModule->metadataTE->toPlainText()
|
||||
.trimmed().replace(QRegularExpression("\n+"), "\n"));
|
||||
#endif
|
||||
|
||||
// change tracking
|
||||
bp_.track_changes = changesModule->trackChangesCB->isChecked();
|
||||
|
@ -30,11 +30,7 @@
|
||||
#include <QLineEdit>
|
||||
#include <QPushButton>
|
||||
#include <QValidator>
|
||||
#if QT_VERSION < 0x060000
|
||||
#include <QRegExpValidator>
|
||||
#else
|
||||
#include <QRegularExpressionValidator>
|
||||
#endif
|
||||
|
||||
using namespace std;
|
||||
using namespace lyx::support;
|
||||
@ -236,11 +232,7 @@ GuiListings::GuiListings(GuiView & lv)
|
||||
numberStepLE->setValidator(new QIntValidator(0, 1000000, this));
|
||||
firstlineLE->setValidator(new QIntValidator(0, 1000000, this));
|
||||
lastlineLE->setValidator(new QIntValidator(0, 1000000, this));
|
||||
#if QT_VERSION < 0x060000
|
||||
placementLE->setValidator(new QRegExpValidator(QRegExp("[\\*tbph]*"), this));
|
||||
#else
|
||||
placementLE->setValidator(new QRegularExpressionValidator(QRegularExpression("[\\*tbph]*"), this));
|
||||
#endif
|
||||
|
||||
bc().setPolicy(ButtonPolicy::NoRepeatedApplyReadOnlyPolicy);
|
||||
bc().setOK(buttonBox->button(QDialogButtonBox::Ok));
|
||||
|
@ -41,21 +41,12 @@ namespace frontend {
|
||||
// Regular expressions needed at several places
|
||||
// FIXME: These regexes are incomplete. It would be good if we could collect those used in LaTeX::scanLogFile
|
||||
// and LaTeX::scanBlgFile and re-use them here!(spitz, 2013-05-27)
|
||||
#if QT_VERSION < 0x060000
|
||||
// Information
|
||||
QRegExp exprInfo("^(Document Class:|LaTeX Font Info:|File:|Package:|Language:|.*> INFO - |\\(|\\\\).*$");
|
||||
// Warnings
|
||||
QRegExp exprWarning("^(## Warning|LaTeX Warning|LaTeX Font Warning|Package [\\w\\.]+ Warning|Class \\w+ Warning|Warning--|Underfull|Overfull|.*> WARN - ).*$");
|
||||
// Errors
|
||||
QRegExp exprError("^(ERROR: |!|.*---line [0-9]+ of file|.*> FATAL - |.*> ERROR - |Missing character: There is no ).*$");
|
||||
#else
|
||||
// Information
|
||||
QRegularExpression exprInfo("^(Document Class:|LaTeX Font Info:|File:|Package:|Language:|.*> INFO - |\\(|\\\\).*$");
|
||||
// Warnings
|
||||
QRegularExpression exprWarning("^(## Warning|LaTeX Warning|LaTeX Font Warning|Package [\\w\\-\\.]+ Warning|Class \\w+ Warning|Warning--|Underfull|Overfull|.*> WARN - ).*$");
|
||||
// Errors
|
||||
QRegularExpression exprError("^(ERROR: |!|.*---line [0-9]+ of file|.*> FATAL - |.*> ERROR - |Missing character: There is no ).*$");
|
||||
#endif
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
@ -91,29 +82,6 @@ LogHighlighter::LogHighlighter(QTextDocument * parent)
|
||||
|
||||
void LogHighlighter::highlightBlock(QString const & text)
|
||||
{
|
||||
#if QT_VERSION < 0x060000
|
||||
// Info
|
||||
int index = exprInfo.indexIn(text);
|
||||
while (index >= 0) {
|
||||
int length = exprInfo.matchedLength();
|
||||
setFormat(index, length, infoFormat);
|
||||
index = exprInfo.indexIn(text, index + length);
|
||||
}
|
||||
// LaTeX Warning:
|
||||
index = exprWarning.indexIn(text);
|
||||
while (index >= 0) {
|
||||
int length = exprWarning.matchedLength();
|
||||
setFormat(index, length, warningFormat);
|
||||
index = exprWarning.indexIn(text, index + length);
|
||||
}
|
||||
// ! error
|
||||
index = exprError.indexIn(text);
|
||||
while (index >= 0) {
|
||||
int length = exprError.matchedLength();
|
||||
setFormat(index, length, errorFormat);
|
||||
index = exprError.indexIn(text, index + length);
|
||||
}
|
||||
#else
|
||||
// Info
|
||||
QRegularExpressionMatch match = exprInfo.match(text);
|
||||
int index = match.capturedStart(1);
|
||||
@ -141,7 +109,6 @@ void LogHighlighter::highlightBlock(QString const & text)
|
||||
match = exprError.match(text, index + length);
|
||||
index = match.capturedStart(1);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@ -234,11 +201,7 @@ void GuiLog::on_openDirPB_clicked()
|
||||
}
|
||||
|
||||
|
||||
#if QT_VERSION < 0x060000
|
||||
void GuiLog::goTo(QRegExp const & exp) const
|
||||
#else
|
||||
void GuiLog::goTo(QRegularExpression const & exp) const
|
||||
#endif
|
||||
{
|
||||
QTextCursor const newc =
|
||||
logTB->document()->find(exp, logTB->textCursor());
|
||||
@ -246,11 +209,7 @@ void GuiLog::goTo(QRegularExpression const & exp) const
|
||||
}
|
||||
|
||||
|
||||
#if QT_VERSION < 0x060000
|
||||
bool GuiLog::contains(QRegExp const & exp) const
|
||||
#else
|
||||
bool GuiLog::contains(QRegularExpression const & exp) const
|
||||
#endif
|
||||
{
|
||||
return !logTB->document()->find(exp, logTB->textCursor()).isNull();
|
||||
}
|
||||
|
@ -66,17 +66,10 @@ private:
|
||||
docstring title() const;
|
||||
/// put the log file into the ostream
|
||||
void getContents(std::ostream & ss) const;
|
||||
#if QT_VERSION < 0x060000
|
||||
/// go to the next occurrence of the RegExp
|
||||
void goTo(QRegExp const & exp) const;
|
||||
/// does the document after cursor position contain the RegExp?
|
||||
bool contains(QRegExp const & exp) const;
|
||||
#else
|
||||
/// go to the next occurrence of the RegExp
|
||||
void goTo(QRegularExpression const & exp) const;
|
||||
/// does the document after cursor position contain the RegExp?
|
||||
bool contains(QRegularExpression const & exp) const;
|
||||
#endif
|
||||
|
||||
private:
|
||||
/// Recognized log file-types
|
||||
|
@ -189,11 +189,7 @@ QString browseRelToSub(QString const & filename, QString const & relpath,
|
||||
toqstr(makeRelPath(qstring_to_ucs4(outname), qstring_to_ucs4(relpath)));
|
||||
|
||||
QString testname = reloutname;
|
||||
#if QT_VERSION < 0x060000
|
||||
testname.remove(QRegExp("^(\\.\\./)+"));
|
||||
#else
|
||||
testname.remove(QRegularExpression("^(\\.\\./)+"));
|
||||
#endif
|
||||
|
||||
if (testname.contains("/"))
|
||||
return outname;
|
||||
@ -2469,11 +2465,7 @@ PrefLanguage::PrefLanguage(GuiPreferences * form)
|
||||
startCommandED->setValidator(new NoNewLineValidator(startCommandED));
|
||||
endCommandED->setValidator(new NoNewLineValidator(endCommandED));
|
||||
|
||||
#if QT_VERSION < 0x060000
|
||||
defaultDecimalSepED->setValidator(new QRegExpValidator(QRegExp("\\S"), this));
|
||||
#else
|
||||
defaultDecimalSepED->setValidator(new QRegularExpressionValidator(QRegularExpression("\\S"), this));
|
||||
#endif
|
||||
defaultDecimalSepED->setMaxLength(1);
|
||||
|
||||
defaultLengthUnitCO->addItem(lyx::qt_(unit_name_gui[Length::CM]), Length::CM);
|
||||
|
@ -178,11 +178,7 @@ GuiTabular::GuiTabular(QWidget * parent)
|
||||
connect(tabularWidthED, SIGNAL(textEdited(const QString &)),
|
||||
this, SLOT(checkEnabled()));
|
||||
|
||||
#if QT_VERSION < 0x060000
|
||||
decimalPointED->setValidator(new QRegExpValidator(QRegExp("\\S"), this));
|
||||
#else
|
||||
decimalPointED->setValidator(new QRegularExpressionValidator(QRegularExpression("\\S"), this));
|
||||
#endif
|
||||
decimalPointED->setMaxLength(1);
|
||||
|
||||
// initialize the length validator
|
||||
|
@ -124,22 +124,9 @@ void GuiThesaurus::selectionChanged()
|
||||
QString item = meaningsTV->currentItem()->text(col);
|
||||
// cut out the classification in brackets:
|
||||
// "hominid (generic term)" -> "hominid"
|
||||
#if QT_VERSION < 0x060000
|
||||
QRegExp re("^([^\\(\\)]+)\\b\\(?.*\\)?.*$");
|
||||
#else
|
||||
QRegularExpression re("^([^\\(\\)]+)\\b\\(?.*\\)?.*$");
|
||||
#endif
|
||||
// This is for items with classifications at the beginning:
|
||||
// "(noun) man" -> "man"; "(noun) male (generic term)" -> "male"
|
||||
#if QT_VERSION < 0x060000
|
||||
QRegExp rex("^(\\(.+\\))\\s*([^\\(\\)]+)\\s*\\(?.*\\)?.*$");
|
||||
int pos = re.indexIn(item);
|
||||
if (pos > -1)
|
||||
item = re.cap(1).trimmed();
|
||||
pos = rex.indexIn(item);
|
||||
if (pos > -1)
|
||||
item = rex.cap(2).trimmed();
|
||||
#else
|
||||
QRegularExpression rex("^(\\(.+\\))\\s*([^\\(\\)]+)\\s*\\(?.*\\)?.*$");
|
||||
QRegularExpressionMatch match = re.match(item);
|
||||
if (match.hasMatch())
|
||||
@ -147,7 +134,6 @@ void GuiThesaurus::selectionChanged()
|
||||
match = rex.match(item);
|
||||
if (match.hasMatch())
|
||||
item = match.captured(2).trimmed();
|
||||
#endif
|
||||
replaceED->setText(item);
|
||||
replacePB->setEnabled(!isBufferReadonly());
|
||||
changed();
|
||||
@ -165,22 +151,9 @@ void GuiThesaurus::selectionClicked(QTreeWidgetItem * item, int col)
|
||||
QString str = item->text(col);
|
||||
// cut out the classification in brackets:
|
||||
// "hominid (generic term)" -> "hominid"
|
||||
#if QT_VERSION < 0x060000
|
||||
QRegExp re("^([^\\(\\)]+)\\b\\(?.*\\)?.*$");
|
||||
#else
|
||||
QRegularExpression re("^([^\\(\\)]+)\\b\\(?.*\\)?.*$");
|
||||
#endif
|
||||
// This is for items with classifications at the beginning:
|
||||
// "(noun) man" -> "man"; "(noun) male (generic term)" -> "male"
|
||||
#if QT_VERSION < 0x060000
|
||||
QRegExp rex("^(\\(.+\\))\\s*([^\\(\\)]+)\\s*\\(?.*\\)?.*$");
|
||||
int pos = re.indexIn(str);
|
||||
if (pos > -1)
|
||||
str = re.cap(1).trimmed();
|
||||
pos = rex.indexIn(str);
|
||||
if (pos > -1)
|
||||
str = rex.cap(2).trimmed();
|
||||
#else
|
||||
QRegularExpression rex("^(\\(.+\\))\\s*([^\\(\\)]+)\\s*\\(?.*\\)?.*$");
|
||||
QRegularExpressionMatch match = re.match(str);
|
||||
if (match.hasMatch())
|
||||
@ -188,7 +161,6 @@ void GuiThesaurus::selectionClicked(QTreeWidgetItem * item, int col)
|
||||
match = rex.match(str);
|
||||
if (match.hasMatch())
|
||||
str = match.captured(2).trimmed();
|
||||
#endif
|
||||
entryCO->insertItem(0, str);
|
||||
entryCO->setCurrentIndex(0);
|
||||
|
||||
|
@ -46,109 +46,6 @@ LaTeXHighlighter::LaTeXHighlighter(QTextDocument * parent, bool at_letter, bool
|
||||
|
||||
void LaTeXHighlighter::highlightBlock(QString const & text)
|
||||
{
|
||||
#if QT_VERSION < 0x060000
|
||||
// keyval
|
||||
if (keyval_) {
|
||||
// Highlight key-val options. Used in some option widgets.
|
||||
static const QRegExp exprKeyvalkey("[^=,]+");
|
||||
static const QRegExp exprKeyvalval("[^,]+");
|
||||
int kvindex = exprKeyvalkey.indexIn(text);
|
||||
while (kvindex >= 0) {
|
||||
int length = exprKeyvalkey.matchedLength();
|
||||
setFormat(kvindex, length, keyFormat);
|
||||
int kvvindex = exprKeyvalval.indexIn(text, kvindex + length);
|
||||
if (kvvindex > 0) {
|
||||
length += exprKeyvalval.matchedLength();
|
||||
setFormat(kvvindex, length, valFormat);
|
||||
}
|
||||
kvindex = exprKeyvalkey.indexIn(text, kvindex + length);
|
||||
}
|
||||
}
|
||||
// $ $
|
||||
static const QRegExp exprMath("\\$[^\\$]*\\$");
|
||||
int index = exprMath.indexIn(text);
|
||||
while (index >= 0) {
|
||||
int length = exprMath.matchedLength();
|
||||
setFormat(index, length, mathFormat);
|
||||
index = exprMath.indexIn(text, index + length);
|
||||
}
|
||||
// [ ]
|
||||
static const QRegExp exprStartDispMath("(\\\\\\[|"
|
||||
"\\\\begin\\{equation\\**\\}|"
|
||||
"\\\\begin\\{eqnarray\\**\\}|"
|
||||
"\\\\begin\\{align(ed|at)*\\**\\}|"
|
||||
"\\\\begin\\{flalign\\**\\}|"
|
||||
"\\\\begin\\{gather\\**\\}|"
|
||||
"\\\\begin\\{multline\\**\\}|"
|
||||
"\\\\begin\\{array\\**\\}|"
|
||||
"\\\\begin\\{cases\\**\\}"
|
||||
")");
|
||||
static const QRegExp exprEndDispMath("(\\\\\\]|"
|
||||
"\\\\end\\{equation\\**\\}|"
|
||||
"\\\\end\\{eqnarray\\**\\}|"
|
||||
"\\\\end\\{align(ed|at)*\\**\\}|"
|
||||
"\\\\end\\{flalign\\**\\}|"
|
||||
"\\\\end\\{gather\\**\\}|"
|
||||
"\\\\end\\{multline\\**\\}|"
|
||||
"\\\\end\\{array\\**\\}|"
|
||||
"\\\\end\\{cases\\**\\}"
|
||||
")");
|
||||
int startIndex = 0;
|
||||
// if previous block was in 'disp math'
|
||||
// start search from 0 (for end disp math)
|
||||
// otherwise, start search from 'begin disp math'
|
||||
if (previousBlockState() != 1)
|
||||
startIndex = exprStartDispMath.indexIn(text);
|
||||
while (startIndex >= 0) {
|
||||
int endIndex = exprEndDispMath.indexIn(text, startIndex);
|
||||
int length;
|
||||
if (endIndex == -1) {
|
||||
setCurrentBlockState(1);
|
||||
length = text.length() - startIndex;
|
||||
} else {
|
||||
length = endIndex - startIndex + exprEndDispMath.matchedLength();
|
||||
}
|
||||
setFormat(startIndex, length, mathFormat);
|
||||
startIndex = exprStartDispMath.indexIn(text, startIndex + length);
|
||||
}
|
||||
// \whatever
|
||||
static const QRegExp exprKeywordAtOther("\\\\[A-Za-z]+");
|
||||
// \wh@tever
|
||||
static const QRegExp exprKeywordAtLetter("\\\\[A-Za-z@]+");
|
||||
QRegExp const & exprKeyword = at_letter_ ? exprKeywordAtLetter
|
||||
: exprKeywordAtOther;
|
||||
index = exprKeyword.indexIn(text);
|
||||
while (index >= 0) {
|
||||
int length = exprKeyword.matchedLength();
|
||||
setFormat(index, length, keywordFormat);
|
||||
index = exprKeyword.indexIn(text, index + length);
|
||||
}
|
||||
// %comment
|
||||
// Treat a line as a comment starting at a percent sign
|
||||
// * that is the first character in a line
|
||||
// * that is preceded by
|
||||
// ** an even number of backslashes
|
||||
// ** any character other than a backslash
|
||||
QRegExp exprComment("(?:^|[^\\\\])(?:\\\\\\\\)*(%).*$");
|
||||
exprComment.indexIn(text);
|
||||
index = exprComment.pos(1);
|
||||
while (index >= 0) {
|
||||
int const length = exprComment.matchedLength()
|
||||
- (index - exprComment.pos(0));
|
||||
setFormat(index, length, commentFormat);
|
||||
exprComment.indexIn(text, index + length);
|
||||
index = exprComment.pos(1);
|
||||
}
|
||||
// <LyX Warning: ...>
|
||||
QString lyxwarn = qt_("LyX Warning: ");
|
||||
QRegExp exprWarning("<" + lyxwarn + "[^<]*>");
|
||||
index = exprWarning.indexIn(text);
|
||||
while (index >= 0) {
|
||||
int length = exprWarning.matchedLength();
|
||||
setFormat(index, length, warningFormat);
|
||||
index = exprWarning.indexIn(text, index + length);
|
||||
}
|
||||
#else
|
||||
// keyval
|
||||
if (keyval_) {
|
||||
// Highlight key-val options. Used in some option widgets.
|
||||
@ -264,7 +161,6 @@ void LaTeXHighlighter::highlightBlock(QString const & text)
|
||||
match = exprWarning.match(text, index + length);
|
||||
index = match.capturedStart(0);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
} // namespace frontend
|
||||
|
@ -43,7 +43,6 @@
|
||||
#include <QHeaderView>
|
||||
#include <QItemDelegate>
|
||||
#include <QPainter>
|
||||
#include <QRegExp>
|
||||
#include <QSortFilterProxyModel>
|
||||
#include <QStandardItemModel>
|
||||
#include <QTextFrame>
|
||||
@ -300,11 +299,7 @@ QString LayoutItemDelegate::underlineFilter(QString const & s) const
|
||||
if (f.isEmpty())
|
||||
return s;
|
||||
QString r(s);
|
||||
#if QT_VERSION < 0x060000
|
||||
QRegExp pattern(charFilterRegExpC(f));
|
||||
#else
|
||||
QRegularExpression pattern(charFilterRegExpC(f));
|
||||
#endif
|
||||
r.replace(pattern, "<u><b>\\1</b></u>");
|
||||
return r;
|
||||
}
|
||||
|
@ -192,11 +192,7 @@ NoNewLineValidator::NoNewLineValidator(QWidget * parent)
|
||||
|
||||
QValidator::State NoNewLineValidator::validate(QString & qtext, int &) const
|
||||
{
|
||||
#if QT_VERSION < 0x060000
|
||||
qtext.remove(QRegExp("[\\n\\r]"));
|
||||
#else
|
||||
qtext.remove(QRegularExpression("[\\n\\r]"));
|
||||
#endif
|
||||
return QValidator::Acceptable;
|
||||
}
|
||||
|
||||
|
@ -18,7 +18,7 @@
|
||||
#include "support/docstring.h"
|
||||
#include "support/qstring_helpers.h"
|
||||
|
||||
#include <QRegExp>
|
||||
#include <QRegularExpression>
|
||||
#include <QLocale>
|
||||
#include <QString>
|
||||
#include <QVector>
|
||||
@ -83,9 +83,10 @@ QString charFilterRegExp(QString const & filter)
|
||||
QString re = ".*";
|
||||
for (QChar const & c : filter) {
|
||||
if (c.isLower())
|
||||
re += "["+ QRegExp::escape(c) + QRegExp::escape(c.toUpper()) + "]";
|
||||
re += "[" + QRegularExpression::escape(c)
|
||||
+ QRegularExpression::escape(c.toUpper()) + "]";
|
||||
else
|
||||
re += QRegExp::escape(c);
|
||||
re += QRegularExpression::escape(c);
|
||||
}
|
||||
return re;
|
||||
}
|
||||
@ -95,9 +96,10 @@ QString charFilterRegExpC(QString const & filter)
|
||||
QString re = "(";
|
||||
for (QChar const & c : filter) {
|
||||
if (c.isLower())
|
||||
re += "["+ QRegExp::escape(c) + QRegExp::escape(c.toUpper()) + "]";
|
||||
re += "[" + QRegularExpression::escape(c)
|
||||
+ QRegularExpression::escape(c.toUpper()) + "]";
|
||||
else
|
||||
re += QRegExp::escape(c);
|
||||
re += QRegularExpression::escape(c);
|
||||
}
|
||||
return re + ")";
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user