Simplify code

This commit is contained in:
Chocobo1 2019-08-07 14:26:36 +08:00
parent c61116882b
commit 061219d0a2
No known key found for this signature in database
GPG key ID: 210D9C873253A68C
3 changed files with 63 additions and 78 deletions

View file

@ -301,7 +301,7 @@ void PeerListWidget::copySelectedPeers()
int row = m_proxyModel->mapToSource(index).row();
QString ip = m_listModel->data(m_listModel->index(row, PeerListDelegate::IP_HIDDEN)).toString();
QString myport = m_listModel->data(m_listModel->index(row, PeerListDelegate::PORT)).toString();
if (ip.indexOf('.') == -1) // IPv6
if (!ip.contains('.')) // IPv6
selectedPeers << '[' + ip + "]:" + myport;
else // IPv4
selectedPeers << ip + ':' + myport;