mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-11 14:38:29 +01:00
Merge bitcoin-core/gui#313: qt: Optimize string concatenation by default
a02c970eb0qt, refactor: Revert explicit including QStringBuilder (Hennadii Stepanov)3fd3a0fc87qt, build: Optimize string concatenation (Hennadii Stepanov) Pull request description: From [Qt docs](https://doc.qt.io/qt-5/qstring.html#more-efficient-string-construction): > ... multiple uses of the \[`QString`\] '+' operator usually means multiple memory allocations. When concatenating n substrings, where n > 2, there can be as many as n - 1 calls to the memory allocator. With this PR > ... the '+' will automatically be performed as the `QStringBuilder` '%' everywhere. The change in the `src/Makefile.qt.include` file does not justify submitting this PR into the main repo, IMHO. ACKs for top commit: laanwj: Code review ACKa02c970eb0Talkless: utACKa02c970eb0, built successfully on Debian Sid with Qt 5.15.2, but did not check if any displayed strings are "wrong" after refactoring. jarolrod: ACKa02c970eb0Tree-SHA512: cbb476ee96f27c3bd6e125efab74d8bf24bbdb4c30576b3feea45e203405f3bf5b497dd7d3e11361fc825fcbf4b893b152921a9efdeaf73b42d1865d85f0ae84
This commit is contained in:
@@ -25,6 +25,8 @@
|
||||
#include <QDateTime>
|
||||
#include <QDebug>
|
||||
#include <QIcon>
|
||||
#include <QLatin1Char>
|
||||
#include <QLatin1String>
|
||||
#include <QList>
|
||||
|
||||
|
||||
@@ -413,9 +415,9 @@ QVariant TransactionTableModel::txAddressDecoration(const TransactionRecord *wtx
|
||||
QString TransactionTableModel::formatTxToAddress(const TransactionRecord *wtx, bool tooltip) const
|
||||
{
|
||||
QString watchAddress;
|
||||
if (tooltip) {
|
||||
if (tooltip && wtx->involvesWatchAddress) {
|
||||
// Mark transactions involving watch-only addresses by adding " (watch-only)"
|
||||
watchAddress = wtx->involvesWatchAddress ? QString(" (") + tr("watch-only") + QString(")") : "";
|
||||
watchAddress = QLatin1String(" (") + tr("watch-only") + QLatin1Char(')');
|
||||
}
|
||||
|
||||
switch(wtx->type)
|
||||
|
||||
Reference in New Issue
Block a user