Skip to content
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

Merged
merged 1 commit into from
Jun 5, 2021

Conversation

hebasto
Copy link
Member

@hebasto hebasto commented May 12, 2021

On master (6b49d88):
Screenshot from 2021-05-12 21-53-52

With this PR:
Screenshot from 2021-05-12 21-48-19

@hebasto hebasto added the UI All about "look and feel" label May 12, 2021
Copy link
Member

@jarolrod jarolrod left a 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));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't have a strong opinion on this. I think with and without the PeerIdViewDelegate both look fine:

With Delegate Without Delegate
Screen Shot 2021-05-12 at 9 46 31 PM Screen Shot 2021-05-12 at 10 09 38 PM

Copy link
Member

@jonatack jonatack May 26, 2021

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).

Copy link
Member

@jarolrod jarolrod left a 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:

return (qint64)rec->nodeStats.nodeid;

But, that would mess up cases where we access the NetNodeId value such as here:

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:

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

@jonatack
Copy link
Member

Concept ACK. I wanted to change this column away from left-alignment as well, so thank you for proposing this.

Copy link
Member

@jonatack jonatack left a 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:

Screenshot from 2021-05-28 11-51-04

Right-aligned per this patch:

Screenshot from 2021-05-28 11-56-23

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

Copy link
Contributor

@kristapsk kristapsk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK 69b8b5d

@hebasto
Copy link
Member Author

hebasto commented Jun 5, 2021

@jonatack

happy to re-ack with more separation...

Let's collect some feedback with current one :)

... or center-aligned

I'm really opposite against center-aligned ids, as it ends with such a weird layout:

Screenshot from 2021-06-05 15-14-05

@hebasto hebasto merged commit 38ab7d0 into bitcoin-core:master Jun 5, 2021
@hebasto hebasto deleted the 210512-peer branch June 5, 2021 12:30
sidhujag pushed a commit to syscoin/syscoin that referenced this pull request Jun 6, 2021
gwillen pushed a commit to ElementsProject/elements that referenced this pull request Jun 1, 2022
@bitcoin-core bitcoin-core locked as resolved and limited conversation to collaborators Aug 16, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
UI All about "look and feel"
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants