Reduce function call overhead

The arg() function of the QString class has a variable length argument
which allows to reduce the number of chained calls to the same function.
With proper formatting, readability is not affected.
This commit is contained in:
Gianluca Recchia 2018-10-28 12:23:06 +01:00
parent 18fd20f898
commit a67a574b89
No known key found for this signature in database
GPG key ID: 3C2B4128D9A1F218
8 changed files with 30 additions and 40 deletions

View file

@ -36,9 +36,9 @@ void CsvParserModel::setFilename(const QString& filename)
QString CsvParserModel::getFileInfo()
{
QString a(tr("%1, %2, %3", "file info: bytes, rows, columns")
.arg(tr("%n byte(s)", nullptr, getFileSize()))
.arg(tr("%n row(s)", nullptr, getCsvRows()))
.arg(tr("%n column(s)", nullptr, qMax(0, getCsvCols() - 1))));
.arg(tr("%n byte(s)", nullptr, getFileSize()),
tr("%n row(s)", nullptr, getCsvRows()),
tr("%n column(s)", nullptr, qMax(0, getCsvCols() - 1))));
return a;
}