diff --git a/src/frontend/mainwindow.h b/src/frontend/mainwindow.h index d0bf9430..c5f85f54 100644 --- a/src/frontend/mainwindow.h +++ b/src/frontend/mainwindow.h @@ -118,7 +118,7 @@ private: void initWindowTheme(); void resetWindowTheme(); void showControlCenter(); - double m_transparency=0.0; //透明度 + double m_transparency=1.0; //透明度 QGSettings * m_transGsettings; //透明度配置文件 int currentIconIndex=0; QList loadIcons; diff --git a/src/frontend/tab-pages/lanpage.cpp b/src/frontend/tab-pages/lanpage.cpp index f15b3718..c452be76 100644 --- a/src/frontend/tab-pages/lanpage.cpp +++ b/src/frontend/tab-pages/lanpage.cpp @@ -746,7 +746,6 @@ void LanPage::initUI() m_titleLabel->setText(tr("LAN")); m_activatedNetLabel->setText(tr("Activated LAN")); - m_activatedNetLabel->setDisabled(true); m_activatedLanListWidget = new QListWidget(m_activatedNetFrame); m_activatedLanListWidget->setFrameShape(QFrame::Shape::NoFrame); m_activatedLanListWidget->setSpacing(LAN_LIST_SPACING); @@ -755,7 +754,6 @@ void LanPage::initUI() m_activatedNetLayout->addWidget(m_activatedLanListWidget); m_inactivatedNetLabel->setText(tr("Inactivated LAN")); - m_inactivatedNetLabel->setDisabled(true); m_inactivatedLanListWidget = new QListWidget(m_inactivatedNetListArea); m_inactivatedLanListWidget->setFrameShape(QFrame::Shape::NoFrame); m_inactivatedLanListWidget->setSpacing(LAN_LIST_SPACING); diff --git a/src/frontend/tab-pages/tabpage.cpp b/src/frontend/tab-pages/tabpage.cpp index a11d7a86..f758cf50 100644 --- a/src/frontend/tab-pages/tabpage.cpp +++ b/src/frontend/tab-pages/tabpage.cpp @@ -2,10 +2,12 @@ #include #include #include +#include TabPage::TabPage(QWidget *parent) : QWidget(parent) { initUI(); + connect(qApp, &QApplication::paletteChanged, this, &TabPage::onPaletteChanged); } TabPage::~TabPage() @@ -43,13 +45,7 @@ void TabPage::initUI() m_deviceLabel->setText(tr("Current Device")); m_deviceComboBox = new QComboBox(m_deviceFrame); m_deviceComboBox->setFixedWidth(DEVICE_COMBOBOX_WIDTH); - if (m_deviceComboBox->view()) { - QPalette view_pal = m_deviceComboBox->view()->palette(); - QColor view_color = m_deviceComboBox->palette().color(QPalette::Active, QPalette::Button); - view_pal.setColor(QPalette::Base, view_color); - m_deviceComboBox->setPalette(view_pal); - m_deviceComboBox->view()->setPalette(view_pal); - } + m_tipsLabel = new QLabel(m_deviceFrame); m_tipsLabel->setText(tr("Devices Closed!")); m_deviceLayout->addWidget(m_deviceLabel); @@ -120,6 +116,25 @@ void TabPage::initUI() QPalette pal = m_inactivatedNetListArea->palette(); pal.setBrush(QPalette::Base, QColor(0,0,0,0)); //背景透明 m_inactivatedNetListArea->setPalette(pal); + + onPaletteChanged(); +} + +void TabPage::onPaletteChanged() +{ + QPalette labPal = m_activatedNetLabel->palette(); + QColor color = labPal.color(QPalette::PlaceholderText); + labPal.setColor(QPalette::WindowText, color); + m_activatedNetLabel->setPalette(labPal); + m_inactivatedNetLabel->setPalette(labPal); + + if (m_deviceComboBox->view()) { + QPalette view_pal = m_deviceComboBox->view()->palette(); + QColor view_color = m_deviceComboBox->palette().color(QPalette::Active, QPalette::Button); + view_pal.setColor(QPalette::Base, view_color); + m_deviceComboBox->setPalette(view_pal); + m_deviceComboBox->view()->setPalette(view_pal); + } } void TabPage::showDesktopNotify(const QString &message) diff --git a/src/frontend/tab-pages/tabpage.h b/src/frontend/tab-pages/tabpage.h index 3f58edcd..16ee0a16 100644 --- a/src/frontend/tab-pages/tabpage.h +++ b/src/frontend/tab-pages/tabpage.h @@ -102,6 +102,7 @@ protected: public slots: virtual void onDeviceComboxIndexChanged(int currentIndex) = 0; + void onPaletteChanged(); }; diff --git a/src/frontend/tab-pages/wlanpage.cpp b/src/frontend/tab-pages/wlanpage.cpp index e50f513f..4efbc64b 100644 --- a/src/frontend/tab-pages/wlanpage.cpp +++ b/src/frontend/tab-pages/wlanpage.cpp @@ -74,7 +74,6 @@ void WlanPage::initWlanUI() m_titleLabel->setText(tr("WLAN")); m_activatedNetLabel->setText(tr("Activated WLAN")); - m_activatedNetLabel->setDisabled(true); m_activatedNetListWidget = new QListWidget(m_activatedNetFrame); m_activatedNetListWidget->setFrameShape(QFrame::Shape::NoFrame); m_activatedNetListWidget->setContentsMargins(MAIN_LAYOUT_MARGINS); @@ -84,7 +83,6 @@ void WlanPage::initWlanUI() m_activatedNetLayout->addWidget(m_activatedNetListWidget); m_inactivatedNetLabel->setText(tr("Other WLAN")); - m_inactivatedNetLabel->setDisabled(true); m_inactivatedNetListWidget = new QListWidget(m_inactivatedNetListArea); m_inactivatedNetListWidget->setContentsMargins(MAIN_LAYOUT_MARGINS); m_inactivatedNetListWidget->setSpacing(NET_LIST_SPACING);