fix bug:107815

This commit is contained in:
jzxc95 2022-02-25 14:25:02 +08:00
parent 4722a53846
commit ebb48e4a72
4 changed files with 20 additions and 16 deletions

View File

@ -152,8 +152,8 @@ void LanListItem::onInfoButtonClicked()
return;
}
if(isDetailShow){
qDebug()<< LOG_FLAG << "the detail page has be shown , so do not show again" << Q_FUNC_INFO << __LINE__;
if(netDetail != nullptr){
netDetail->activateWindow();
return;
}
@ -166,9 +166,15 @@ void LanListItem::onInfoButtonClicked()
isActivated = true;
}
NetDetail *netDetail = new NetDetail(m_deviceName, m_lanConnectItem.m_connectName,
netDetail = new NetDetail(m_deviceName, m_lanConnectItem.m_connectName,
m_lanConnectItem.m_connectUuid, isActivated,false, false, this);
connect(netDetail, &NetDetail::detailPageClose, this, &LanListItem::onDetailShow);
connect(netDetail, &NetDetail::destroyed, [&](){
if (netDetail != nullptr) {
netDetail = nullptr;
}
});
netDetail->show();
emit this->detailShow(true);

View File

@ -14,12 +14,10 @@
ListItem::ListItem(QWidget *parent) : QFrame(parent)
{
m_connectState = UnknownState;
isDetailShow = false;
initUI();
initConnection();
connect(qApp, &QApplication::paletteChanged, this, &ListItem::onPaletteChanged);
connect(this, &ListItem::detailShow, this, &ListItem::onDetailShow);
// m_itemFrame->installEventFilter(this);
}
@ -166,7 +164,3 @@ void ListItem::onPaletteChanged()
// this->setPalette(pal);
}
void ListItem::onDetailShow(bool isShow)
{
isDetailShow = isShow;
}

View File

@ -50,7 +50,8 @@ protected:
public:
QVBoxLayout * m_mainLayout = nullptr;
QHBoxLayout * m_hItemLayout = nullptr;
bool isDetailShow;
NetDetail *netDetail = nullptr;
private:
void initUI();
void initConnection();
@ -58,7 +59,6 @@ private:
public slots:
virtual void onNetButtonClicked() = 0;
void onPaletteChanged();
void onDetailShow(bool isShow);
virtual void onMenuTriggered(QAction *action)=0;
signals:

View File

@ -367,8 +367,8 @@ void WlanListItem::refreshIcon(bool isActivated)
void WlanListItem::onInfoButtonClicked()
{
//ZJP_TODO 呼出无线详情页
if(isDetailShow){
qDebug() << "has show the detail page,and do not show again" << Q_FUNC_INFO << __LINE__;
if(netDetail != nullptr){
netDetail->activateWindow();
return;
}
@ -383,10 +383,14 @@ void WlanListItem::onInfoButtonClicked()
isActive = true;
}
NetDetail *netDetail = new NetDetail(m_wlanDevice, m_wirelessNetItem.m_NetSsid,
netDetail = new NetDetail(m_wlanDevice, m_wirelessNetItem.m_NetSsid,
m_wirelessNetItem.m_connectUuid, isActive, true,
!m_wirelessNetItem.m_isConfigured, this);
connect(netDetail, &NetDetail::detailPageClose, this, &WlanListItem::onDetailShow);
connect(netDetail, &NetDetail::destroyed, [&](){
if (netDetail != nullptr) {
netDetail = nullptr;
}
});
netDetail->show();
emit this->detailShow(true);
}