GUI: SendCoinsEntry: Propagate asset types available to amount field

This commit is contained in:
Luke Dashjr 2019-01-07 14:44:20 +00:00 committed by Gregory Sanders
parent a163be0ae1
commit 2ebae1ab89
2 changed files with 12 additions and 1 deletions

View file

@ -81,8 +81,10 @@ void SendCoinsEntry::setModel(WalletModel *_model)
{
this->model = _model;
if (_model && _model->getOptionsModel())
if (_model && _model->getOptionsModel()) {
connect(_model->getOptionsModel(), &OptionsModel::displayUnitChanged, this, &SendCoinsEntry::updateDisplayUnit);
connect(_model, SIGNAL(assetTypesChanged()), this, SLOT(updateAssetTypes()));
}
clear();
}
@ -107,6 +109,7 @@ void SendCoinsEntry::clear()
ui->payAmount_s->clear();
// update the display unit, to not use the default ("BTC")
updateAssetTypes();
updateDisplayUnit();
}
@ -251,6 +254,13 @@ void SendCoinsEntry::setFocus()
ui->payTo->setFocus();
}
void SendCoinsEntry::updateAssetTypes()
{
if (model) {
ui->payAmount->setAllowedAssets(model->getAssetTypes());
}
}
void SendCoinsEntry::updateDisplayUnit()
{
if(model && model->getOptionsModel())

View file

@ -64,6 +64,7 @@ private Q_SLOTS:
void on_addressBookButton_clicked();
void on_pasteButton_clicked();
void updateDisplayUnit();
void updateAssetTypes();
private:
SendCoinsRecipient recipient;