diff options
| author | Philip Kaufmann <[email protected]> | 2015-06-21 13:07:08 +0200 |
|---|---|---|
| committer | Philip Kaufmann <[email protected]> | 2015-08-10 14:11:25 +0200 |
| commit | 92684bb8728613c828b36711aa2be5f97cf8a0ad (patch) | |
| tree | f592ea99db17180843f21a7772a45ca0f8f79a0d /src/qt/peertablemodel.cpp | |
| parent | Merge pull request #6529 (diff) | |
| download | discoin-92684bb8728613c828b36711aa2be5f97cf8a0ad.tar.xz discoin-92684bb8728613c828b36711aa2be5f97cf8a0ad.zip | |
[Qt] minor optimisations in peertablemodel
- remove an unneeded include of net.h in peertablemodel.cpp
- add const after size() in PeerTablePriv
- remove 2x unneeded else in functions
- replace a (int) typecast by (QVariant) to use Qt style
- remove unneeded include of peertablemodel.h from rpcconsole.cpp
Diffstat (limited to 'src/qt/peertablemodel.cpp')
| -rw-r--r-- | src/qt/peertablemodel.cpp | 19 |
1 files changed, 6 insertions, 13 deletions
diff --git a/src/qt/peertablemodel.cpp b/src/qt/peertablemodel.cpp index 85339166b..770a86054 100644 --- a/src/qt/peertablemodel.cpp +++ b/src/qt/peertablemodel.cpp @@ -8,7 +8,6 @@ #include "guiconstants.h" #include "guiutil.h" -#include "net.h" #include "sync.h" #include <QDebug> @@ -96,18 +95,17 @@ public: mapNodeRows.insert(std::pair<NodeId, int>(stats.nodeStats.nodeid, row++)); } - int size() + int size() const { return cachedNodeStats.size(); } CNodeCombinedStats *index(int idx) { - if(idx >= 0 && idx < cachedNodeStats.size()) { + if (idx >= 0 && idx < cachedNodeStats.size()) return &cachedNodeStats[idx]; - } else { - return 0; - } + + return 0; } }; @@ -171,7 +169,7 @@ QVariant PeerTableModel::data(const QModelIndex &index, int role) const } } else if (role == Qt::TextAlignmentRole) { if (index.column() == Ping) - return (int)(Qt::AlignRight | Qt::AlignVCenter); + return (QVariant)(Qt::AlignRight | Qt::AlignVCenter); } return QVariant(); @@ -204,13 +202,8 @@ QModelIndex PeerTableModel::index(int row, int column, const QModelIndex &parent CNodeCombinedStats *data = priv->index(row); if (data) - { return createIndex(row, column, data); - } - else - { - return QModelIndex(); - } + return QModelIndex(); } const CNodeCombinedStats *PeerTableModel::getNodeStats(int idx) |