Merge branch '2309bug-0725' into 'yhkylin/v101'

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

See merge request kylinos-src/kylin-nm!233
This commit is contained in:
赵世旭 2023-07-28 08:48:51 +00:00
commit 6e8a15a92c
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->addStretch();
m_netDivider = new Divider(this);
m_netDivider = new Divider(true, this);
m_listFrame = new QFrame(this);
m_listLayout = new QVBoxLayout(m_listFrame);
@ -68,7 +68,7 @@ void SinglePage::initUI()
m_listLayout->addWidget(m_listWidget);
m_listWidget->setProperty("needTranslucent", true);
m_setDivider = new Divider(this);
m_setDivider = new Divider(true, this);
m_settingsFrame = new QFrame(this);
m_settingsFrame->setFixedHeight(TITLE_FRAME_HEIGHT);

View File

@ -102,7 +102,7 @@ void VpnDetail::initUI()
m_topWidget = new QWidget(this);
m_centerWidget = 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_autoConnectBox = new QCheckBox(this);
m_autoConnectLabel = new QLabel(this);

View File

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

View File

@ -60,7 +60,7 @@ void DnsSettingWidget::initUi()
}
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->setFixedSize(32,32);

View File

@ -96,7 +96,7 @@ void Ipv4Page::initUI() {
// 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");
Divider* divider = new Divider(true, this);
Divider* divider = new Divider(false, this);
m_dnsWidget = new MultipleDnsWidget(rx, true, this);
m_detailLayout = new QFormLayout(this);

View File

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

View File

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

View File

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

View File

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

View File

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