fix(dns):dns初始化时输入格式限制(#191906、#191904)

This commit is contained in:
jzxc95 2023-09-11 15:44:47 +08:00
parent e33c0abce1
commit c5085b9bae
1 changed files with 7 additions and 3 deletions

View File

@ -179,10 +179,14 @@ void MultipleDnsWidget::setDnsListText(const QList<QHostAddress> &dns)
m_emptyWidget->hide();
m_dnsListWidget->show();
}
for (QHostAddress str: dns) {
for (int i = 0; i < dns.size(); ++i) {
QString str = dns.at(i).toString();
QListWidgetItem *dnsListWidgetItem = new QListWidgetItem(m_dnsListWidget);
dnsListWidgetItem->setSizeHint(QSize(0,ITEM_HEIGHT));
dnsListWidgetItem->setText(str.toString());
ListItemEdit *dnsListItemEdit = new ListItemEdit(m_regExp, m_dnsListWidget);
m_dnsListWidget->setItemDelegateForRow(i, dnsListItemEdit);
dnsListWidgetItem->setText(str);
}
}
@ -200,7 +204,7 @@ void MultipleDnsWidget::AddOneDnsItem(QListWidget *listWidget)
listWidget->addItem(dnsListWidgetItem);
listWidget->setCurrentItem(dnsListWidgetItem);
ListItemEdit *dnsListItemEdit = new ListItemEdit(m_regExp);
ListItemEdit *dnsListItemEdit = new ListItemEdit(m_regExp, listWidget);
listWidget->setItemDelegateForRow(listWidget->currentIndex().row() , dnsListItemEdit);
listWidget->editItem(dnsListWidgetItem);
}