-
Notifications
You must be signed in to change notification settings - Fork 276
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
Align numbers in the "Peer Id" column to the right #325
Conversation
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.
Concept ACK
@@ -634,6 +651,7 @@ void RPCConsole::setClientModel(ClientModel *model, int bestblock_height, int64_ | |||
ui->peerWidget->setColumnWidth(PeerTableModel::Subversion, SUBVERSION_COLUMN_WIDTH); | |||
ui->peerWidget->setColumnWidth(PeerTableModel::Ping, PING_COLUMN_WIDTH); | |||
ui->peerWidget->horizontalHeader()->setStretchLastSection(true); | |||
ui->peerWidget->setItemDelegateForColumn(PeerTableModel::NetNodeId, new PeerIdViewDelegate(this)); |
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.
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.
Thanks for bringing this patch to my attention @jarolrod and for this helpful comparison. I prefer with the added separation between the right-aligned peer number and the left-aligned address as proposed here (which is why I originally proposed center-aligned to have the spacing as well and aligned under the header that is also center-aligned, but the version proposed in this PR seems good too).
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 69b8b5d
Having the Peer Id
numbers right-aligned is a UX improvement in my opinion.
Through testing and resizing columns, it's possible for the Peer id
and Address
columns to look a bit cluttered.
This PR's approach to prevent this clutter is to use a QStyledItemDelegate, named PeerIdViewDelegate
, which gets around this by drawing the value with a few spaces after the number.
It's an important distinction that these spaces are being drawn and not appended to the ID
value. We could instead just append these spaces to the following line directly and not use a delegate:
Line 114 in b295395
return (qint64)rec->nodeStats.nodeid; |
But, that would mess up cases where we access the NetNodeId
value such as here:
Line 1155 in b295395
QList<QModelIndex> nodes = GUIUtil::getEntryData(ui->peerWidget, PeerTableModel::NetNodeId); |
If other reviewers think the clutter
is a non-issue, or the added complexity of a QStyledItemDelegate
is not worth it, then this PR can just be comprised of this line:
Line 135 in 69b8b5d
return QVariant(Qt::AlignRight | Qt::AlignVCenter); |
See my comparison of what this PR looks like with and without the delegate here: https://github.com/bitcoin-core/gui/pull/325/files#r631517595
Concept ACK. I wanted to change this column away from left-alignment as well, so thank you for proposing this. |
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.
Tested rebased to master ("Peer" header, this PR could be renamed) and with the arrows removed from the neighboring address column to test the case of them being replaced by a dedicated Direction column.
Center-aligned:
Right-aligned per this patch:
I think this is an improvement, though maybe a bit more separation from the Address column might be good and I do prefer center-aligned for overall readability and balance in the design.
ACK 69b8b5d happy to re-ack with more separation or center-aligned
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 69b8b5d
Let's collect some feedback with current one :)
I'm really opposite against center-aligned ids, as it ends with such a weird layout: |
On master (6b49d88):
With this PR: