From 8b0013496ce4b4f1de70a06c9e6615fcd1afc9ff Mon Sep 17 00:00:00 2001 From: tobtoht Date: Fri, 3 May 2024 11:34:46 +0200 Subject: [PATCH] TxPoolViewer: fix sort --- src/dialog/TxPoolViewerDialog.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/dialog/TxPoolViewerDialog.cpp b/src/dialog/TxPoolViewerDialog.cpp index 30f4e0dd..c08c9482 100644 --- a/src/dialog/TxPoolViewerDialog.cpp +++ b/src/dialog/TxPoolViewerDialog.cpp @@ -37,11 +37,7 @@ public: bool operator<(const QTreeWidgetItem &other) const override { int column = treeWidget()->sortColumn(); - if (column == 2) { - return this->text(column).toInt() < other.text(column).toInt(); - } - - return this->text(column) < other.text(column); + return this->data(column, Qt::UserRole).toUInt() < other.data(column, Qt::UserRole).toUInt(); } }; @@ -70,13 +66,16 @@ void TxPoolViewerDialog::onTxPoolBacklog(const QVector &txPool, auto* item = new TxPoolSortItem(); item->setText(0, QString("%1 B").arg(QString::number(entry.weight))); + item->setData(0, Qt::UserRole, entry.weight); item->setTextAlignment(0, Qt::AlignRight); item->setText(1, QString("%1 XMR").arg(WalletManager::displayAmount(entry.fee))); + item->setData(1, Qt::UserRole, entry.fee); item->setTextAlignment(1, Qt::AlignRight); quint64 fee_per_byte = entry.fee / entry.weight; item->setText(2, QString::number(entry.fee / entry.weight)); + item->setData(2, Qt::UserRole, entry.fee / entry.weight); item->setTextAlignment(2, Qt::AlignRight); if (fee_per_byte == baseFees[0]) { -- 2.52.0