In fact setFilterWildcard
in Qt6 already handles the change noted in the porting documentation:
There is no direct way to do wildcard matching in QRegularExpression. However, the wildcardToRegularExpression method is provided to translate glob patterns into a Perl-compatible regular expression that can be used for that purpose.
Qt5
0void QSortFilterProxyModel::setFilterFixedString(const QString &pattern)
1{
2 Q_D(QSortFilterProxyModel);
3 d->filter_about_to_be_changed();
4 QRegExp rx(pattern, d->filter_data.caseSensitivity(), QRegExp::FixedString);
5 d->filter_data.setRegExp(rx);
6 d->filter_changed();
7}
Qt6
0void QSortFilterProxyModel::setFilterWildcard(const QString &pattern)
1{
2 Q_D(QSortFilterProxyModel);
3 d->filter_regularexpression.removeBindingUnlessInWrapper();
4 d->filter_about_to_be_changed();
5 d->set_filter_pattern(QRegularExpression::wildcardToRegularExpression(
6 pattern, QRegularExpression::UnanchoredWildcardConversion));
7 d->filter_changed(QSortFilterProxyModelPrivate::Direction::Rows);
8 d->filter_regularexpression.notify();
9}