LSP: Port to QRegularExpression

Task-number: 24098
Change-Id: Ic7efcf3bb3d268e52ac545a72e5188c5affda004
Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
hjk
2020-06-09 13:13:53 +02:00
parent e069293a4b
commit 1f303ffcc5

View File

@@ -370,10 +370,12 @@ bool DocumentFilter::applies(const Utils::FilePath &fileName, const Utils::MimeT
return true; return true;
} }
if (Utils::optional<QString> _pattern = pattern()) { if (Utils::optional<QString> _pattern = pattern()) {
QRegExp regexp(_pattern.value(), QRegularExpression::PatternOption option;
Utils::HostOsInfo::fileNameCaseSensitivity(), if (Utils::HostOsInfo::fileNameCaseSensitivity() == Qt::CaseInsensitive)
QRegExp::Wildcard); option = QRegularExpression::CaseInsensitiveOption;
if (regexp.exactMatch(fileName.toString())) QRegularExpression regexp(QRegularExpression::wildcardToRegularExpression(_pattern.value()),
option);
if (regexp.match(fileName.toString()).hasMatch())
return true; return true;
} }
if (Utils::optional<QString> _lang = language()) { if (Utils::optional<QString> _lang = language()) {