mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-03-25 06:55:32 +01:00
GUI: Define MAX_DIGITS_BTC for magic number in BitcoinUnits::format
This commit is contained in:
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user