diff options
author | Wladimir J. van der Laan <laanwj@gmail.com> | 2014-08-06 15:37:14 +0200 |
---|---|---|
committer | Wladimir J. van der Laan <laanwj@gmail.com> | 2014-08-06 15:48:01 +0200 |
commit | 9db9257ac4520210470922f12a463e9d3791c9ec (patch) | |
tree | 1ad8570d641c764c9f1bb427ce18aca7486d3065 /src | |
parent | 5e94d0036a76ea9d63e4ed17b12554caef7f55da (diff) | |
parent | ead6737b87ee238aa0c7f81f9186c62f15ab8d67 (diff) |
Merge pull request #4629
ead6737 [Qt] format ping times in peers tab as ms (Philip Kaufmann)
Diffstat (limited to 'src')
-rw-r--r-- | src/qt/guiutil.cpp | 2 | ||||
-rw-r--r-- | src/qt/peertablemodel.cpp | 7 |
2 files changed, 6 insertions, 3 deletions
diff --git a/src/qt/guiutil.cpp b/src/qt/guiutil.cpp index 6258c4160c..ed83909608 100644 --- a/src/qt/guiutil.cpp +++ b/src/qt/guiutil.cpp @@ -806,7 +806,7 @@ QString formatServicesStr(uint64_t mask) QString formatPingTime(double dPingTime) { - return dPingTime == 0 ? QObject::tr("N/A") : QString(QObject::tr("%1 s")).arg(QString::number(dPingTime, 'f', 3)); + return dPingTime == 0 ? QObject::tr("N/A") : QString(QObject::tr("%1 ms")).arg(QString::number((int)(dPingTime * 1000), 10)); } } // namespace GUIUtil diff --git a/src/qt/peertablemodel.cpp b/src/qt/peertablemodel.cpp index 4c650bdec9..54b46867ea 100644 --- a/src/qt/peertablemodel.cpp +++ b/src/qt/peertablemodel.cpp @@ -152,8 +152,7 @@ QVariant PeerTableModel::data(const QModelIndex &index, int role) const CNodeCombinedStats *rec = static_cast<CNodeCombinedStats*>(index.internalPointer()); - if(role == Qt::DisplayRole) - { + if (role == Qt::DisplayRole) { switch(index.column()) { case Address: @@ -163,7 +162,11 @@ QVariant PeerTableModel::data(const QModelIndex &index, int role) const case Ping: return GUIUtil::formatPingTime(rec->nodeStats.dPingTime); } + } else if (role == Qt::TextAlignmentRole) { + if (index.column() == Ping) + return (int)(Qt::AlignRight | Qt::AlignVCenter); } + return QVariant(); } |