From 520ea4fbcccdced8c8de0e9bb229194db2e447c3 Mon Sep 17 00:00:00 2001 From: tobtoht Date: Mon, 13 Mar 2023 19:46:31 +0100 Subject: [PATCH] AccountSwitcherDialog: ensure update on show --- src/MainWindow.cpp | 1 + src/dialog/AccountSwitcherDialog.cpp | 8 ++++++-- src/dialog/AccountSwitcherDialog.h | 2 ++ 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/MainWindow.cpp b/src/MainWindow.cpp index 8ab3521..8dc8119 100644 --- a/src/MainWindow.cpp +++ b/src/MainWindow.cpp @@ -1122,6 +1122,7 @@ void MainWindow::showWalletCacheDebugDialog() { void MainWindow::showAccountSwitcherDialog() { m_accountSwitcherDialog->show(); + m_accountSwitcherDialog->update(); } void MainWindow::showAddressChecker() { diff --git a/src/dialog/AccountSwitcherDialog.cpp b/src/dialog/AccountSwitcherDialog.cpp index 68fae91..9ae3f69 100644 --- a/src/dialog/AccountSwitcherDialog.cpp +++ b/src/dialog/AccountSwitcherDialog.cpp @@ -21,11 +21,9 @@ AccountSwitcherDialog::AccountSwitcherDialog(Wallet *wallet, QWidget *parent) { ui->setupUi(this); - m_wallet->subaddressAccount()->refresh(); m_proxyModel->setSourceModel(m_model); ui->label_totalBalance->setFont(ModelUtils::getMonospaceFont()); - ui->label_totalBalance->setText(WalletManager::displayAmount(m_wallet->balanceAll())); this->setWindowModality(Qt::WindowModal); @@ -52,9 +50,15 @@ AccountSwitcherDialog::AccountSwitcherDialog(Wallet *wallet, QWidget *parent) connect(m_wallet, &Wallet::currentSubaddressAccountChanged, this, &AccountSwitcherDialog::updateSelection); connect(m_wallet->subaddressAccount(), &SubaddressAccount::refreshFinished, this, &AccountSwitcherDialog::updateSelection); + this->update(); this->updateSelection(); } +void AccountSwitcherDialog::update() { + ui->label_totalBalance->setText(WalletManager::displayAmount(m_wallet->balanceAll())); + m_wallet->subaddressAccount()->refresh(); +} + void AccountSwitcherDialog::switchAccount() { auto row = this->currentEntry(); if (!row) { diff --git a/src/dialog/AccountSwitcherDialog.h b/src/dialog/AccountSwitcherDialog.h index 329de74..5e3c6bb 100644 --- a/src/dialog/AccountSwitcherDialog.h +++ b/src/dialog/AccountSwitcherDialog.h @@ -22,6 +22,8 @@ public: explicit AccountSwitcherDialog(Wallet *wallet, QWidget *parent = nullptr); ~AccountSwitcherDialog() override; + void update(); + private slots: void showContextMenu(const QPoint& point); void updateSelection();