summaryrefslogtreecommitdiffstats
path: root/src/widgets/dialogs/qfilesystemmodel.cpp
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@qt.io>2020-04-15 10:52:51 +0200
committerLars Knoll <lars.knoll@qt.io>2020-05-06 09:57:40 +0200
commitadf829e65d0837c043dbfdfaba49dd145debe954 (patch)
treec45291cbe4ff82b9ec2d5f2ae008066b839dfd1a /src/widgets/dialogs/qfilesystemmodel.cpp
parent56a7984a90992371cd7f54a061dcc791e6f22cfd (diff)
Add a QRegularExpression::fromWildcard() convenience method
Simplify constructing QRegularExpression objects from a glob pattern. Change-Id: I06f60b1dfea3da969e2474dedd44b6ca5d456d7d Reviewed-by: Simon Hausmann <hausmann@gmail.com> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Diffstat (limited to 'src/widgets/dialogs/qfilesystemmodel.cpp')
-rw-r--r--src/widgets/dialogs/qfilesystemmodel.cpp6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/widgets/dialogs/qfilesystemmodel.cpp b/src/widgets/dialogs/qfilesystemmodel.cpp
index 6afdfa6eb9..30d1324248 100644
--- a/src/widgets/dialogs/qfilesystemmodel.cpp
+++ b/src/widgets/dialogs/qfilesystemmodel.cpp
@@ -2148,12 +2148,10 @@ bool QFileSystemModelPrivate::passNameFilters(const QFileSystemNode *node) const
// Check the name regularexpression filters
if (!(node->isDir() && (filters & QDir::AllDirs))) {
- const QRegularExpression::PatternOptions options =
- (filters & QDir::CaseSensitive) ? QRegularExpression::NoPatternOption
- : QRegularExpression::CaseInsensitiveOption;
+ auto cs = (filters & QDir::CaseSensitive) ? Qt::CaseSensitive : Qt::CaseInsensitive;
for (const auto &nameFilter : nameFilters) {
- QRegularExpression rx(QRegularExpression::wildcardToRegularExpression(nameFilter), options);
+ auto rx = QRegularExpression::fromWildcard(nameFilter, cs);
QRegularExpressionMatch match = rx.match(node->fileName);
if (match.hasMatch())
return true;