Commit 8ef8e03e authored by Elvis Angelaccio's avatar Elvis Angelaccio
Browse files

Fix regex porting regression

QAbstractItemModel::match() under the hood uses QRegExp::exactMatch(),
so with QRegularExpression we need to use anchoredPattern() on the pattern.

Regression spotted by a failing dolphinmainwindowtest.
parent fb210d6e
Pipeline #68524 passed with stage
in 4 minutes and 47 seconds
...@@ -476,7 +476,8 @@ QString DolphinViewContainer::caption() const ...@@ -476,7 +476,8 @@ QString DolphinViewContainer::caption() const
} }
KFilePlacesModel *placesModel = DolphinPlacesModelSingleton::instance().placesModel(); KFilePlacesModel *placesModel = DolphinPlacesModelSingleton::instance().placesModel();
const auto& matchedPlaces = placesModel->match(placesModel->index(0,0), KFilePlacesModel::UrlRole, QUrl(url().adjusted(QUrl::StripTrailingSlash).toString(QUrl::FullyEncoded).append("/?")), 1, Qt::MatchRegularExpression); const QString pattern = url().adjusted(QUrl::StripTrailingSlash).toString(QUrl::FullyEncoded).append("/?");
const auto& matchedPlaces = placesModel->match(placesModel->index(0,0), KFilePlacesModel::UrlRole, QRegularExpression::anchoredPattern(pattern), 1, Qt::MatchRegularExpression);
if (!matchedPlaces.isEmpty()) { if (!matchedPlaces.isEmpty()) {
return placesModel->text(matchedPlaces.first()); return placesModel->text(matchedPlaces.first());
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment