@@ -35,6 +35,15 @@ QList<CAmount> CoinControlDialog::payAmounts;
35
35
CCoinControl* CoinControlDialog::coinControl = new CCoinControl();
36
36
bool CoinControlDialog::fSubtractFeeFromAmount = false ;
37
37
38
+ bool CCoinControlWidgetItem::operator <(const QTreeWidgetItem &other) const {
39
+ int column = treeWidget ()->sortColumn ();
40
+ if (column == CoinControlDialog::COLUMN_AMOUNT_INT64 || column == CoinControlDialog::COLUMN_AMOUNT_INT64)
41
+ return data (CoinControlDialog::COLUMN_AMOUNT_INT64, Qt::DisplayRole).toULongLong () < other.data (CoinControlDialog::COLUMN_AMOUNT_INT64, Qt::DisplayRole).toULongLong ();
42
+ if (column == CoinControlDialog::COLUMN_DATE || column == CoinControlDialog::COLUMN_DATE_INT64)
43
+ return data (CoinControlDialog::COLUMN_DATE_INT64, Qt::DisplayRole).toULongLong () < other.data (CoinControlDialog::COLUMN_DATE_INT64, Qt::DisplayRole).toULongLong ();
44
+ return QTreeWidgetItem::operator <(other);
45
+ }
46
+
38
47
CoinControlDialog::CoinControlDialog (const PlatformStyle *_platformStyle, QWidget *parent) :
39
48
QDialog(parent),
40
49
ui(new Ui::CoinControlDialog),
@@ -658,7 +667,7 @@ void CoinControlDialog::updateView()
658
667
model->listCoins (mapCoins);
659
668
660
669
BOOST_FOREACH (const PAIRTYPE (QString, std::vector<COutput>)& coins, mapCoins) {
661
- QTreeWidgetItem *itemWalletAddress = new QTreeWidgetItem ();
670
+ CCoinControlWidgetItem *itemWalletAddress = new CCoinControlWidgetItem ();
662
671
itemWalletAddress->setCheckState (COLUMN_CHECKBOX, Qt::Unchecked);
663
672
QString sWalletAddress = coins.first ;
664
673
QString sWalletLabel = model->getAddressTableModel ()->labelForAddress (sWalletAddress );
@@ -686,9 +695,9 @@ void CoinControlDialog::updateView()
686
695
nSum += out.tx ->vout [out.i ].nValue ;
687
696
nChildren++;
688
697
689
- QTreeWidgetItem *itemOutput;
690
- if (treeMode) itemOutput = new QTreeWidgetItem (itemWalletAddress);
691
- else itemOutput = new QTreeWidgetItem (ui->treeWidget );
698
+ CCoinControlWidgetItem *itemOutput;
699
+ if (treeMode) itemOutput = new CCoinControlWidgetItem (itemWalletAddress);
700
+ else itemOutput = new CCoinControlWidgetItem (ui->treeWidget );
692
701
itemOutput->setFlags (flgCheckbox);
693
702
itemOutput->setCheckState (COLUMN_CHECKBOX,Qt::Unchecked);
694
703
@@ -721,11 +730,11 @@ void CoinControlDialog::updateView()
721
730
722
731
// amount
723
732
itemOutput->setText (COLUMN_AMOUNT, BitcoinUnits::format (nDisplayUnit, out.tx ->vout [out.i ].nValue ));
724
- itemOutput->setText (COLUMN_AMOUNT_INT64, strPad ( QString::number ( out.tx ->vout [out.i ].nValue ), 15 , " " )); // padding so that sorting works correctly
733
+ itemOutput->setData (COLUMN_AMOUNT_INT64, Qt::DisplayRole, QVariant ((qlonglong) out.tx ->vout [out.i ].nValue )); // padding so that sorting works correctly
725
734
726
735
// date
727
736
itemOutput->setText (COLUMN_DATE, GUIUtil::dateTimeStr (out.tx ->GetTxTime ()));
728
- itemOutput->setText (COLUMN_DATE_INT64, strPad ( QString::number ( out.tx ->GetTxTime ()), 20 , " " ));
737
+ itemOutput->setData (COLUMN_DATE_INT64, Qt::DisplayRole, QVariant ((qlonglong) out.tx ->GetTxTime ()));
729
738
730
739
// confirmations
731
740
itemOutput->setText (COLUMN_CONFIRMATIONS, strPad (QString::number (out.nDepth ), 8 , " " ));
0 commit comments