diff options
author | MarcoFalke <falke.marco@gmail.com> | 2021-03-10 17:01:05 +0100 |
---|---|---|
committer | MarcoFalke <falke.marco@gmail.com> | 2021-03-10 17:01:12 +0100 |
commit | 63314b8211d795b2bf0814e244d801e74f50b152 (patch) | |
tree | 7b2d01d50b19e8fcfbc3048ffcdf5e7be5c5fe6f /src/qt | |
parent | 7cdadf91d513250b983b6a1c4672a6acc0dcf074 (diff) | |
parent | c524dc54bb985f801b5a3def3c3d51ce497e838e (diff) |
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:
![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:
tACK c524dc54bb985f801b5a3def3c3d51ce497e838e, tested on Debian Sid with Qt 5.15.2. I can confirm @leonardojobim observations.
leonardojobim:
Tested ACK https://github.com/bitcoin-core/gui/pull/229/commits/c524dc54bb985f801b5a3def3c3d51ce497e838e 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
Diffstat (limited to 'src/qt')
-rw-r--r-- | src/qt/receivecoinsdialog.cpp | 3 | ||||
-rw-r--r-- | src/qt/transactionview.cpp | 2 |
2 files changed, 3 insertions, 2 deletions
diff --git a/src/qt/receivecoinsdialog.cpp b/src/qt/receivecoinsdialog.cpp index 0da12c84fd..61cb89d75a 100644 --- a/src/qt/receivecoinsdialog.cpp +++ b/src/qt/receivecoinsdialog.cpp @@ -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); diff --git a/src/qt/transactionview.cpp b/src/qt/transactionview.cpp index e1ec7b6ed0..f99a3e286d 100644 --- a/src/qt/transactionview.cpp +++ b/src/qt/transactionview.cpp @@ -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()) { |