Refactoring. Fixing static analyzers warnings.
--HG-- branch : develop
This commit is contained in:
parent
ba08ed4d1d
commit
7e89a13476
|
@ -93,39 +93,36 @@ void VTableSearch::ShowNext(int newIndex)
|
|||
}
|
||||
}
|
||||
|
||||
QList<QTableWidgetItem *> VTableSearch::FindTableItems(QString term)
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QList<QTableWidgetItem *> VTableSearch::FindTableItems(const QString& term)
|
||||
{
|
||||
if (term.isEmpty())
|
||||
{
|
||||
return QList<QTableWidgetItem *>();
|
||||
}
|
||||
|
||||
if (term.startsWith("/"))
|
||||
if (term.startsWith(QChar('/')))
|
||||
{
|
||||
QRegularExpression qre("^/(?<searchType>[^/]+)/(?<searchString>.+)$");
|
||||
QRegularExpression qre(QStringLiteral("^/(?<searchType>[^/]+)/(?<searchString>.+)$"));
|
||||
QScopedPointer<QRegularExpressionMatch> match(new QRegularExpressionMatch());
|
||||
if (!term.contains(qre, match.data()))
|
||||
{
|
||||
return QList<QTableWidgetItem *>();
|
||||
}
|
||||
|
||||
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<QTableWidgetItem *>();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
return table->findItems(term, Qt::MatchContains);
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VTableSearch::Find(const QString &term)
|
||||
|
|
|
@ -60,7 +60,7 @@ private:
|
|||
|
||||
void Clear();
|
||||
void ShowNext(int newIndex);
|
||||
QList<QTableWidgetItem *> FindTableItems(QString term);
|
||||
QList<QTableWidgetItem *> FindTableItems(const QString& term);
|
||||
};
|
||||
|
||||
#endif // VTABLESEARCH_H
|
||||
|
|
Loading…
Reference in New Issue
Block a user