diff options
author | Samuel Gaist <samuel.gaist@edeltech.ch> | 2018-06-18 00:04:54 +0200 |
---|---|---|
committer | Samuel Gaist <samuel.gaist@edeltech.ch> | 2018-06-19 08:13:50 +0000 |
commit | 73023f2c8f96f524c68152c21c6eb0f2aea04e3b (patch) | |
tree | 561f619895f9eaba82f458e12b2417a80d0b28a1 | |
parent | 90aad79f98bc5713484f5afea2bbb8ae0ccd6ab2 (diff) |
Migrate manual test's ChartViewer to QRegularExpression
This patch updates the manual test ChartViewer class to use
QRegularExpression in place of QRegExp which is to be
considered deprecated.
Change-Id: I111c6caedea0e95f87c785ecb57cdc2211dedc51
Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io>
-rw-r--r-- | tests/manual/chartviewer/window.cpp | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/tests/manual/chartviewer/window.cpp b/tests/manual/chartviewer/window.cpp index 1e8f03b8..9af09d69 100644 --- a/tests/manual/chartviewer/window.cpp +++ b/tests/manual/chartviewer/window.cpp @@ -48,6 +48,7 @@ #include <QtWidgets/QOpenGLWidget> #include <QtWidgets/QApplication> #include <QtCore/QDebug> +#include <QtCore/QRegularExpression> #include <QtWidgets/QMenu> #include <QtWidgets/QPushButton> @@ -272,13 +273,14 @@ void Window::initializeFromParamaters(const QVariantHash ¶meters) if (parameters.contains("chart")) { QString t = parameters["chart"].toString(); - QRegExp rx("([a-zA-Z0-9_]*)::([a-zA-Z0-9_]*)::([a-zA-Z0-9_]*)"); - int pos = rx.indexIn(t); + QRegularExpression rx("([a-zA-Z0-9_]*)::([a-zA-Z0-9_]*)::([a-zA-Z0-9_]*)"); + QRegularExpressionMatch rmatch; + int pos = t.indexOf(rx, 0, &rmatch); if (pos > -1) { - m_category = rx.cap(1); - m_subcategory = rx.cap(2); - m_name = rx.cap(3); + m_category = rmatch.captured(1); + m_subcategory = rmatch.captured(2); + m_name = rmatch.captured(3); m_templateComboBox->setCurrentIndex(0); } else { |