fix(网络弹窗): 修改界面内部分割线颜色(bug133746)

This commit is contained in:
zhangyuanyuan1 2023-07-27 14:39:37 +08:00
parent c5d757d832
commit b9c96d1bd5
10 changed files with 17 additions and 24 deletions

View File

@ -58,7 +58,7 @@ void SinglePage::initUI()
m_titleLayout->addWidget(m_titleLabel); m_titleLayout->addWidget(m_titleLabel);
m_titleLayout->addStretch(); m_titleLayout->addStretch();
m_netDivider = new Divider(this); m_netDivider = new Divider(true, this);
m_listFrame = new QFrame(this); m_listFrame = new QFrame(this);
m_listLayout = new QVBoxLayout(m_listFrame); m_listLayout = new QVBoxLayout(m_listFrame);
@ -68,7 +68,7 @@ void SinglePage::initUI()
m_listLayout->addWidget(m_listWidget); m_listLayout->addWidget(m_listWidget);
m_listWidget->setProperty("needTranslucent", true); m_listWidget->setProperty("needTranslucent", true);
m_setDivider = new Divider(this); m_setDivider = new Divider(true, this);
m_settingsFrame = new QFrame(this); m_settingsFrame = new QFrame(this);
m_settingsFrame->setFixedHeight(TITLE_FRAME_HEIGHT); m_settingsFrame->setFixedHeight(TITLE_FRAME_HEIGHT);

View File

@ -102,7 +102,7 @@ void VpnDetail::initUI()
m_topWidget = new QWidget(this); m_topWidget = new QWidget(this);
m_centerWidget = new QWidget(this); m_centerWidget = new QWidget(this);
m_bottomWidget = new QWidget(this); m_bottomWidget = new QWidget(this);
m_divider = new Divider(this); m_divider = new Divider(false, this);
m_vpnTabBar = new VpnTabBar(this); m_vpnTabBar = new VpnTabBar(this);
m_autoConnectBox = new QCheckBox(this); m_autoConnectBox = new QCheckBox(this);
m_autoConnectLabel = new QLabel(this); m_autoConnectLabel = new QLabel(this);

View File

@ -139,7 +139,7 @@ void EnterpriseWlanDialog::initUI()
m_enterWlanScrollArea->setWidgetResizable(true); m_enterWlanScrollArea->setWidgetResizable(true);
m_enterWlanScrollArea->setBackgroundRole(QPalette::Base); m_enterWlanScrollArea->setBackgroundRole(QPalette::Base);
m_bottomDivider = new Divider(this); m_bottomDivider = new Divider(false, this);
QWidget *bottomWidget = new QWidget(this); QWidget *bottomWidget = new QWidget(this);
QHBoxLayout *btnLayout = new QHBoxLayout(bottomWidget); QHBoxLayout *btnLayout = new QHBoxLayout(bottomWidget);

View File

@ -60,7 +60,7 @@ void DnsSettingWidget::initUi()
} }
m_retryComboBox->setCurrentIndex(m_retryComboBox->findData(m_retry.toInt())); m_retryComboBox->setCurrentIndex(m_retryComboBox->findData(m_retry.toInt()));
m_bottomDivider = new Divider(true, this); m_bottomDivider = new Divider(false, this);
m_closeBtn = new QPushButton(this); m_closeBtn = new QPushButton(this);
m_closeBtn->setFixedSize(32,32); m_closeBtn->setFixedSize(32,32);

View File

@ -96,7 +96,7 @@ void Ipv4Page::initUI() {
// IP的正则格式限制 // IP的正则格式限制
QRegExp rx("\\b(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\b"); QRegExp rx("\\b(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\b");
Divider* divider = new Divider(true, this); Divider* divider = new Divider(false, this);
m_dnsWidget = new MultipleDnsWidget(rx, true, this); m_dnsWidget = new MultipleDnsWidget(rx, true, this);
m_detailLayout = new QFormLayout(this); m_detailLayout = new QFormLayout(this);

View File

@ -77,7 +77,7 @@ void JoinHiddenWiFiPage::initUI()
m_nameLabel->setFixedWidth(LABEL_MIN_WIDTH); m_nameLabel->setFixedWidth(LABEL_MIN_WIDTH);
m_nameEdit =new LineEdit(this); m_nameEdit =new LineEdit(this);
m_bottomDivider = new Divider(this); m_bottomDivider = new Divider(false, this);
m_showListBtn = new KBorderlessButton(this); m_showListBtn = new KBorderlessButton(this);
m_cancelBtn =new QPushButton(this); m_cancelBtn =new QPushButton(this);
m_joinBtn =new QPushButton(this); m_joinBtn =new QPushButton(this);

View File

@ -400,7 +400,7 @@ void NetDetail::initUI()
centerlayout->setContentsMargins(CENTER_LAYOUT_MARGINS); // 右边距为0为安全页滚动区域留出空间 centerlayout->setContentsMargins(CENTER_LAYOUT_MARGINS); // 右边距为0为安全页滚动区域留出空间
centerlayout->addWidget(stackWidget); centerlayout->addWidget(stackWidget);
Divider *divider = new Divider(true, this); Divider *divider = new Divider(false, this);
QHBoxLayout *bottomLayout = new QHBoxLayout(bottomWidget); QHBoxLayout *bottomLayout = new QHBoxLayout(bottomWidget);
bottomLayout->setContentsMargins(BOTTOM_LAYOUT_MARGINS); bottomLayout->setContentsMargins(BOTTOM_LAYOUT_MARGINS);

View File

@ -60,7 +60,7 @@ void TabPage::initUI()
m_titleLayout->addWidget(m_titleLabel); m_titleLayout->addWidget(m_titleLabel);
m_titleLayout->addStretch(); m_titleLayout->addStretch();
m_titleLayout->addWidget(m_netSwitch); m_titleLayout->addWidget(m_netSwitch);
m_titleDivider = new Divider(this); m_titleDivider = new Divider(true, this);
//临时增加的下拉框选择网卡区域 //临时增加的下拉框选择网卡区域
m_deviceFrame = new QFrame(this); m_deviceFrame = new QFrame(this);
@ -92,7 +92,7 @@ void TabPage::initUI()
m_activatedNetLabel->setContentsMargins(TEXT_MARGINS); m_activatedNetLabel->setContentsMargins(TEXT_MARGINS);
m_activatedNetLabel->setFixedHeight(TEXT_HEIGHT); m_activatedNetLabel->setFixedHeight(TEXT_HEIGHT);
m_activatedNetLayout->addWidget(m_activatedNetLabel); m_activatedNetLayout->addWidget(m_activatedNetLabel);
m_activatedNetDivider = new Divider(this); m_activatedNetDivider = new Divider(true, this);
m_inactivatedNetFrame = new QFrame(this); m_inactivatedNetFrame = new QFrame(this);
m_inactivatedNetFrame->setMinimumHeight(INACTIVE_AREA_MIN_HEIGHT); m_inactivatedNetFrame->setMinimumHeight(INACTIVE_AREA_MIN_HEIGHT);
@ -120,7 +120,7 @@ void TabPage::initUI()
m_inactivatedNetLayout->addWidget(m_inactivatedNetLabel); m_inactivatedNetLayout->addWidget(m_inactivatedNetLabel);
m_inactivatedNetLayout->addWidget(m_inactivatedNetListArea); m_inactivatedNetLayout->addWidget(m_inactivatedNetListArea);
m_inactivatedNetDivider = new Divider(this); m_inactivatedNetDivider = new Divider(true, this);
m_settingsFrame = new QFrame(this); m_settingsFrame = new QFrame(this);
m_settingsFrame->setFixedHeight(TITLE_FRAME_HEIGHT); m_settingsFrame->setFixedHeight(TITLE_FRAME_HEIGHT);

View File

@ -27,34 +27,28 @@
#define THEME_SCHAME "org.ukui.style" #define THEME_SCHAME "org.ukui.style"
#define COLOR_THEME "styleName" #define COLOR_THEME "styleName"
Divider::Divider(bool useLightPal, QWidget * parent) Divider::Divider(bool useDarkPal, QWidget * parent)
:m_useLightPal(useLightPal), :m_useDarkPal(useDarkPal),
QFrame(parent) QFrame(parent)
{ {
this->setFixedHeight(1); this->setFixedHeight(1);
initPalette();
connect(qApp, &QApplication::paletteChanged, this ,&Divider::onPaletteChanged); connect(qApp, &QApplication::paletteChanged, this ,&Divider::onPaletteChanged);
onPaletteChanged(); onPaletteChanged();
} }
void Divider::initPalette() void Divider::onPaletteChanged()
{ {
QPalette pal = qApp->palette(); QPalette pal = qApp->palette();
QGSettings * styleGsettings = nullptr; QGSettings * styleGsettings = nullptr;
const QByteArray styleId(THEME_SCHAME); const QByteArray styleId(THEME_SCHAME);
if (QGSettings::isSchemaInstalled(styleId)) { if (QGSettings::isSchemaInstalled(styleId) && m_useDarkPal) {
styleGsettings = new QGSettings(styleId, QByteArray(), this); styleGsettings = new QGSettings(styleId, QByteArray(), this);
QString currentTheme = styleGsettings->get(COLOR_THEME).toString(); QString currentTheme = styleGsettings->get(COLOR_THEME).toString();
if(currentTheme == "ukui-default"){ if(currentTheme == "ukui-default"){
pal = themePalette(true, this); pal = themePalette(true, this);
} }
} }
this->setPalette(pal);
}
void Divider::onPaletteChanged()
{
QPalette pal = this->palette();
m_color = pal.color(QPalette::BrightText); m_color = pal.color(QPalette::BrightText);
m_color.setAlphaF(0.08); m_color.setAlphaF(0.08);
} }

View File

@ -24,12 +24,11 @@
class Divider : public QFrame class Divider : public QFrame
{ {
public: public:
Divider(bool useLightPal = false, QWidget * parent = nullptr); Divider(bool useDarkPal = false, QWidget * parent = nullptr);
~Divider() = default; ~Divider() = default;
private: private:
bool m_useLightPal; bool m_useDarkPal;
QColor m_color; QColor m_color;
void initPalette();
private Q_SLOTS: private Q_SLOTS:
void onPaletteChanged(); void onPaletteChanged();
protected: protected: