From beb98bdafc7d935268d4e98888ba0ba3c85cf92d Mon Sep 17 00:00:00 2001 From: Samuel Gaist Date: Sat, 21 Jan 2017 21:52:20 +0100 Subject: Example: migrate the arthur code sample to use QRegularExpression Update the arthur code sample to use the new QRegularExpression class in place of the deprecated QRegExp. Change-Id: Ic7efd4466b4c0fa50170b80ebb22fcb3624399ce Reviewed-by: Sze Howe Koh --- examples/widgets/painting/shared/arthurwidgets.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'examples') diff --git a/examples/widgets/painting/shared/arthurwidgets.cpp b/examples/widgets/painting/shared/arthurwidgets.cpp index ffed01a3f3..965660a3a3 100644 --- a/examples/widgets/painting/shared/arthurwidgets.cpp +++ b/examples/widgets/painting/shared/arthurwidgets.cpp @@ -59,6 +59,7 @@ #include #include #include +#include extern QPixmap cached(const QString &img); @@ -339,14 +340,12 @@ void ArthurFrame::showSource() foreach (QString keyword, ppKeywords) contents.replace(keyword, QLatin1String("") + keyword + QLatin1String("")); - contents.replace(QRegExp("(\\d\\d?)"), QLatin1String("\\1")); + contents.replace(QRegularExpression("(\\d\\d?)"), QLatin1String("\\1")); - QRegExp commentRe("(//.+)\\n"); - commentRe.setMinimal(true); + QRegularExpression commentRe("(//.+?)\\n"); contents.replace(commentRe, QLatin1String("\\1\n")); - QRegExp stringLiteralRe("(\".+\")"); - stringLiteralRe.setMinimal(true); + QRegularExpression stringLiteralRe("(\".+?\")"); contents.replace(stringLiteralRe, QLatin1String("\\1")); QString html = contents; -- cgit v1.2.3