forked from qt-creator/qt-creator
Port QtCreator over to use filterRegularExpression
QSortFilterProxyModel::filterRegExp is going to go away in Qt6, so port over to use QRegularExpression instead. This required some changes where setFilterWildcard/FixedString() was being used, as those would instantiate QRegExp based filters in Qt 5, and will use QRegularExpression in Qt 6. Use the generic setFilterRegularExpression here, to keep things portable between 5 and 6. Change-Id: I6379be781aa3821b10ba783c088f82c1a0970911 Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
@@ -264,30 +264,6 @@ private:
|
||||
}
|
||||
};
|
||||
|
||||
class FileFilterModel : public QSortFilterProxyModel
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
FileFilterModel(QObject *parent = nullptr)
|
||||
: QSortFilterProxyModel(parent)
|
||||
{}
|
||||
|
||||
private:
|
||||
bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const override
|
||||
{
|
||||
QModelIndex index = sourceModel()->index(sourceRow, 0, sourceParent);
|
||||
const int rowCount = sourceModel()->rowCount(index);
|
||||
if (rowCount == 0) // No children -> file node!
|
||||
return sourceModel()->data(index).toString().contains(filterRegExp());
|
||||
for (int row = 0; row < rowCount; ++row) {
|
||||
if (filterAcceptsRow(row, index))
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
SelectableFilesDialog::SelectableFilesDialog(const ProjectInfo &projectInfo,
|
||||
const FileInfoProviders &fileInfoProviders,
|
||||
int initialProviderIndex)
|
||||
|
||||
Reference in New Issue
Block a user