summaryrefslogtreecommitdiffstats
path: root/examples/widgets/painting/shared
diff options
context:
space:
mode:
authorSamuel Gaist <samuel.gaist@edeltech.ch>2017-01-21 21:52:20 +0100
committerSamuel Gaist <samuel.gaist@edeltech.ch>2017-02-15 14:45:45 +0000
commitbeb98bdafc7d935268d4e98888ba0ba3c85cf92d (patch)
treec0775c397f150a3e6307dca8cf5018df10a16f2c /examples/widgets/painting/shared
parentd2e713f3fd591ca9879318f5691709a2cd362d1c (diff)
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 <szehowe.koh@gmail.com>
Diffstat (limited to 'examples/widgets/painting/shared')
-rw-r--r--examples/widgets/painting/shared/arthurwidgets.cpp9
1 files changed, 4 insertions, 5 deletions
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 <QFile>
#include <QTextBrowser>
#include <QBoxLayout>
+#include <QRegularExpression>
extern QPixmap cached(const QString &img);
@@ -339,14 +340,12 @@ void ArthurFrame::showSource()
foreach (QString keyword, ppKeywords)
contents.replace(keyword, QLatin1String("<font color=navy>") + keyword + QLatin1String("</font>"));
- contents.replace(QRegExp("(\\d\\d?)"), QLatin1String("<font color=navy>\\1</font>"));
+ contents.replace(QRegularExpression("(\\d\\d?)"), QLatin1String("<font color=navy>\\1</font>"));
- QRegExp commentRe("(//.+)\\n");
- commentRe.setMinimal(true);
+ QRegularExpression commentRe("(//.+?)\\n");
contents.replace(commentRe, QLatin1String("<font color=red>\\1</font>\n"));
- QRegExp stringLiteralRe("(\".+\")");
- stringLiteralRe.setMinimal(true);
+ QRegularExpression stringLiteralRe("(\".+?\")");
contents.replace(stringLiteralRe, QLatin1String("<font color=green>\\1</font>"));
QString html = contents;