From b03706d35f556fbaa91d4e05ee7a337220e174b8 Mon Sep 17 00:00:00 2001 From: Samuel Gaist Date: Sun, 29 Jan 2017 23:52:10 +0100 Subject: Migrate QStandardPaths to use QRegularExpression This patch updates the code from the unix implementation of QStandardPaths to use QRegularExpression in place of the deprecated QRegExp. Change-Id: I51fa231dcd70ca55d1bfffb31d8f28f964ac44fe Reviewed-by: Edward Welbourne Reviewed-by: David Faure --- src/corelib/io/qstandardpaths_unix.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src/corelib/io/qstandardpaths_unix.cpp') diff --git a/src/corelib/io/qstandardpaths_unix.cpp b/src/corelib/io/qstandardpaths_unix.cpp index f0ff46fe7f..d06778e2a1 100644 --- a/src/corelib/io/qstandardpaths_unix.cpp +++ b/src/corelib/io/qstandardpaths_unix.cpp @@ -42,6 +42,7 @@ #include #include #include +#include #include #include #include @@ -179,11 +180,12 @@ QString QStandardPaths::writableLocation(StandardLocation type) QHash lines; QTextStream stream(&file); // Only look for lines like: XDG_DESKTOP_DIR="$HOME/Desktop" - QRegExp exp(QLatin1String("^XDG_(.*)_DIR=(.*)$")); + QRegularExpression exp(QLatin1String("^XDG_(.*)_DIR=(.*)$")); while (!stream.atEnd()) { const QString &line = stream.readLine(); - if (exp.indexIn(line) != -1) { - const QStringList lst = exp.capturedTexts(); + QRegularExpressionMatch match = exp.match(line); + if (match.hasMatch()) { + const QStringList lst = match.capturedTexts(); const QString key = lst.at(1); QString value = lst.at(2); if (value.length() > 2 -- cgit v1.2.3