mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-01-11 12:22:39 -03:00
Merge bitcoin-core/gui#229: Fix regression with initial sorting after pr205
c524dc54bb
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: ![Screenshot from 2021-02-27 17-49-54](https://user-images.githubusercontent.com/32963518/109392491-f7e9a480-7924-11eb-96cc-98b6f932e18e.png) It appears that sorting the table must be triggered _after_ the `QTableView::setModel` call. With this PR (and pre-#205): ![Screenshot from 2021-02-27 17-48-40](https://user-images.githubusercontent.com/32963518/109392505-08018400-7925-11eb-8107-8f8685744b83.png) ACKs for top commit: Talkless: tACKc524dc54bb
, tested on Debian Sid with Qt 5.15.2. I can confirm @leonardojobim observations. leonardojobim: Tested ACKc524dc54bb
on Ubuntu 20.04.2 Qt 5.12.8 jonatack: ACKc524dc54bb
jarolrod: ACKc524dc54bb
, tested on macOS 11.1 Qt 5.15.2 Tree-SHA512: e370229979a70d63a0b64dbc11c4eca338695a070881d4d8f015644617f180e6accc24d6bdf98a75e7c9ba9be2a0ace9a2b7eb9c783ebb2992c3b2c3b3deb408
This commit is contained in:
commit
63314b8211
2 changed files with 3 additions and 2 deletions
|
@ -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…
Reference in a new issue