From 90aad79f98bc5713484f5afea2bbb8ae0ccd6ab2 Mon Sep 17 00:00:00 2001 From: Samuel Gaist Date: Mon, 18 Jun 2018 00:00:33 +0200 Subject: Migrate ChartPresenter to QRegularExpression This patch updates the ChartPresenter to use QRegularExpression in place of QRegExp which is to be considered deprecated. Change-Id: Ibf8ca80af94580b86565c3fc59d23d5d67e1bff1 Reviewed-by: Miikka Heikkinen --- src/charts/chartpresenter.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/charts/chartpresenter.cpp b/src/charts/chartpresenter.cpp index 4ba3e13d..6316e716 100644 --- a/src/charts/chartpresenter.cpp +++ b/src/charts/chartpresenter.cpp @@ -41,6 +41,7 @@ #include #include #include +#include #include #include #include @@ -486,7 +487,7 @@ QString ChartPresenter::truncatedText(const QFont &font, const QString &text, qr // It can be assumed that almost any amount of string manipulation is faster // than calculating one bounding rectangle, so first prepare a list of truncated strings // to try. - static QRegExp truncateMatcher(QStringLiteral("&#?[0-9a-zA-Z]*;$")); + static QRegularExpression truncateMatcher(QStringLiteral("&#?[0-9a-zA-Z]*;$")); QVector testStrings(text.length()); int count(0); @@ -502,7 +503,7 @@ QString ChartPresenter::truncatedText(const QFont &font, const QString &text, qr if (lastChar == closeTag) chopIndex = truncatedString.lastIndexOf(openTag); else if (lastChar == semiColon) - chopIndex = truncateMatcher.indexIn(truncatedString, 0); + chopIndex = truncatedString.indexOf(truncateMatcher); if (chopIndex != -1) chopCount = truncatedString.length() - chopIndex; -- cgit v1.2.3