diff --git a/src/libs/vmisc/vtablesearch.cpp b/src/libs/vmisc/vtablesearch.cpp index 82df0700e..a60eff722 100644 --- a/src/libs/vmisc/vtablesearch.cpp +++ b/src/libs/vmisc/vtablesearch.cpp @@ -93,38 +93,35 @@ void VTableSearch::ShowNext(int newIndex) } } -QList VTableSearch::FindTableItems(QString term) +//--------------------------------------------------------------------------------------------------------------------- +QList VTableSearch::FindTableItems(const QString& term) { if (term.isEmpty()) { return QList(); } - if (term.startsWith("/")) + if (term.startsWith(QChar('/'))) { - QRegularExpression qre("^/(?[^/]+)/(?.+)$"); + QRegularExpression qre(QStringLiteral("^/(?[^/]+)/(?.+)$")); QScopedPointer match(new QRegularExpressionMatch()); if (!term.contains(qre, match.data())) { return QList(); } - auto searchType = match->capturedRef("searchType"); - auto searchString = match->capturedRef("searchString"); - if (searchType == "r") + auto searchType = match->capturedRef(QStringLiteral("searchType")); + auto searchString = match->capturedRef(QStringLiteral("searchString")); + if (searchType == QChar('r')) { QString reSearchString = ".*" % searchString % ".*"; return table->findItems(reSearchString, Qt::MatchRegExp); } - else - { - return QList(); - } - } - else - { - return table->findItems(term, Qt::MatchContains); + + return QList(); } + + return table->findItems(term, Qt::MatchContains); } //--------------------------------------------------------------------------------------------------------------------- diff --git a/src/libs/vmisc/vtablesearch.h b/src/libs/vmisc/vtablesearch.h index 18c1eba6d..bec54fee2 100644 --- a/src/libs/vmisc/vtablesearch.h +++ b/src/libs/vmisc/vtablesearch.h @@ -60,7 +60,7 @@ private: void Clear(); void ShowNext(int newIndex); - QList FindTableItems(QString term); + QList FindTableItems(const QString& term); }; #endif // VTABLESEARCH_H