qt: Use fixed-point arithmetic in amount spinbox
Fixes various issues and cleans up code - Fixes issue #4500: Amount widget +/- has floating point rounding artifacts - Amount box can now be emptied again, without clearing to 0 Also aligns the amount to the right, as in other places.
This commit is contained in:
@@ -72,7 +72,7 @@ void SendCoinsEntry::setModel(WalletModel *model)
|
||||
if (model && model->getOptionsModel())
|
||||
connect(model->getOptionsModel(), SIGNAL(displayUnitChanged(int)), this, SLOT(updateDisplayUnit()));
|
||||
|
||||
connect(ui->payAmount, SIGNAL(textChanged()), this, SIGNAL(payAmountChanged()));
|
||||
connect(ui->payAmount, SIGNAL(valueChanged()), this, SIGNAL(payAmountChanged()));
|
||||
connect(ui->deleteButton, SIGNAL(clicked()), this, SLOT(deleteClicked()));
|
||||
connect(ui->deleteButton_is, SIGNAL(clicked()), this, SLOT(deleteClicked()));
|
||||
connect(ui->deleteButton_s, SIGNAL(clicked()), this, SLOT(deleteClicked()));
|
||||
@@ -130,6 +130,13 @@ bool SendCoinsEntry::validate()
|
||||
retval = false;
|
||||
}
|
||||
|
||||
// Sending a zero amount is invalid
|
||||
if (ui->payAmount->value(0) <= 0)
|
||||
{
|
||||
ui->payAmount->setValid(false);
|
||||
retval = false;
|
||||
}
|
||||
|
||||
// Reject dust outputs:
|
||||
if (retval && GUIUtil::isDust(ui->payTo->text(), ui->payAmount->value())) {
|
||||
ui->payAmount->setValid(false);
|
||||
|
||||
Reference in New Issue
Block a user