Core: replace QRegExp with QRegularExpression

This commit is contained in:
wmayer
2022-10-06 13:54:20 +02:00
parent 4ca1b838a9
commit 75bfb8f48f
11 changed files with 99 additions and 62 deletions

View File

@@ -32,6 +32,8 @@
# include <QLocale>
# include <QMessageBox>
# include <QMessageLogContext>
# include <QRegularExpression>
# include <QRegularExpressionMatch>
# include <QStatusBar>
# include <QStyle>
# include <QTextStream>
@@ -1403,13 +1405,13 @@ bool Application::activateWorkbench(const char* name)
catch (Py::Exception&) {
Base::PyException e; // extract the Python error text
QString msg = QString::fromUtf8(e.what());
QRegExp rx;
QRegularExpression rx;
// ignore '<type 'exceptions.ImportError'>' prefixes
rx.setPattern(QLatin1String("^\\s*<type 'exceptions.ImportError'>:\\s*"));
int pos = rx.indexIn(msg);
while ( pos != -1 ) {
msg = msg.mid(rx.matchedLength());
pos = rx.indexIn(msg);
auto match = rx.match(msg);
while (match.hasMatch()) {
msg = msg.mid(match.capturedLength());
match = rx.match(msg);
}
Base::Console().Error("%s\n", (const char*)msg.toUtf8());