message: qt: Use PeerTableModel::StatsRole
  This change prevents direct calls to the PeerTableModel object that is a
  layer violation.
diff: @@ -1022,11 +1022,9 @@ void RPCConsole::updateTrafficStats(quint64 totalBytesIn, quint64 totalBytesOut)
  void RPCConsole::peerLayoutAboutToChange()
  {
  - QModelIndexList selected = ui->peerWidget->selectionModel()->selectedIndexes();
  cachedNodeids.clear();
  - for(int i = 0; i < selected.size(); i++)
  - {
  - const CNodeCombinedStats *stats = clientModel->getPeerTableModel()->getNodeStats(selected.at(i).row());
  + for (const QModelIndex& peer : GUIUtil::getEntryData(ui->peerWidget, PeerTableModel::NetNodeId)) {
  + const auto stats = peer.data(PeerTableModel::StatsRole).value<CNodeCombinedStats*>();
  cachedNodeids.append(stats->nodeStats.nodeid);
  }
  }
  @@ -1085,15 +1083,13 @@ void RPCConsole::peerLayoutChanged()
  void RPCConsole::updateDetailWidget()
  {
  - QModelIndexList selected_rows;
  - auto selection_model = ui->peerWidget->selectionModel();
  - if (selection_model) selected_rows = selection_model->selectedRows();
  - if (!clientModel || !clientModel->getPeerTableModel() || selected_rows.size() != 1) {
  + const QList<QModelIndex> selected_peers = GUIUtil::getEntryData(ui->peerWidget, PeerTableModel::NetNodeId);
  + if (!clientModel || !clientModel->getPeerTableModel() || selected_peers.size() != 1) {
  ui->detailWidget->hide();
  ui->peerHeading->setText(tr("Select a peer to view detailed information."));
  return;
  }
  - const CNodeCombinedStats *stats = clientModel->getPeerTableModel()->getNodeStats(selected_rows.first().row());
  + const auto stats = selected_peers.first().data(PeerTableModel::StatsRole).value<CNodeCombinedStats*>();
  // update the detail ui with latest node information
  QString peerAddrDetails(QString::fromStdString(stats->nodeStats.addrName) + " ");
  peerAddrDetails += tr("(peer id: %1)").arg(QString::number(stats->nodeStats.nodeid));
  @@ -1206,19 +1202,9 @@ void RPCConsole::banSelectedNode(int bantime)
  if (!clientModel)
  return;
  - // Get selected peer addresses
  - QList<QModelIndex> nodes = GUIUtil::getEntryData(ui->peerWidget, PeerTableModel::NetNodeId);
  - for(int i = 0; i < nodes.count(); i++)
  - {
  - // Get currently selected peer address
  - NodeId id = nodes.at(i).data().toLongLong();
  -
  - // Get currently selected peer address
  - int detailNodeRow = clientModel->getPeerTableModel()->getRowByNodeId(id);
  - if (detailNodeRow < 0) return;
  -
  + for (const QModelIndex& peer : GUIUtil::getEntryData(ui->peerWidget, PeerTableModel::NetNodeId)) {
  // Find possible nodes, ban it and clear the selected node
  - const CNodeCombinedStats *stats = clientModel->getPeerTableModel()->getNodeStats(detailNodeRow);
  + const auto stats = peer.data(PeerTableModel::StatsRole).value<CNodeCombinedStats*>();
  if (stats) {
  m_node.ban(stats->nodeStats.addr, bantime);
  m_node.disconnectByAddress(stats->nodeStats.addr);
  