More QRegularExpression and include for Qt 6

Task-number: QTCREATORBUG-24098
Change-Id: Ia537e26efd3f37319c38d906e569b255768371f9
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
hjk
2020-06-23 13:00:43 +02:00
parent 5a091c3d98
commit 03838decb9
8 changed files with 38 additions and 29 deletions

View File

@@ -377,16 +377,17 @@ void PythonBuildSystem::parse()
*/
static void expandEnvironmentVariables(const QProcessEnvironment &env, QString &string)
{
static QRegExp candidate(QLatin1String("\\$\\$\\((.+)\\)"));
const QRegularExpression candidate("\\$\\$\\((.+)\\)");
int index = candidate.indexIn(string);
QRegularExpressionMatch match;
int index = string.indexOf(candidate, 0, &match);
while (index != -1) {
const QString value = env.value(candidate.cap(1));
const QString value = env.value(match.captured(1));
string.replace(index, candidate.matchedLength(), value);
string.replace(index, match.capturedLength(), value);
index += value.length();
index = candidate.indexIn(string, index);
index = string.indexOf(candidate, index, &match);
}
}

View File

@@ -86,7 +86,7 @@ private:
if (match.hasMatch()) {
const LinkSpec link(match.capturedStart(2), match.capturedLength(2), match.captured(2));
const auto fileName = FilePath::fromString(match.captured(3));
const int lineNumber = match.capturedRef(4).toInt();
const int lineNumber = match.captured(4).toInt();
m_tasks.append({Task::Warning, QString(), fileName, lineNumber, category});
return {Status::InProgress, {link}};
}
@@ -121,7 +121,7 @@ private:
if (!match.hasMatch())
return false;
const QString fileName = match.captured(3);
const int lineNumber = match.capturedRef(4).toInt();
const int lineNumber = match.captured(4).toInt();
Core::EditorManager::openEditorAt(fileName, lineNumber);
return true;
}