Port QRegExp::exactMatch() with QRegularExpression::anchoredPattern().
Port QRegExp::Wildcard with QRegularExpression::wildcardToRegularExpression().
Note that QRegularExpression::wildcardToRegularExpression() returns an anchored
pattern.
Details
- Reviewers
elvisangelaccio meven - Group Reviewers
Dolphin - Commits
- R318:e3c03e466ea5: Port QRegExp to QRegularExpression
Using the filter bar in dolphin works as before.
All unit tests pass, except:
- kfileitemmodeltest (which is unrelated AFAICS); it fails on master too
- placesitemmodeltest, which fails on master too
Diff Detail
- Repository
- R318 Dolphin
- Branch
- l-qregularexpression (branched from master)
- Lint
No Linters Available - Unit
No Unit Test Coverage - Build Status
Buildable 22207 Build 22225: arc lint + arc unit
src/views/dolphinview.h | ||
---|---|---|
191 | s/QRegulrExpresssion/QRegularExpresssion |
I couldn't test the "selection dialog" part as I don't see an Edit -> "Select itmes matching" menu entry in Dolphin.
KFileItemModelFilter still uses QRegExp as there's no equivalent in QRegularExpression
to QRegExp::WildcardUnix.
Is there any plan to fix this upstream in Qt?
src/dolphinpart.cpp | ||
---|---|---|
510–511 | Please use a single line. |
I have no idea. According to QRegExp docs:
In the mode Wildcard, the wildcard characters cannot be escaped. In the mode WildcardUnix, the character '\' escapes the wildcard.
(I am all for using a full regex, it's more predictable).
What about QRegularExpression::wildcardToRegularExpression() ? Could we use that? Note that the filter string comes from user input (i.e. from the filter bar).
I've just tested; it can be used, with the same caveat as the QRegExp docs have about WildcardUnix, a wildcard can't be escaped with a \:
*.txt would show all files with a .txt extension
- would show all files
\* _won't_ show files with a literal "*" in their names
Looks good enough to me, if you agree I'll update the diff.
Actually *\* currently works and with this patch won't work anymore, but IMHO this should be fixed in Qt.
QRegExp is deprecated anyway and will probably be removed in Qt 6. Let's get rid of it.