forked from qt-creator/qt-creator
TextEditor: Replace QRegExp by QRegularExpression
Task-number: QTCREATORBUG-24098 Change-Id: Id407154bd7d05bf5bbf07a804959e87452225c70 Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
@@ -172,8 +172,8 @@ void HighlighterSettings::assignDefaultDefinitionsPath()
|
||||
|
||||
bool HighlighterSettings::isIgnoredFilePattern(const QString &fileName) const
|
||||
{
|
||||
for (const QRegExp ®Exp : m_ignoredFiles)
|
||||
if (regExp.indexIn(fileName) != -1)
|
||||
for (const QRegularExpression ®Exp : m_ignoredFiles)
|
||||
if (fileName.indexOf(regExp) != -1)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
@@ -188,11 +188,10 @@ bool HighlighterSettings::equals(const HighlighterSettings &highlighterSettings)
|
||||
void HighlighterSettings::setExpressionsFromList(const QStringList &patterns)
|
||||
{
|
||||
m_ignoredFiles.clear();
|
||||
QRegExp regExp;
|
||||
regExp.setCaseSensitivity(Qt::CaseInsensitive);
|
||||
regExp.setPatternSyntax(QRegExp::Wildcard);
|
||||
QRegularExpression regExp;
|
||||
regExp.setPatternOptions(QRegularExpression::CaseInsensitiveOption);
|
||||
for (const QString &pattern : patterns) {
|
||||
regExp.setPattern(pattern);
|
||||
regExp.setPattern(QRegularExpression::wildcardToRegularExpression(pattern));
|
||||
m_ignoredFiles.append(regExp);
|
||||
}
|
||||
}
|
||||
@@ -200,7 +199,7 @@ void HighlighterSettings::setExpressionsFromList(const QStringList &patterns)
|
||||
QStringList HighlighterSettings::listFromExpressions() const
|
||||
{
|
||||
QStringList patterns;
|
||||
for (const QRegExp ®Exp : m_ignoredFiles)
|
||||
for (const QRegularExpression ®Exp : m_ignoredFiles)
|
||||
patterns.append(regExp.pattern());
|
||||
return patterns;
|
||||
}
|
||||
|
@@ -28,7 +28,7 @@
|
||||
#include <QString>
|
||||
#include <QStringList>
|
||||
#include <QList>
|
||||
#include <QRegExp>
|
||||
#include <QRegularExpression>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QSettings;
|
||||
@@ -61,7 +61,7 @@ private:
|
||||
QStringList listFromExpressions() const;
|
||||
|
||||
QString m_definitionFilesPath;
|
||||
QList<QRegExp> m_ignoredFiles;
|
||||
QList<QRegularExpression> m_ignoredFiles;
|
||||
};
|
||||
|
||||
inline bool operator==(const HighlighterSettings &a, const HighlighterSettings &b)
|
||||
|
@@ -1836,7 +1836,7 @@ void TextEditorWidget::joinLines()
|
||||
QString cutLine = cursor.selectedText();
|
||||
|
||||
// Collapse leading whitespaces to one or insert whitespace
|
||||
cutLine.replace(QRegExp(QLatin1String("^\\s*")), QLatin1String(" "));
|
||||
cutLine.replace(QRegularExpression(QLatin1String("^\\s*")), QLatin1String(" "));
|
||||
cursor.movePosition(QTextCursor::Right, QTextCursor::KeepAnchor);
|
||||
cursor.removeSelectedText();
|
||||
|
||||
@@ -7123,7 +7123,7 @@ void TextEditorWidget::autoIndent()
|
||||
void TextEditorWidget::rewrapParagraph()
|
||||
{
|
||||
const int paragraphWidth = marginSettings().m_marginColumn;
|
||||
const QRegExp anyLettersOrNumbers = QRegExp(QLatin1String("\\w"));
|
||||
const QRegularExpression anyLettersOrNumbers("\\w");
|
||||
const int tabSize = d->m_document->tabSettings().m_tabSize;
|
||||
|
||||
QTextCursor cursor = textCursor();
|
||||
|
Reference in New Issue
Block a user