Bugfix: Qt/RPCConsole: Put column enum in the right places

QModelIndex::data argument is a role, not a column
This commit is contained in:
Luke Dashjr 2016-12-02 13:48:33 +00:00
parent addfdebe1a
commit df17fe046f

View File

@ -975,11 +975,11 @@ void RPCConsole::disconnectSelectedNode()
return; return;
// Get selected peer addresses // Get selected peer addresses
QList<QModelIndex> nodes = GUIUtil::getEntryData(ui->peerWidget, 0); QList<QModelIndex> nodes = GUIUtil::getEntryData(ui->peerWidget, PeerTableModel::NetNodeId);
for(int i = 0; i < nodes.count(); i++) for(int i = 0; i < nodes.count(); i++)
{ {
// Get currently selected peer address // Get currently selected peer address
NodeId id = nodes.at(i).data(PeerTableModel::NetNodeId).toInt(); NodeId id = nodes.at(i).data().toInt();
// Find the node, disconnect it and clear the selected node // Find the node, disconnect it and clear the selected node
if(g_connman->DisconnectNode(id)) if(g_connman->DisconnectNode(id))
clearSelectedNode(); clearSelectedNode();
@ -992,11 +992,11 @@ void RPCConsole::banSelectedNode(int bantime)
return; return;
// Get selected peer addresses // Get selected peer addresses
QList<QModelIndex> nodes = GUIUtil::getEntryData(ui->peerWidget, 0); QList<QModelIndex> nodes = GUIUtil::getEntryData(ui->peerWidget, PeerTableModel::NetNodeId);
for(int i = 0; i < nodes.count(); i++) for(int i = 0; i < nodes.count(); i++)
{ {
// Get currently selected peer address // Get currently selected peer address
NodeId id = nodes.at(i).data(PeerTableModel::NetNodeId).toInt(); NodeId id = nodes.at(i).data().toInt();
// Get currently selected peer address // Get currently selected peer address
int detailNodeRow = clientModel->getPeerTableModel()->getRowByNodeId(id); int detailNodeRow = clientModel->getPeerTableModel()->getRowByNodeId(id);
@ -1019,11 +1019,11 @@ void RPCConsole::unbanSelectedNode()
return; return;
// Get selected ban addresses // Get selected ban addresses
QList<QModelIndex> nodes = GUIUtil::getEntryData(ui->banlistWidget, 0); QList<QModelIndex> nodes = GUIUtil::getEntryData(ui->banlistWidget, BanTableModel::Address);
for(int i = 0; i < nodes.count(); i++) for(int i = 0; i < nodes.count(); i++)
{ {
// Get currently selected ban address // Get currently selected ban address
QString strNode = nodes.at(i).data(BanTableModel::Address).toString(); QString strNode = nodes.at(i).data().toString();
CSubNet possibleSubnet; CSubNet possibleSubnet;
LookupSubNet(strNode.toStdString().c_str(), possibleSubnet); LookupSubNet(strNode.toStdString().c_str(), possibleSubnet);