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:
Charles Kerr
2020-05-29 12:40:07 -05:00
committed by GitHub
parent 070a7f2ffc
commit 1f28470cf4
24 changed files with 175 additions and 175 deletions

View File

@@ -39,7 +39,7 @@ int AddData::set(QString const& key)
}
else if (Utils::isHexHashcode(key))
{
magnet = QString::fromUtf8("magnet:?xt=urn:btih:") + key;
magnet = QStringLiteral("magnet:?xt=urn:btih:") + key;
type = MAGNET;
}
else