From 5ae8fcd17bda45177ae7f65bf1c9f25f30706bb4 Mon Sep 17 00:00:00 2001 From: Samuel Gaist Date: Sat, 29 Sep 2018 00:14:14 +0200 Subject: [PATCH] Migrate QPlatformDialogHelper to QRegularExpression This patch updates the QPlatformDialogHelper class to use QRegularExpression in place of QRegExp which is to be considered deprecated. Change-Id: I8a79c5425217d18a3210c87f7f505b1aa288801d Reviewed-by: Edward Welbourne --- src/gui/kernel/qplatformdialoghelper.cpp | 12 +++++++----- src/gui/kernel/qplatformdialoghelper.h | 2 +- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/gui/kernel/qplatformdialoghelper.cpp b/src/gui/kernel/qplatformdialoghelper.cpp index 8b3a2ad193..d14d575056 100644 --- a/src/gui/kernel/qplatformdialoghelper.cpp +++ b/src/gui/kernel/qplatformdialoghelper.cpp @@ -41,6 +41,7 @@ #include #include +#include #include #if QT_CONFIG(settings) #include @@ -779,18 +780,19 @@ void QPlatformFileDialogHelper::setOptions(const QSharedPointer= 0) - f = regexp.cap(2); + QRegularExpressionMatch match; + filter.indexOf(regexp, 0, &match); + if (match.hasMatch()) + f = match.captured(2); return f.split(QLatin1Char(' '), QString::SkipEmptyParts); } diff --git a/src/gui/kernel/qplatformdialoghelper.h b/src/gui/kernel/qplatformdialoghelper.h index 0832e19dc3..f09bec12da 100644 --- a/src/gui/kernel/qplatformdialoghelper.h +++ b/src/gui/kernel/qplatformdialoghelper.h @@ -414,7 +414,7 @@ public: void setOptions(const QSharedPointer &options); static QStringList cleanFilterList(const QString &filter); - static const char *filterRegExp; + static const char filterRegExp[]; Q_SIGNALS: void fileSelected(const QUrl &file);