Fix regular expression initialize with incorrect filters

The filters used to construct regular expression is the parameter of
QDirIteratorPrivate constructor,and not the member variable
'filters' of QDirIteratorPrivate.

When using filters as QDir::NoFilter to construct QDirIteratorPrivate,
then the regular expression will incorrectly initialize with
QDir::CaseSensitive(result of QDir::NoFilter),and not
Qt::CaseInsensitive(result of QDir::AllEntries).

Therefore, using the '_filters' to replace the parameter 'filters'

Fixes: QTBUG-88227
Pick-to: 5.15
Change-Id: I8a21fe1075fd95981e328a161a978e4fe546c9ca
Reviewed-by: Simon Hausmann <hausmann@gmail.com>
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
This commit is contained in:
Zhang Yu 2020-11-08 21:12:40 +08:00
parent 8b086b49b4
commit f353519e78

View File

@ -125,7 +125,7 @@ class QDirIteratorPrivate
{
public:
QDirIteratorPrivate(const QFileSystemEntry &entry, const QStringList &nameFilters,
QDir::Filters filters, QDirIterator::IteratorFlags flags, bool resolveEngine = true);
QDir::Filters _filters, QDirIterator::IteratorFlags flags, bool resolveEngine = true);
void advance();
@ -161,10 +161,10 @@ public:
\internal
*/
QDirIteratorPrivate::QDirIteratorPrivate(const QFileSystemEntry &entry, const QStringList &nameFilters,
QDir::Filters filters, QDirIterator::IteratorFlags flags, bool resolveEngine)
QDir::Filters _filters, QDirIterator::IteratorFlags flags, bool resolveEngine)
: dirEntry(entry)
, nameFilters(nameFilters.contains(QLatin1String("*")) ? QStringList() : nameFilters)
, filters(QDir::NoFilter == filters ? QDir::AllEntries : filters)
, filters(QDir::NoFilter == _filters ? QDir::AllEntries : _filters)
, iteratorFlags(flags)
{
#if QT_CONFIG(regularexpression)