mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-11 22:50:59 +01:00
Merge pull request #4302
8969828 [Qt] New status bar Unit Display Control and related changes. (gubatron)
This commit is contained in:
@@ -235,8 +235,7 @@ TransactionTableModel::TransactionTableModel(CWallet* wallet, WalletModel *paren
|
||||
walletModel(parent),
|
||||
priv(new TransactionTablePriv(wallet, this))
|
||||
{
|
||||
columns << QString() << tr("Date") << tr("Type") << tr("Address") << tr("Amount");
|
||||
|
||||
columns << QString() << tr("Date") << tr("Type") << tr("Address") << BitcoinUnits::getAmountColumnTitle(walletModel->getOptionsModel()->getDisplayUnit());
|
||||
priv->refreshWallet();
|
||||
|
||||
connect(walletModel->getOptionsModel(), SIGNAL(displayUnitChanged(int)), this, SLOT(updateDisplayUnit()));
|
||||
@@ -247,6 +246,13 @@ TransactionTableModel::~TransactionTableModel()
|
||||
delete priv;
|
||||
}
|
||||
|
||||
/** Updates the column title to "Amount (DisplayUnit)" and emits headerDataChanged() signal for table headers to react. */
|
||||
void TransactionTableModel::updateAmountColumnTitle()
|
||||
{
|
||||
columns[Amount] = BitcoinUnits::getAmountColumnTitle(walletModel->getOptionsModel()->getDisplayUnit());
|
||||
emit headerDataChanged(Qt::Horizontal,Amount,Amount);
|
||||
}
|
||||
|
||||
void TransactionTableModel::updateTransaction(const QString &hash, int status)
|
||||
{
|
||||
uint256 updated;
|
||||
@@ -632,5 +638,6 @@ QModelIndex TransactionTableModel::index(int row, int column, const QModelIndex
|
||||
void TransactionTableModel::updateDisplayUnit()
|
||||
{
|
||||
// emit dataChanged to update Amount column with the current unit
|
||||
updateAmountColumnTitle();
|
||||
emit dataChanged(index(0, Amount), index(priv->size()-1, Amount));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user