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