删除重复代码

This commit is contained in:
zhangyuanyuan1 2022-08-05 09:09:21 +08:00
parent 8e58fd7a82
commit 1fab334ba5
2 changed files with 8 additions and 10 deletions

View File

@ -291,13 +291,12 @@ void Ipv4Page::configChanged(int index) {
void Ipv4Page::onAddressTextChanged()
{
m_iconLabel->hide();
m_textLabel->hide();
if (!getTextEditState(ipv4addressEdit->text())) {
m_iconLabel->hide();
m_textLabel->hide();
m_addressHintLabel->setText(tr("Invalid address"));
} else {
m_iconLabel->hide();
m_textLabel->hide();
m_addressHintLabel->clear();
}
}
@ -406,7 +405,7 @@ void Ipv4Page::initConflictHintLable()
m_iconLabel->setPixmap(icon.pixmap(ICON_SIZE));
m_textLabel = new QLabel(m_addressHintLabel);
m_textLabel->setText(tr("Address conflict"));
QHBoxLayout *conflictHintLayout = new QHBoxLayout();
QHBoxLayout *conflictHintLayout = new QHBoxLayout(m_addressHintLabel);
conflictHintLayout->setContentsMargins(0, 0, 0, 0);
conflictHintLayout->addWidget(m_iconLabel);
conflictHintLayout->addWidget(m_textLabel);

View File

@ -270,13 +270,12 @@ void Ipv6Page::setEnableOfSaveBtn()
void Ipv6Page::onAddressTextChanged()
{
m_iconLabel->hide();
m_textLabel->hide();
if (!getIpv6EditState(ipv6AddressEdit->text())) {
m_iconLabel->hide();
m_textLabel->hide();
m_addressHintLabel->setText(tr("Invalid address"));
} else {
m_iconLabel->hide();
m_textLabel->hide();
m_addressHintLabel->clear();
}
}
@ -344,7 +343,7 @@ void Ipv6Page::initConflictHintLable()
m_iconLabel->setPixmap(icon.pixmap(ICON_SIZE));
m_textLabel = new QLabel(m_addressHintLabel);
m_textLabel->setText(tr("Address conflict"));
QHBoxLayout *conflictHintLayout = new QHBoxLayout();
QHBoxLayout *conflictHintLayout = new QHBoxLayout(m_addressHintLabel);
conflictHintLayout->setContentsMargins(0, 0, 0, 0);
conflictHintLayout->addWidget(m_iconLabel);
conflictHintLayout->addWidget(m_textLabel);