From a85a5490828aa504efd38f6d9022594b8bbd57d4 Mon Sep 17 00:00:00 2001 From: zhangyuanyuan1 Date: Mon, 9 Oct 2023 10:17:53 +0800 Subject: [PATCH] fix(wlan device combobox): modify logic of device combobox display --- src/frontend/tab-pages/wlanpage.cpp | 39 +++++++++++++---------------- 1 file changed, 18 insertions(+), 21 deletions(-) diff --git a/src/frontend/tab-pages/wlanpage.cpp b/src/frontend/tab-pages/wlanpage.cpp index fc5aecf2..31b05b35 100644 --- a/src/frontend/tab-pages/wlanpage.cpp +++ b/src/frontend/tab-pages/wlanpage.cpp @@ -294,9 +294,8 @@ void WlanPage::initDeviceCombox() } } else { m_deviceFrame->hide(); - //解决因m_currentDevice被置空,安全中心网络显示BUG -// m_currentDevice = ""; -// setDefaultDevice(WIRELESS, m_currentDevice); + m_currentDevice = ""; + setDefaultDevice(WIRELESS, m_currentDevice); } connect(m_deviceComboBox, QOverload::of(&QComboBox::currentIndexChanged), @@ -780,25 +779,23 @@ void WlanPage::deleteDeviceFromCombox(QString deviceName) disconnect(m_deviceComboBox, QOverload::of(&QComboBox::currentIndexChanged), this, &WlanPage::onDeviceComboxIndexChanged); - if (getSwitchBtnState()) { - if (0 == m_devList.count()) { - m_deviceFrame->hide(); - //m_tipsLabel->show(); - //m_deviceComboBox->hide(); - m_currentDevice = ""; + if (0 == m_devList.count()) { + m_deviceFrame->hide(); + //m_tipsLabel->show(); + //m_deviceComboBox->hide(); + m_currentDevice = ""; + setDefaultDevice(WIRELESS, m_currentDevice); + } else if (1 == m_devList.count()) { + m_deviceFrame->hide(); + m_deviceComboBox->clear(); + m_currentDevice = m_devList.at(0); + setDefaultDevice(WIRELESS, m_currentDevice); + } else { + int index = m_deviceComboBox->findText(deviceName); + if (-1 != index) { + m_deviceComboBox->removeItem(index); + m_currentDevice = m_deviceComboBox->currentText(); setDefaultDevice(WIRELESS, m_currentDevice); - } else if (1 == m_devList.count()) { - m_deviceFrame->hide(); - m_deviceComboBox->clear(); - m_currentDevice = m_devList.at(0); - setDefaultDevice(WIRELESS, m_currentDevice); - } else { - int index = m_deviceComboBox->findText(deviceName); - if (-1 != index) { - m_deviceComboBox->removeItem(index); - m_currentDevice = m_deviceComboBox->currentText(); - setDefaultDevice(WIRELESS, m_currentDevice); - } } }