ProWriter: Port to QRegularExpression

Change-Id: I2b3173f5ad852c8930e8207d97faec26951c6097
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
Andre Hartmann
2017-04-24 21:38:20 +02:00
committed by André Hartmann
parent 8c8e8d9dd5
commit dcac6afcad

View File

@@ -28,8 +28,8 @@
#include "proitems.h"
#include <QDir>
#include <QRegExp>
#include <QPair>
#include <QRegularExpression>
using namespace QmakeProjectManager::Internal;
@@ -354,9 +354,11 @@ void ProWriter::putVarValues(ProFile *profile, QStringList *lines, const QString
if (scopeStart < 0) {
added = QLatin1Char('\n') + scope + QLatin1String(" {");
} else {
QRegExp rx(QLatin1String("(\\s*") + scope + QLatin1String("\\s*:\\s*)[^\\s{].*"));
if (rx.exactMatch(lines->at(scopeStart))) {
(*lines)[scopeStart].replace(0, rx.cap(1).length(),
// TODO use anchoredPattern() once Qt 5.12 is mandatory
const QRegularExpression rx("\\A(\\s*" + scope + "\\s*:\\s*)[^\\s{].*\\z");
const QRegularExpressionMatch match(rx.match(lines->at(scopeStart)));
if (match.hasMatch()) {
(*lines)[scopeStart].replace(0, match.captured(1).length(),
QString(scope + QLatin1String(" {\n")
+ continuationIndent));
contInfo = skipContLines(lines, scopeStart, false);