Skip to content

Commit

Permalink
Define MAX_DIGITS_BTC for magic number in BitcoinUnits::format
Browse files Browse the repository at this point in the history
  • Loading branch information
barton2526 committed Aug 1, 2022
1 parent 99be598 commit a9e30da
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/qt/bitcoinunits.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@

#include <QStringList>

static constexpr auto MAX_DIGITS_GRC = 16;

BitcoinUnits::BitcoinUnits(QObject *parent):
QAbstractListModel(parent),
unitlist(availableUnits())
Expand Down Expand Up @@ -99,7 +101,9 @@ QString BitcoinUnits::format(int unit, qint64 n, bool fPlus, bool justify)
qint64 remainder = 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_GRC - num_decimals, ' ');
}

QString remainder_str = QString::number(remainder).rightJustified(num_decimals, '0');

Expand Down

0 comments on commit a9e30da

Please sign in to comment.