fix(wlan device combobox): modify logic of device combobox display

This commit is contained in:
zhangyuanyuan1 2023-10-09 10:17:53 +08:00
parent 7ce857f0c8
commit a85a549082
1 changed files with 18 additions and 21 deletions

View File

@ -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<int>::of(&QComboBox::currentIndexChanged),
@ -780,25 +779,23 @@ void WlanPage::deleteDeviceFromCombox(QString deviceName)
disconnect(m_deviceComboBox, QOverload<int>::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);
}
}
}