mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-13 12:33:42 +02:00
Bugfix: GUI: Ensure negative symbol is before whole number in GUIUtil::formatAssetAmount
Fixes: https://github.com/greenaddress/elements/issues/5
This commit is contained in:
parent
36ebb131dc
commit
d522775b80
1 changed files with 6 additions and 2 deletions
|
|
@ -788,9 +788,13 @@ QString formatAssetAmount(const CAsset& asset, const CAmount& amount, const int
|
|||
}
|
||||
}
|
||||
|
||||
qlonglong whole = amount / 100000000;
|
||||
qlonglong fraction = amount % 100000000;
|
||||
qlonglong abs = qAbs(amount);
|
||||
qlonglong whole = abs / 100000000;
|
||||
qlonglong fraction = abs % 100000000;
|
||||
QString str = QString("%1").arg(whole);
|
||||
if (amount < 0) {
|
||||
str.insert(0, '-');
|
||||
}
|
||||
if (fraction) {
|
||||
str += QString(".%1").arg(fraction, 8, 10, QLatin1Char('0'));
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue