summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSamuel Gaist <samuel.gaist@idiap.ch>2018-12-02 14:30:39 +0100
committerSamuel Gaist <samuel.gaist@idiap.ch>2018-12-04 07:32:15 +0000
commitcfb917948799cb177b3de7eced77f37d13b4e520 (patch)
tree526b2ae64cd2524048aa2ceaa7ea57561776c21f
parent7bafbdc91f83165710ed74639b76b48b4494937a (diff)
Port Nokia geo service plugin to QRegularExpression
This patch updates the Nokia geo service plugin code to use QRegularExpression in place of QRegExp which is to be considered deprecated. Change-Id: Idc7459351c6f1a1b12ba1528c426fced324039a1 Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
-rw-r--r--src/plugins/geoservices/nokia/qplacemanagerengine_nokiav2.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/plugins/geoservices/nokia/qplacemanagerengine_nokiav2.cpp b/src/plugins/geoservices/nokia/qplacemanagerengine_nokiav2.cpp
index ab575463..5094b72e 100644
--- a/src/plugins/geoservices/nokia/qplacemanagerengine_nokiav2.cpp
+++ b/src/plugins/geoservices/nokia/qplacemanagerengine_nokiav2.cpp
@@ -52,6 +52,7 @@
#include <QtCore/QJsonArray>
#include <QtCore/QJsonDocument>
#include <QtCore/QJsonObject>
+#include <QtCore/QRegularExpression>
#include <QtCore/QStandardPaths>
#include <QtCore/QUrlQuery>
#include <QtNetwork/QNetworkProxy>
@@ -690,13 +691,14 @@ QPlaceIcon QPlaceManagerEngineNokiaV2::icon(const QString &remotePath,
QPlaceIcon icon;
QVariantMap params;
- QRegExp rx("(.*)(/icons/categories/.*)");
+ QRegularExpression rx("(.*)(/icons/categories/.*)");
+ QRegularExpressionMatch match = rx.match(remotePath);
QString iconPrefix;
QString nokiaIcon;
- if (rx.indexIn(remotePath) != -1 && !rx.cap(1).isEmpty() && !rx.cap(2).isEmpty()) {
- iconPrefix = rx.cap(1);
- nokiaIcon = rx.cap(2);
+ if (match.hasMatch() && !match.capturedRef(1).isEmpty() && !match.capturedRef(2).isEmpty()) {
+ iconPrefix = match.captured(1);
+ nokiaIcon = match.captured(2);
if (QFile::exists(m_localDataPath + nokiaIcon))
iconPrefix = QString::fromLatin1("file://") + m_localDataPath;