mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-13 12:33:42 +02:00
GUI: Disable "Subtract fee from amount" checkbox when a non-pegged asset is selected
Fixes: https://github.com/greenaddress/elements/issues/4
This commit is contained in:
parent
1f0b6886b7
commit
36ebb131dc
2 changed files with 13 additions and 0 deletions
|
|
@ -44,6 +44,7 @@ SendCoinsEntry::SendCoinsEntry(const PlatformStyle *_platformStyle, QWidget *par
|
|||
// Connect signals
|
||||
connect(ui->payAmount, &BitcoinAmountField::valueChanged, this, &SendCoinsEntry::payAmountChanged);
|
||||
connect(ui->checkboxSubtractFeeFromAmount, &QCheckBox::toggled, this, &SendCoinsEntry::subtractFeeFromAmountChanged);
|
||||
connect(ui->payAmount, SIGNAL(valueChanged()), this, SLOT(payAmountChangedInternal()));
|
||||
connect(ui->deleteButton, &QPushButton::clicked, this, &SendCoinsEntry::deleteClicked);
|
||||
connect(ui->deleteButton_is, &QPushButton::clicked, this, &SendCoinsEntry::deleteClicked);
|
||||
connect(ui->deleteButton_s, &QPushButton::clicked, this, &SendCoinsEntry::deleteClicked);
|
||||
|
|
@ -115,6 +116,17 @@ void SendCoinsEntry::clear()
|
|||
updateDisplayUnit();
|
||||
}
|
||||
|
||||
void SendCoinsEntry::payAmountChangedInternal()
|
||||
{
|
||||
const auto send_assets = ui->payAmount->fullValue();
|
||||
if (send_assets.first == Params().GetConsensus().pegged_asset) {
|
||||
ui->checkboxSubtractFeeFromAmount->setEnabled(true);
|
||||
} else {
|
||||
ui->checkboxSubtractFeeFromAmount->setCheckState(Qt::Unchecked);
|
||||
ui->checkboxSubtractFeeFromAmount->setEnabled(false);
|
||||
}
|
||||
}
|
||||
|
||||
void SendCoinsEntry::checkSubtractFeeFromAmount()
|
||||
{
|
||||
ui->checkboxSubtractFeeFromAmount->setChecked(true);
|
||||
|
|
|
|||
|
|
@ -58,6 +58,7 @@ Q_SIGNALS:
|
|||
void subtractFeeFromAmountChanged();
|
||||
|
||||
private Q_SLOTS:
|
||||
void payAmountChangedInternal();
|
||||
void deleteClicked();
|
||||
void useAvailableBalanceClicked();
|
||||
void on_payTo_textChanged(const QString &address);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue