diff options
-rw-r--r-- | examples/widgets/painting/shared/arthurwidgets.cpp | 9 |
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; |