From a972281c7a325c60a5f262cab9352450612dc5d2 Mon Sep 17 00:00:00 2001 From: tobtoht Date: Tue, 17 Jan 2023 21:25:01 +0100 Subject: [PATCH] AccountSwitcher: fix sort --- src/dialog/AccountSwitcherDialog.cpp | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/dialog/AccountSwitcherDialog.cpp b/src/dialog/AccountSwitcherDialog.cpp index 76a48aac..ad24c249 100644 --- a/src/dialog/AccountSwitcherDialog.cpp +++ b/src/dialog/AccountSwitcherDialog.cpp @@ -54,22 +54,28 @@ AccountSwitcherDialog::AccountSwitcherDialog(QSharedPointer ctx, QWi } void AccountSwitcherDialog::switchAccount() { - QModelIndex index = ui->accounts->currentIndex(); - m_ctx->wallet->switchSubaddressAccount(index.row()); + auto row = this->currentEntry(); + if (!row) { + return; + } + + m_ctx->wallet->switchSubaddressAccount(row->getRowId()); } void AccountSwitcherDialog::copyLabel() { auto row = this->currentEntry(); - if (!row) + if (!row) { return; + } Utils::copyToClipboard(QString::fromStdString(row->getLabel())); } void AccountSwitcherDialog::copyBalance() { auto row = this->currentEntry(); - if (!row) + if (!row) { return; + } Utils::copyToClipboard(QString::fromStdString(row->getBalance())); } @@ -101,7 +107,7 @@ void AccountSwitcherDialog::showContextMenu(const QPoint &point) { } Monero::SubaddressAccountRow* AccountSwitcherDialog::currentEntry() { - QModelIndex index = ui->accounts->currentIndex(); + QModelIndex index = m_proxyModel->mapToSource(ui->accounts->currentIndex()); return m_ctx->wallet->subaddressAccountModel()->entryFromIndex(index); } -- 2.52.0