Details
-
Bug
-
Resolution: Fixed
-
P4: Low
-
5.15.0, 6.3.0
-
None
-
-
4b197c3f5 (dev), 7261a2298 (dev)
Description
I'm not sure if this is a bug in the code or in the documentation, but the behaviour of QListWidget::findItems("*", Qt::MatchWildcard) changed between 5.14 and 5.15, when matching items that contain "/" characters.
I haven't checked the 5.14 implementation, but I figure it's due to changing QAbstractItemModel::match() from using QRegExp to QRegularExpression.
I have attached an example project to demonstrate the 'problem', but it boils down to the fact that QRegularExpression::wildcardToRegularExpression treats path separators as special, while QRegExp doesn't when doing wildcard matching.
The fix in client code is of course simple - change from a wildcard pattern to a regular expression, but, at least for me, this was a surprising change that took a fair while to debug, and I didn't spot anything in the documentation about it. I'm also not that experienced in using QAbstractItemModel, but I'm not sure if users would really expect that using Qt::MatchWildcard should imply that text that happens to contain '/' will be treated specially.
QRegularExpression::wildcardToRegularExpression("*") -> "\\A(?:[^/]*)\\z"
and that no longer matches "a/b".