Qt6 migration

This commit is contained in:
eelke 2021-03-06 13:13:31 +01:00
parent 87553b2554
commit 423043d431
19 changed files with 64 additions and 87 deletions

View file

@ -5,7 +5,7 @@
void FormatToStream(QTextStream &stream, QString format, std::function<void(QTextStream &, QString)> field_callback)
{
// Use static to optimize only once
static QRegularExpression cached_find_var_re("(?:[^\\\\]|^)(\\/%([a-zA-Z0-9_-]+)%\\/)", QRegularExpression::OptimizeOnFirstUsageOption);
static QRegularExpression cached_find_var_re("(?:[^\\\\]|^)(\\/%([a-zA-Z0-9_-]+)%\\/)");
int from = 0;
QRegularExpressionMatch match;
@ -17,7 +17,7 @@ void FormatToStream(QTextStream &stream, QString format, std::function<void(QTex
++from;
}
// copy code before the var to the stream
stream << format.midRef(from, match.capturedStart(1) - from);
stream << format.mid(from, match.capturedStart(1) - from);
field_callback(stream, match.captured(2));
from = match.capturedEnd()-1; // -1 because it wants to match one character before or start of line to make sure there is no backslash
}
@ -25,5 +25,5 @@ void FormatToStream(QTextStream &stream, QString format, std::function<void(QTex
// same reason as at the start of the loop
++from;
}
stream << format.midRef(from);
stream << format.mid(from);
}