mirror of
https://github.com/Retropex/bitcoin.git
synced 2025-06-02 23:42:33 +02:00
Merge bitcoin-core/gui#325: Align numbers in the "Peer Id" column to the right
69b8b5d72c
qt: Align numbers in the "Peer Id" column to the right (Hennadii Stepanov) Pull request description: On master (6b49d88a5d
):  With this PR:  ACKs for top commit: jarolrod: ACK69b8b5d72c
jonatack: ACK69b8b5d72c
happy to re-ack with more separation or center-aligned kristapsk: ACK69b8b5d72c
Tree-SHA512: 3279522745a0fe6db1ec9be723a2640a37983947ed1af4aad56f22ce4780cc943a25b2d774529a9eeb3b00309f0204cfbc3f38b7db2c52865d05bf6a7c87e747
This commit is contained in:
commit
38ab7d0765
@ -132,6 +132,7 @@ QVariant PeerTableModel::data(const QModelIndex &index, int role) const
|
|||||||
} else if (role == Qt::TextAlignmentRole) {
|
} else if (role == Qt::TextAlignmentRole) {
|
||||||
switch (column) {
|
switch (column) {
|
||||||
case NetNodeId:
|
case NetNodeId:
|
||||||
|
return QVariant(Qt::AlignRight | Qt::AlignVCenter);
|
||||||
case Address:
|
case Address:
|
||||||
return {};
|
return {};
|
||||||
case ConnectionType:
|
case ConnectionType:
|
||||||
|
@ -37,6 +37,8 @@
|
|||||||
#include <QDateTime>
|
#include <QDateTime>
|
||||||
#include <QFont>
|
#include <QFont>
|
||||||
#include <QKeyEvent>
|
#include <QKeyEvent>
|
||||||
|
#include <QLatin1String>
|
||||||
|
#include <QLocale>
|
||||||
#include <QMenu>
|
#include <QMenu>
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
#include <QScreen>
|
#include <QScreen>
|
||||||
@ -44,9 +46,10 @@
|
|||||||
#include <QSettings>
|
#include <QSettings>
|
||||||
#include <QString>
|
#include <QString>
|
||||||
#include <QStringList>
|
#include <QStringList>
|
||||||
|
#include <QStyledItemDelegate>
|
||||||
#include <QTime>
|
#include <QTime>
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
|
#include <QVariant>
|
||||||
|
|
||||||
const int CONSOLE_HISTORY = 50;
|
const int CONSOLE_HISTORY = 50;
|
||||||
const int INITIAL_TRAFFIC_GRAPH_MINS = 30;
|
const int INITIAL_TRAFFIC_GRAPH_MINS = 30;
|
||||||
@ -128,6 +131,20 @@ public:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class PeerIdViewDelegate : public QStyledItemDelegate
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
explicit PeerIdViewDelegate(QObject* parent = nullptr)
|
||||||
|
: QStyledItemDelegate(parent) {}
|
||||||
|
|
||||||
|
QString displayText(const QVariant& value, const QLocale& locale) const override
|
||||||
|
{
|
||||||
|
// Additional spaces should visually separate right-aligned content
|
||||||
|
// from the next column to the right.
|
||||||
|
return value.toString() + QLatin1String(" ");
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
#include <qt/rpcconsole.moc>
|
#include <qt/rpcconsole.moc>
|
||||||
|
|
||||||
@ -644,6 +661,7 @@ void RPCConsole::setClientModel(ClientModel *model, int bestblock_height, int64_
|
|||||||
ui->peerWidget->setColumnWidth(PeerTableModel::Subversion, SUBVERSION_COLUMN_WIDTH);
|
ui->peerWidget->setColumnWidth(PeerTableModel::Subversion, SUBVERSION_COLUMN_WIDTH);
|
||||||
ui->peerWidget->setColumnWidth(PeerTableModel::Ping, PING_COLUMN_WIDTH);
|
ui->peerWidget->setColumnWidth(PeerTableModel::Ping, PING_COLUMN_WIDTH);
|
||||||
ui->peerWidget->horizontalHeader()->setStretchLastSection(true);
|
ui->peerWidget->horizontalHeader()->setStretchLastSection(true);
|
||||||
|
ui->peerWidget->setItemDelegateForColumn(PeerTableModel::NetNodeId, new PeerIdViewDelegate(this));
|
||||||
|
|
||||||
// create peer table context menu
|
// create peer table context menu
|
||||||
peersTableContextMenu = new QMenu(this);
|
peersTableContextMenu = new QMenu(this);
|
||||||
|
Loading…
Reference in New Issue
Block a user