diff --git a/src/frontend/list-items/lanlistitem.cpp b/src/frontend/list-items/lanlistitem.cpp index 93c172ef..6f555845 100644 --- a/src/frontend/list-items/lanlistitem.cpp +++ b/src/frontend/list-items/lanlistitem.cpp @@ -32,6 +32,7 @@ LanListItem::LanListItem(QWidget *parent) : ListItem(parent) { m_isActive = false; m_netButton->setButtonIcon(QIcon::fromTheme("network-offline-symbolic")); + m_netButton->setDefaultPixmap(); const QString str=tr("Not connected"); m_nameLabel->setText(str); this->m_infoButton->hide(); diff --git a/src/frontend/list-items/wlanlistitem.cpp b/src/frontend/list-items/wlanlistitem.cpp index 7c0d1465..ac39a4ea 100644 --- a/src/frontend/list-items/wlanlistitem.cpp +++ b/src/frontend/list-items/wlanlistitem.cpp @@ -31,6 +31,7 @@ WlanListItem::WlanListItem(QWidget *parent) : ListItem(parent) qDebug()<<"[WlanPage] wlan list item is created." << m_wirelessNetItem.m_NetSsid; m_netButton->setButtonIcon(QIcon::fromTheme("network-wireless-signal-none-symbolic")); + m_netButton->setDefaultPixmap(); const QString name = tr("Not connected"); setExpanded(false); this->setName(name); @@ -303,6 +304,7 @@ void WlanListItem::refreshIcon() break; } } + m_netButton->setActive(false); } void WlanListItem::onInfoButtonClicked() diff --git a/src/frontend/tools/radioitembutton.cpp b/src/frontend/tools/radioitembutton.cpp index ace9db26..4006d2ac 100644 --- a/src/frontend/tools/radioitembutton.cpp +++ b/src/frontend/tools/radioitembutton.cpp @@ -25,7 +25,6 @@ RadioItemButton::RadioItemButton(QWidget *parent) : QPushButton(parent) m_iconLabel->setFixedSize(BUTTON_SIZE); m_iconLabel->setAlignment(Qt::AlignCenter); - setActive(false); //JXJ_TODO loading动画 connect(this, &RadioItemButton::requestStartLoading, this, &RadioItemButton::onLoadingStarted); @@ -47,16 +46,21 @@ void RadioItemButton::stopLoading() { emit this->requestStopLoading(); } - +//设置图标 void RadioItemButton::setButtonIcon(const QIcon &icon) { if (icon.isNull()) { return; } m_pixmap = icon.pixmap(ICON_SIZE); +// m_iconLabel->setPixmap(m_pixmap); +} +//显示默认图标 +void RadioItemButton::setDefaultPixmap() +{ m_iconLabel->setPixmap(m_pixmap); } - +//根据连接状态更改图标颜色 void RadioItemButton::setActive(const bool &isActive) { m_isActivated = isActive; diff --git a/src/frontend/tools/radioitembutton.h b/src/frontend/tools/radioitembutton.h index e7c3c526..eb1142e0 100644 --- a/src/frontend/tools/radioitembutton.h +++ b/src/frontend/tools/radioitembutton.h @@ -18,6 +18,7 @@ public: void startLoading(); void stopLoading(); void setButtonIcon(const QIcon &icon); + void setDefaultPixmap(); void setActive(const bool &isActive); enum PixmapColor { WHITE = 0,