diff options
author | Samuel Gaist <samuel.gaist@edeltech.ch> | 2017-02-12 21:40:27 +0100 |
---|---|---|
committer | Samuel Gaist <samuel.gaist@edeltech.ch> | 2017-12-30 23:33:50 +0000 |
commit | 83aca24bc4941d1be48719250e64a30a785d1c07 (patch) | |
tree | f59e60f3d74b847b6784f12752e9fa4a880d300c | |
parent | f3f4f95536133c7ec7ef27e5a8263f35cc3bc4b6 (diff) |
Migrate Cocoa QPA backend to use QRegularExpression
This patch updates the Cocoa QPA backend code to use QRegularExpression
in place of the deprecated QRegExp.
Change-Id: I6de2774975e63f8dbff6dad0a842f35c3c4b4f83
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
-rw-r--r-- | src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm | 10 | ||||
-rw-r--r-- | src/plugins/platforms/cocoa/qcocoamenuitem.mm | 4 |
2 files changed, 9 insertions, 5 deletions
diff --git a/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm b/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm index fa123550ef..7ea3d130f7 100644 --- a/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm +++ b/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm @@ -63,7 +63,8 @@ #include <qsysinfo.h> #include <qoperatingsystemversion.h> #include <qglobal.h> -#include <QDir> +#include <qdir.h> +#include <qregularexpression.h> #include <qpa/qplatformnativeinterface.h> @@ -509,9 +510,10 @@ static QString strippedText(QString s) - (QString)removeExtensions:(const QString &)filter { - QRegExp regExp(QString::fromLatin1(QPlatformFileDialogHelper::filterRegExp)); - if (regExp.indexIn(filter) != -1) - return regExp.cap(1).trimmed(); + QRegularExpression regExp(QString::fromLatin1(QPlatformFileDialogHelper::filterRegExp)); + QRegularExpressionMatch match = regExp.match(filter); + if (match.hasMatch()) + return match.captured(1).trimmed(); return filter; } diff --git a/src/plugins/platforms/cocoa/qcocoamenuitem.mm b/src/plugins/platforms/cocoa/qcocoamenuitem.mm index eaf310ec51..f8f9648822 100644 --- a/src/plugins/platforms/cocoa/qcocoamenuitem.mm +++ b/src/plugins/platforms/cocoa/qcocoamenuitem.mm @@ -49,6 +49,7 @@ #include "qcocoaapplication.h" // for custom application category #include "qcocoamenuloader.h" #include <QtGui/private/qcoregraphics_p.h> +#include <QtCore/qregularexpression.h> #include <QtCore/QDebug> @@ -261,7 +262,8 @@ NSMenuItem *QCocoaMenuItem::sync() m_detectedRole = detectMenuRole(m_text); switch (m_detectedRole) { case QPlatformMenuItem::AboutRole: - if (m_text.indexOf(QRegExp(QString::fromLatin1("qt$"), Qt::CaseInsensitive)) == -1) + if (m_text.indexOf(QRegularExpression(QString::fromLatin1("qt$"), + QRegularExpression::CaseInsensitiveOption)) == -1) mergeItem = [loader aboutMenuItem]; else mergeItem = [loader aboutQtMenuItem]; |