mirror of
https://github.com/transmission/transmission.git
synced 2025-12-24 12:28:52 +00:00
chore: prefer QStringLiteral (#1284)
Further reading: * https://forum.qt.io/topic/78540/qstringliteral-vs-qlatin1string/2 * https://woboq.com/blog/qstringliteral.html * https://www.qt.io/blog/2014/06/13/qt-weekly-13-qstringliteral tl;dr: QLatin1Literal uses less memory than QStringLiteral; however, since most Qt APIs require a QString argument, there's extra runtime cost of converting QLatin1Strings to QStrings. QStringLiteral uses a little more memory but constructs its QStrings at compile time. ok, the `prefer-qstringliteral` branch is getting out of control: the secondary goal of fixing a .clang-tidy issue is causing more diffs than the primary goal. So, I'm breaking it into two separate PRs.
This commit is contained in:
@@ -91,13 +91,13 @@ void FileTreeView::resizeEvent(QResizeEvent* event)
|
||||
case FileTreeModel::COL_SIZE:
|
||||
for (int s = Formatter::B; s <= Formatter::TB; ++s)
|
||||
{
|
||||
item_texts << QLatin1String("999.9 ") + Formatter::unitStr(Formatter::MEM, static_cast<Formatter::Size>(s));
|
||||
item_texts << QStringLiteral("999.9 ") + Formatter::unitStr(Formatter::MEM, static_cast<Formatter::Size>(s));
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case FileTreeModel::COL_PROGRESS:
|
||||
item_texts << QLatin1String(" 100% ");
|
||||
item_texts << QStringLiteral(" 100% ");
|
||||
break;
|
||||
|
||||
case FileTreeModel::COL_WANTED:
|
||||
|
||||
Reference in New Issue
Block a user