Merge branch '1209' into 'dbus-interface'

bug#98908字体颜色

See merge request kylin-desktop/kylin-nm!497
This commit is contained in:
ren peijia 2021-12-21 05:40:39 +00:00
commit 9762a2fc91
5 changed files with 24 additions and 12 deletions

View File

@ -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<QIcon> loadIcons;

View File

@ -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);

View File

@ -2,10 +2,12 @@
#include <qsettings.h>
#include <QDBusInterface>
#include <QLabel>
#include <QApplication>
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)

View File

@ -102,6 +102,7 @@ protected:
public slots:
virtual void onDeviceComboxIndexChanged(int currentIndex) = 0;
void onPaletteChanged();
};

View File

@ -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);