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>
This commit is contained in:
parent
f3f4f95536
commit
83aca24bc4
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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];
|
||||
|
Loading…
x
Reference in New Issue
Block a user