forked from qt-creator/qt-creator
Core: Replace some QRegExp by QRegularExpression
Task-number: QTCREATORBUG-24098 Change-Id: I25d90bfdb0c07cea0c076ad7b9f04886d751600a Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -818,14 +818,15 @@ QString DocumentManager::getSaveFileName(const QString &title, const QString &pa
|
||||
// first one from the filter is appended.
|
||||
if (selectedFilter && *selectedFilter != Utils::allFilesFilterString()) {
|
||||
// Mime database creates filter strings like this: Anything here (*.foo *.bar)
|
||||
QRegExp regExp(QLatin1String(".*\\s+\\((.*)\\)$"));
|
||||
const int index = regExp.lastIndexIn(*selectedFilter);
|
||||
if (index != -1) {
|
||||
const QRegularExpression regExp(QLatin1String(".*\\s+\\((.*)\\)$"));
|
||||
QRegularExpressionMatchIterator matchIt = regExp.globalMatch(*selectedFilter);
|
||||
if (matchIt.hasNext()) {
|
||||
bool suffixOk = false;
|
||||
QString caption = regExp.cap(1);
|
||||
const QRegularExpressionMatch match = matchIt.next();
|
||||
QString caption = match.captured(1);
|
||||
caption.remove(QLatin1Char('*'));
|
||||
const QVector<QStringRef> suffixes = caption.splitRef(QLatin1Char(' '));
|
||||
foreach (const QStringRef &suffix, suffixes)
|
||||
for (const QStringRef &suffix : suffixes)
|
||||
if (fileName.endsWith(suffix)) {
|
||||
suffixOk = true;
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user