diff options
author | Luke Dashjr <luke-jr+git@utopios.org> | 2020-12-15 22:21:26 +0000 |
---|---|---|
committer | Luke Dashjr <luke-jr+git@utopios.org> | 2020-12-15 22:21:26 +0000 |
commit | 198fff88f385e090b57a0ee902719bcc22a6b86b (patch) | |
tree | 9af84de02c5bab9ed7c9090694ef2d90f849f4f3 /src/qt/bitcoinunits.cpp | |
parent | 831675c8dccfa6525ffe751da3cc60709c380953 (diff) | |
download | bitcoin-198fff88f385e090b57a0ee902719bcc22a6b86b.tar.xz |
GUI: Define MAX_DIGITS_BTC for magic number in BitcoinUnits::format
Diffstat (limited to 'src/qt/bitcoinunits.cpp')
-rw-r--r-- | src/qt/bitcoinunits.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/qt/bitcoinunits.cpp b/src/qt/bitcoinunits.cpp index fd55c547fc..5402ed371d 100644 --- a/src/qt/bitcoinunits.cpp +++ b/src/qt/bitcoinunits.cpp @@ -8,6 +8,8 @@ #include <cassert> +static constexpr auto MAX_DIGITS_BTC = 16; + BitcoinUnits::BitcoinUnits(QObject *parent): QAbstractListModel(parent), unitlist(availableUnits()) @@ -108,7 +110,9 @@ QString BitcoinUnits::format(int unit, const CAmount& nIn, bool fPlus, Separator qint64 n_abs = (n > 0 ? n : -n); qint64 quotient = n_abs / coin; QString quotient_str = QString::number(quotient); - if (justify) quotient_str = quotient_str.rightJustified(16 - num_decimals, ' '); + if (justify) { + quotient_str = quotient_str.rightJustified(MAX_DIGITS_BTC - num_decimals, ' '); + } // Use SI-style thin space separators as these are locale independent and can't be // confused with the decimal marker. |