diff options
author | Samuel Gaist <samuel.gaist@edeltech.ch> | 2018-06-18 00:00:33 +0200 |
---|---|---|
committer | Samuel Gaist <samuel.gaist@edeltech.ch> | 2018-06-19 08:13:47 +0000 |
commit | 90aad79f98bc5713484f5afea2bbb8ae0ccd6ab2 (patch) | |
tree | e25aef292ae70f8bfa2f4069bd7be5fc5f663243 | |
parent | 824b330e2eaab100f0e2a8bb7d60642674b297d9 (diff) |
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 <miikka.heikkinen@qt.io>
-rw-r--r-- | src/charts/chartpresenter.cpp | 5 |
1 files 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 <private/cartesianchartlayout_p.h> #include <private/polarchartlayout_p.h> #include <private/charttitle_p.h> +#include <QtCore/QRegularExpression> #include <QtCore/QTimer> #include <QtGui/QTextDocument> #include <QtWidgets/QGraphicsScene> @@ -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<QString> 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; |