Save/restore column sizes of the tables in the Peers tab #256
pull hebasto wants to merge 1 commits into bitcoin-core:master from hebasto:210323-peers changing 2 files +26 −6-
hebasto commented at 11:24 pm on March 23, 2021: member
-
hebasto added the label Feature on Mar 23, 2021
-
jarolrod commented at 2:47 am on March 26, 2021: member
ACK dda2f65d754aa05d8191e79e4db2189e79988443, tested on macOS 11.2.3 Qt 5.15.2
This PR successfully saves/restores the column sizes in the peers tab. Below are some screenshots showing the behavior:
Start
Resize
Close and Restart
-
jonatack approved
-
jonatack commented at 4:26 pm on March 26, 2021: contributor
Very practical improvement.
ACK dda2f65d754aa05d8191e79e4db2189e79988443 code review, debug build is clean, tested repeatedly with both “Peers” and “Banned Peers” column widths and different shutdown methods. Tested with Qt 5.15.2 on Debian 5.10.19-1 (2021-03-02).
Changes are straightforward. I’m not a Qt expert so I briefly checked the Qt 5.15
QByteArray
,saveState
andrestoreState
docs and version compats. -
hebasto closed this on Mar 28, 2021
-
hebasto reopened this on Mar 28, 2021
-
hebasto closed this on Mar 28, 2021
-
hebasto reopened this on Mar 28, 2021
-
in src/qt/rpcconsole.cpp:1186 in dda2f65d75 outdated
1197@@ -1186,6 +1198,11 @@ void RPCConsole::showEvent(QShowEvent *event) 1198 1199 void RPCConsole::hideEvent(QHideEvent *event) 1200 { 1201+ // It is too late to call QHeaderView::saveState() in ~RPCConsole(), as all of
promag commented at 3:19 pm on April 23, 2021:An alternative could be to useQHeaderView::sectionResized
signal.
hebasto commented at 4:54 pm on April 23, 2021:Yes, using
QHeaderView::sectionResized
signal is a clearer solution. But most of them are redundant, as we are interested in the final state only.Do you think we should prefer clear code (I admit that using a comment to explain code is a bad sign)? If so, I’ll be happy to implement your suggestion.
promag commented at 4:58 pm on April 23, 2021:On the other hand with current approach it always save even if you don’t resize.
Is the signal emitted while resizing? Not only at the end? (Didn’t test)
in src/qt/rpcconsole.cpp:620 in dda2f65d75 outdated
614@@ -612,9 +615,14 @@ void RPCConsole::setClientModel(ClientModel *model, int bestblock_height, int64_ 615 ui->peerWidget->setSelectionBehavior(QAbstractItemView::SelectRows); 616 ui->peerWidget->setSelectionMode(QAbstractItemView::ExtendedSelection); 617 ui->peerWidget->setContextMenuPolicy(Qt::CustomContextMenu); 618- ui->peerWidget->setColumnWidth(PeerTableModel::Address, ADDRESS_COLUMN_WIDTH); 619- ui->peerWidget->setColumnWidth(PeerTableModel::Subversion, SUBVERSION_COLUMN_WIDTH); 620- ui->peerWidget->setColumnWidth(PeerTableModel::Ping, PING_COLUMN_WIDTH); 621+ 622+ QSettings settings; 623+ m_peer_widget_header_state = settings.value("PeersTabPeerHeaderState").toByteArray();
promag commented at 3:20 pm on April 23, 2021:Loadm_peer_widget_header_state
in constructor wheresettings
already exists.
hebasto commented at 3:56 pm on April 23, 2021:Thanks for raising this question!
From my experience
QTableView::setColumnWidth
does not work without model set (but it is not documented by Qt).Did I miss something? Does it work for you?
promag commented at 3:58 pm on April 23, 2021:I mean move L620 to constructor but leaverestoreState()
here.
promag commented at 3:20 pm on April 23, 2021: contributorTested ACK dda2f65d754aa05d8191e79e4db2189e79988443.hebasto force-pushed on Apr 29, 2021promag commented at 8:01 am on May 5, 2021: contributorCode review ACK 002d0e0d998d4c15d86990f9ce41d981e0bad7fc.hebasto added this to the milestone 22.0 on May 8, 2021hebasto force-pushed on May 10, 2021jarolrod commented at 2:45 am on May 13, 2021: memberACK 03370446f7fc4936596c7b0d689ab425bdbc825d
patch looks good
Start Resize Restart hebasto referenced this in commit 5c041cb348 on May 26, 2021DrahtBot added the label Needs rebase on Jun 1, 2021qt: Save/restore column sizes of the tables in the Peers tab fb1b1e0f3ehebasto force-pushed on Jun 5, 2021DrahtBot removed the label Needs rebase on Jun 5, 2021jonatack commented at 1:27 pm on June 5, 2021: contributorThis is a real UX improvement, thanks!
ACK fb1b1e0f3eae32b087347889ed7502b7f2c48549 code review, debug-built and tested
I am seeing some unusual flickering in the
User Agent
header, but this is also the case in current master 38ab7d0765e52b8. I don’t recall seeing it before but am not sure.jarolrod commented at 7:21 pm on June 5, 2021: memberACK fb1b1e0f3eae32b087347889ed7502b7f2c48549
Code Review ACK and Tested ACK on Linux Qt 5.15.2, macOS 11.3 Qt 5.15.2, and cross-compile to Windows
Arch Linux:
Start Resize Restart macOS:
Start Resize Restart Windows:
Start Resize Restart hebasto merged this on Jun 5, 2021hebasto closed this on Jun 5, 2021
hebasto deleted the branch on Jun 5, 2021sidhujag referenced this in commit 97504980a7 on Jun 6, 2021gwillen referenced this in commit 9e27d6c746 on Jun 1, 2022bitcoin-core locked this on Aug 16, 2022
This is a metadata mirror of the GitHub repository bitcoin-core/gui. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2024-12-22 02:20 UTC
More mirrored repositories can be found on mirror.b10c.me