Bazaar: Replace QRegExp

Task-number: QTCREATORBUG-24098
Change-Id: I450d5756359596495f501759670970c9c541d4d9
Reviewed-by: Hugues Delorme <delorme.hugues@fougue.pro>
This commit is contained in:
hjk
2020-06-23 16:36:59 +02:00
parent f7242cdce9
commit a6fe2efd4e
7 changed files with 35 additions and 26 deletions

View File

@@ -35,7 +35,7 @@
#include <QTextEdit>
#include <QDebug>
#include <QRegExp>
#include <QRegularExpression>
//see the git submit widget for details of the syntax Highlighter
@@ -62,7 +62,7 @@ public:
private:
enum State { Header, Comment, Other };
const QTextCharFormat m_commentFormat;
QRegExp m_keywordPattern;
QRegularExpression m_keywordPattern;
const QChar m_hashChar;
};
@@ -97,15 +97,17 @@ void BazaarSubmitHighlighter::highlightBlock(const QString &text)
case Comment:
setFormat(0, text.size(), m_commentFormat);
break;
case Other:
case Other: {
// Format key words ("Task:") italic
if (m_keywordPattern.indexIn(text, 0, QRegExp::CaretAtZero) == 0) {
const QRegularExpressionMatch match = m_keywordPattern.match(text);
if (match.hasMatch()) {
QTextCharFormat charFormat = format(0);
charFormat.setFontItalic(true);
setFormat(0, m_keywordPattern.matchedLength(), charFormat);
setFormat(0, match.capturedLength(), charFormat);
}
break;
}
}
}
@@ -143,7 +145,7 @@ QString BazaarCommitWidget::committer() const
QStringList BazaarCommitWidget::fixedBugs() const
{
return m_bazaarCommitPanelUi.fixedBugsLineEdit->text().split(QRegExp(QLatin1String("\\s+")));
return m_bazaarCommitPanelUi.fixedBugsLineEdit->text().split(QRegularExpression("\\s+"));
}
bool BazaarCommitWidget::isLocalOptionEnabled() const