| 467 | } |
| 468 | |
| 469 | void BitcoinAmountField::unitChanged(int idx) |
| 470 | { |
| 471 | const CAsset previous_asset = amount->value().first; |
| 472 | |
| 473 | // Use description tooltip for current unit for the combobox |
| 474 | const QVariant& userdata = unit->itemData(idx, Qt::UserRole); |
| 475 | if (userdata.type() == QVariant::UserType) { |
| 476 | const CAsset asset = userdata.value<CAsset>(); |
| 477 | unit->setToolTip(tr("Custom asset (%1)").arg(QString::fromStdString(asset.GetHex()))); |
| 478 | |
| 479 | amount->setDisplayUnit(asset); |
| 480 | } else { |
| 481 | // Determine new unit ID |
| 482 | int newUnit = userdata.toInt(); |
| 483 | |
| 484 | unit->setToolTip(BitcoinUnits::description(newUnit)); |
| 485 | |
| 486 | amount->setDisplayUnit(newUnit); |
| 487 | } |
| 488 | |
| 489 | if (!(m_allowed_assets.count(previous_asset) || amount->value().first == previous_asset)) { |
| 490 | removeAssetChoice(previous_asset); |
| 491 | } |
| 492 | } |
| 493 | |
| 494 | void BitcoinAmountField::setDisplayUnit(const CAsset& asset) |
| 495 | { |
nothing calls this directly
no test coverage detected