-
Notifications
You must be signed in to change notification settings - Fork 288
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Save/restore TransactionView and recentRequestsView tables column sizes #205
Conversation
In Qt 5 the last column resizing with dragging its left edge works out-of-the-box. The current TableViewLastColumnResizingFixer implementation could put the last column content out of the view port and confuse a user.
This change improves code readability.
This is move-only change.
Sorting order is not saved/restored intentionally.
This is move-only change.
Sorting order is not saved/restored intentionally.
Concept ACK if the idea is to save the column sizes if adjusted by the user and restore them on next use (is that the goal of this pull?), ATM for me on Debian the Transactions window column widths are indeed not persisted after shutdown. (Why not save the sorting order too?) |
Correct.
After a while users could forget/unnotice another sort order, and that could cause their panic (when they are not looking at the recently made transaction). EDIT: while testing the sorting order preservation was uncomfortable for me. |
Tested, it seems to work well. Sort is not preserved but column widths are, as described. |
Concept ACK (I guess this is also resettable by |
Correct. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK 964885d, tested on macOS 11.1 Qt 5.15.2
PR works well and does what it says it will do. Confirmed that the column width's of transactions and recent requests are saved and then restored upon node restart. Code looks good and it removes some complexity (yay, less lines of code).
Below are screenshots comparing the behavior between master
and this pr
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tACK 964885d, tested on Debian Sid, saving/restoring and resetting (with -resetguisettings
) works as expected.
transactionView->verticalHeader()->hide(); | ||
|
||
QSettings settings; | ||
if (!transactionView->horizontalHeader()->restoreState(settings.value("TransactionViewHeaderState").toByteArray())) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tiny nit:
TransactionViewHeaderState
string literal is used twice in same .cpp file. Maybe we can then consider this as "magic string" (as magic constant) and avoid duplicating, using some local .cpp-file constant?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the current way to work with setting names in the codebase.
Your suggestion is nice to apply to all of the setting names in a follow up pr.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Your suggestion is nice to apply to all of the setting names in a follow up pr.
True. Maybe even GUISettings
class to wrap calls to QSettings
with methods like getTransactionViewHeaderState()
.
3913d1e qt: Drop buggy TableViewLastColumnResizingFixer class (Hennadii Stepanov) Pull request description: In Qt 5 the last column resizing with dragging its left edge works out-of-the-box. The current `TableViewLastColumnResizingFixer` implementation could put the last column content out of the view port and confuse a user:  Historical context: - bitcoin/bitcoin#2862 - bitcoin/bitcoin#3626 - bitcoin/bitcoin#3738 - bitcoin/bitcoin#3920 #205 is a nice addition. ACKs for top commit: jarolrod: ACK 3913d1e, tested on macOS 11.1 Qt 5.15.2 Talkless: tACK 3913d1e, tested on Debian Sid. Can confirm that behavior in previous commit does not produce scroll bar, last column gets "hidden". This PR makes clear that there's more to see in the view. promag: Tested ACK 3913d1e on macos. Tree-SHA512: 12582dfce54bb1db3d9934ae092e305d32e9760cc99b0265322e161fa7f54b7d6fb6cefedf700783f767d5c3a56a8545c8d2f5ade66596c4e67b8a5287063e8a
…questsView tables column sizes 964885d qt: Save/restore recentRequestsView table column sizes (Hennadii Stepanov) f5c8093 qt: Move recentRequestsView properties settings to constructor (Hennadii Stepanov) 9c5f4f2 qt: Save/restore TransactionView table column sizes (Hennadii Stepanov) 788205c qt: Move transactionView properties settings to constructor (Hennadii Stepanov) ecdbaf7 qt, refactor: Drop intermediate assignment (Hennadii Stepanov) Pull request description: Save/restore TransactionView and recentRequestsView tables column sizes. Sorting order is not saved/restored intentionally. Based on #204 (the first commit). ACKs for top commit: jarolrod: ACK 964885d, tested on macOS 11.1 Qt 5.15.2 Talkless: tACK 964885d, tested on Debian Sid, saving/restoring and resetting (with `-resetguisettings`) works as expected. Tree-SHA512: c24e41bf4d95bb33dce16e9a0b952ffd0912e95f4d2a1bc5292fcf5a27100e70fea73433c4ff246d05b174fc23a7b6de1790a2e8b990a9089e4deca79a00dedc
This fixed the column widths issue #21306; but now, after opening bitcoin-qt, the transactions aren't chronologically sorted until I click the date column header twice. |
Thank you for reporting. Fixed in #229.
Are you sure about the "Requested payments history" tab? The "Peers" tab is WIP :) |
c524dc5 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 c524dc5, tested on Debian Sid with Qt 5.15.2. I can confirm @leonardojobim observations. leonardojobim: Tested ACK c524dc5 on Ubuntu 20.04.2 Qt 5.12.8 jonatack: ACK c524dc5 jarolrod: ACK c524dc5, tested on macOS 11.1 Qt 5.15.2 Tree-SHA512: e370229979a70d63a0b64dbc11c4eca338695a070881d4d8f015644617f180e6accc24d6bdf98a75e7c9ba9be2a0ace9a2b7eb9c783ebb2992c3b2c3b3deb408
While working on #256, two flaws were noted in this PR.
😞 |
Some commented-out GUI code becomes conditional ... maybe it doesn't need to be commented out anymore? I dunno, I left it alone.
Save/restore TransactionView and recentRequestsView tables column sizes.
Sorting order is not saved/restored intentionally.
Based on #204 (the first commit).