Clear all tables when wallet is closed

This commit is contained in:
tobtoht 2020-12-31 07:54:19 +01:00
parent 5b679da427
commit c2e335e439
No known key found for this signature in database
GPG key ID: 1CADD27F41F45C3C
7 changed files with 22 additions and 0 deletions

View file

@ -206,6 +206,10 @@ void CoinsWidget::onSweepOutput() {
dialog->deleteLater(); dialog->deleteLater();
} }
void CoinsWidget::resetModel() {
ui->coins->setModel(nullptr);
}
void CoinsWidget::copy(copyField field) { void CoinsWidget::copy(copyField field) {
QModelIndex index = ui->coins->currentIndex(); QModelIndex index = ui->coins->currentIndex();
int row = m_proxyModel->mapToSource(index).row(); int row = m_proxyModel->mapToSource(index).row();

View file

@ -25,6 +25,9 @@ public:
void setModel(CoinsModel * model, Coins * coins); void setModel(CoinsModel * model, Coins * coins);
~CoinsWidget() override; ~CoinsWidget() override;
public slots:
void resetModel();
private slots: private slots:
void showHeaderMenu(const QPoint& position); void showHeaderMenu(const QPoint& position);
void setShowSpent(bool show); void setShowSpent(bool show);

View file

@ -90,6 +90,11 @@ void ContactsWidget::setSearchFilter(const QString &filter) {
m_proxyModel->setSearchFilter(filter); m_proxyModel->setSearchFilter(filter);
} }
void ContactsWidget::resetModel()
{
ui->contacts->setModel(nullptr);
}
void ContactsWidget::showHeaderMenu(const QPoint& position) void ContactsWidget::showHeaderMenu(const QPoint& position)
{ {
m_showFullAddressesAction->setChecked(m_model->isShowFullAddresses()); m_showFullAddressesAction->setChecked(m_model->isShowFullAddresses());

View file

@ -32,6 +32,7 @@ public slots:
void deleteContact(); void deleteContact();
void setShowFullAddresses(bool show); void setShowFullAddresses(bool show);
void setSearchFilter(const QString &filter); void setSearchFilter(const QString &filter);
void resetModel();
signals: signals:
void fillAddress(QString &address); void fillAddress(QString &address);

View file

@ -334,7 +334,11 @@ MainWindow::MainWindow(AppContext *ctx, QWidget *parent) :
else else
ui->tabWidget->setCurrentIndex(Tabs::HOME); ui->tabWidget->setCurrentIndex(Tabs::HOME);
// Clear all tables when wallet is closed
ui->historyWidget->resetModel(); ui->historyWidget->resetModel();
ui->contactWidget->resetModel();
ui->receiveWidget->resetModel();
ui->coinsWidget->resetModel();
}); });
// window title // window title

View file

@ -103,6 +103,10 @@ void ReceiveWidget::onShowTransactions() {
emit showTransactions(address); emit showTransactions(address);
} }
void ReceiveWidget::resetModel() {
ui->addresses->setModel(nullptr);
}
void ReceiveWidget::setShowFullAddresses(bool show) { void ReceiveWidget::setShowFullAddresses(bool show) {
if (!m_model) return; if (!m_model) return;
m_model->setShowFullAddresses(show); m_model->setShowFullAddresses(show);

View file

@ -36,6 +36,7 @@ public slots:
void setShowUsedAddresses(bool show); void setShowUsedAddresses(bool show);
void setSearchFilter(const QString &filter); void setSearchFilter(const QString &filter);
void onShowTransactions(); void onShowTransactions();
void resetModel();
signals: signals:
void generateSubaddress(); void generateSubaddress();