mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-04-19 01:22:21 +02:00
Merge bitcoin-core/gui#229: Fix regression with initial sorting after pr205
c524dc54bb985f801b5a3def3c3d51ce497e838e qt: Fix regression with initial sorting after pr205 (Hennadii Stepanov)
Pull request description:
Unfortunately, #205 introduced a regression. After opening the "Receive" or "Transaction" tab at first time despite of the "Date" header is marked as sorted, table rows are not sorted actually:

It appears that sorting the table must be triggered _after_ the `QTableView::setModel` call.
With this PR (and pre-#205):

ACKs for top commit:
Talkless:
tACK c524dc54bb985f801b5a3def3c3d51ce497e838e, tested on Debian Sid with Qt 5.15.2. I can confirm @leonardojobim observations.
leonardojobim:
Tested ACK c524dc54bb
on Ubuntu 20.04.2 Qt 5.12.8
jonatack:
ACK c524dc54bb985f801b5a3def3c3d51ce497e838e
jarolrod:
ACK c524dc54bb985f801b5a3def3c3d51ce497e838e, tested on macOS 11.1 Qt 5.15.2
Tree-SHA512: e370229979a70d63a0b64dbc11c4eca338695a070881d4d8f015644617f180e6accc24d6bdf98a75e7c9ba9be2a0ace9a2b7eb9c783ebb2992c3b2c3b3deb408
This commit is contained in:
commit
63314b8211
@ -81,7 +81,6 @@ ReceiveCoinsDialog::ReceiveCoinsDialog(const PlatformStyle *_platformStyle, QWid
|
||||
tableView->horizontalHeader()->setMinimumSectionSize(MINIMUM_COLUMN_WIDTH);
|
||||
tableView->horizontalHeader()->setStretchLastSection(true);
|
||||
}
|
||||
tableView->horizontalHeader()->setSortIndicator(RecentRequestsTableModel::Date, Qt::DescendingOrder);
|
||||
}
|
||||
|
||||
void ReceiveCoinsDialog::setModel(WalletModel *_model)
|
||||
@ -96,6 +95,8 @@ void ReceiveCoinsDialog::setModel(WalletModel *_model)
|
||||
|
||||
QTableView* tableView = ui->recentRequestsView;
|
||||
tableView->setModel(_model->getRecentRequestsTableModel());
|
||||
tableView->sortByColumn(RecentRequestsTableModel::Date, Qt::DescendingOrder);
|
||||
|
||||
connect(tableView->selectionModel(),
|
||||
&QItemSelectionModel::selectionChanged, this,
|
||||
&ReceiveCoinsDialog::recentRequestsView_selectionChanged);
|
||||
|
@ -160,7 +160,6 @@ TransactionView::TransactionView(const PlatformStyle *platformStyle, QWidget *pa
|
||||
transactionView->horizontalHeader()->setMinimumSectionSize(MINIMUM_COLUMN_WIDTH);
|
||||
transactionView->horizontalHeader()->setStretchLastSection(true);
|
||||
}
|
||||
transactionView->horizontalHeader()->setSortIndicator(TransactionTableModel::Date, Qt::DescendingOrder);
|
||||
|
||||
// Actions
|
||||
abandonAction = new QAction(tr("Abandon transaction"), this);
|
||||
@ -236,6 +235,7 @@ void TransactionView::setModel(WalletModel *_model)
|
||||
transactionProxyModel->setFilterCaseSensitivity(Qt::CaseInsensitive);
|
||||
transactionProxyModel->setSortRole(Qt::EditRole);
|
||||
transactionView->setModel(transactionProxyModel);
|
||||
transactionView->sortByColumn(TransactionTableModel::Date, Qt::DescendingOrder);
|
||||
|
||||
if (_model->getOptionsModel())
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user