mirror of
https://github.com/Retropex/bitcoin.git
synced 2025-05-29 13:32:33 +02:00
GUI: Define MAX_DIGITS_BTC for magic number in BitcoinUnits::format
This commit is contained in:
parent
831675c8dc
commit
198fff88f3
@ -8,6 +8,8 @@
|
|||||||
|
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
|
|
||||||
|
static constexpr auto MAX_DIGITS_BTC = 16;
|
||||||
|
|
||||||
BitcoinUnits::BitcoinUnits(QObject *parent):
|
BitcoinUnits::BitcoinUnits(QObject *parent):
|
||||||
QAbstractListModel(parent),
|
QAbstractListModel(parent),
|
||||||
unitlist(availableUnits())
|
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 n_abs = (n > 0 ? n : -n);
|
||||||
qint64 quotient = n_abs / coin;
|
qint64 quotient = n_abs / coin;
|
||||||
QString quotient_str = QString::number(quotient);
|
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
|
// Use SI-style thin space separators as these are locale independent and can't be
|
||||||
// confused with the decimal marker.
|
// confused with the decimal marker.
|
||||||
|
Loading…
Reference in New Issue
Block a user