summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSamuel Gaist <samuel.gaist@edeltech.ch>2018-06-21 00:19:26 +0200
committerSamuel Gaist <samuel.gaist@idiap.ch>2019-01-12 22:36:54 +0000
commit4617faa7fae3deda5690dade4b64785ac215e16c (patch)
tree2f0a91959711d1fb838f808c0fca5ba064c0e07e
parenta29d83ff4bbab71fc2f8af77594a9aff997c2b2a (diff)
Migrate QGstUtils to use QRegularExpression
This patch updates the QGstUtils class to use QRegularExpression in place of QRegExp which is to be considered deprecated. Fixes: QTBUG-72589 Change-Id: I67e189c48688b512cc76c884fd2a7e51e1b188f9 Reviewed-by: VaL Doroshchuk <valentyn.doroshchuk@qt.io>
-rw-r--r--src/gsttools/qgstutils.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/gsttools/qgstutils.cpp b/src/gsttools/qgstutils.cpp
index 6960ff8f4..24372f7ae 100644
--- a/src/gsttools/qgstutils.cpp
+++ b/src/gsttools/qgstutils.cpp
@@ -44,6 +44,7 @@
#include <QtCore/qdir.h>
#include <QtCore/qbytearray.h>
#include <QtCore/qvariant.h>
+#include <QtCore/qregularexpression.h>
#include <QtCore/qsize.h>
#include <QtCore/qset.h>
#include <QtCore/qstringlist.h>
@@ -804,7 +805,7 @@ QSet<QString> QGstUtils::supportedMimeTypes(bool (*isValidFactory)(GstElementFac
if (value) {
gchar *str = gst_value_serialize(value);
QString versions = QLatin1String(str);
- const QStringList elements = versions.split(QRegExp(QLatin1String("\\D+")), QString::SkipEmptyParts);
+ const QStringList elements = versions.split(QRegularExpression(QLatin1String("\\D+")), QString::SkipEmptyParts);
for (const QString &e : elements)
supportedMimeTypes.insert(nameLowcase + e);
g_free(str);
@@ -1466,10 +1467,11 @@ QString QGstUtils::fileExtensionForMimeType(const QString &mimeType)
if (!extension.isEmpty() || format.isEmpty())
return extension;
- QRegExp rx(QStringLiteral("[-/]([\\w]+)$"));
+ QRegularExpression rx(QStringLiteral("[-/]([\\w]+)$"));
+ QRegularExpressionMatch match = rx.match(format);
- if (rx.indexIn(format) != -1)
- extension = rx.cap(1);
+ if (match.hasMatch())
+ extension = match.captured(1);
return extension;
}