Merge branch '2209bug-cc' into 'yhkylin/v101'

fix bug #154969  #154699 #154628 #155602

See merge request kylinos-src/kylin-nm!80
This commit is contained in:
赵世旭 2023-01-17 01:06:13 +00:00
commit a575fa6a0d
6 changed files with 48 additions and 27 deletions

View File

@ -34,11 +34,7 @@ AddNetBtn::AddNetBtn(bool isWlan, QWidget *parent) : QPushButton(parent)
this->setMaximumSize(QSize(16777215, 60));
this->setProperty("useButtonPalette", true);
this->setFlat(true);
QPalette pal = this->palette();
QColor color = pal.color(QPalette::Button);
color.setAlphaF(0.5);
pal.setColor(QPalette::Button, color);
this->setPalette(pal);
QHBoxLayout *addLyt = new QHBoxLayout;
QLabel *iconLabel = new QLabel();
@ -62,7 +58,6 @@ AddNetBtn::AddNetBtn(bool isWlan, QWidget *parent) : QPushButton(parent)
addLyt->addStretch();
this->setLayout(addLyt);
}
AddNetBtn::~AddNetBtn()
@ -84,13 +79,18 @@ void AddNetBtn::leaveEvent(QEvent *event){
void AddNetBtn::paintEvent(QPaintEvent *event)
{
QPalette pal = this->palette();
QPalette pal = qApp->palette();
QPainter painter(this);
painter.setRenderHint(QPainter:: Antialiasing, true); //设置渲染,启动反锯齿
painter.setPen(Qt::NoPen);
painter.setBrush(pal.color(QPalette::Base));
QColor color = pal.color(QPalette::Button);
color.setAlphaF(0.5);
pal.setColor(QPalette::Button, color);
this->setPalette(pal);
QRect rect = this->rect();
QPainterPath path;

View File

@ -18,6 +18,8 @@
*
*/
#include "lanitem.h"
#include <QApplication>
#define FRAME_SPEED 150
#define LIMIT_TIME 60*1000
#define TOTAL_PAGE 8
@ -31,11 +33,6 @@ LanItem::LanItem(bool isAcitve, QWidget *parent)
this->setMinimumSize(550, 58);
this->setProperty("useButtonPalette", true);
this->setFlat(true);
QPalette pal = this->palette();
QColor color = pal.color(QPalette::Button);
color.setAlphaF(0.5);
pal.setColor(QPalette::Button, color);
this->setPalette(pal);
// setStyleSheet("QPushButton:!checked{background-color: palette(base)}");
QHBoxLayout *mLanLyt = new QHBoxLayout(this);
mLanLyt->setContentsMargins(16,0,16,0);
@ -44,6 +41,7 @@ LanItem::LanItem(bool isAcitve, QWidget *parent)
iconLabel->setProperty("useIconHighlightEffect", 0x2);
titileLabel = new FixLabel(this);
statusLabel = new QLabel(this);
statusLabel->setProperty("useIconHighlightEffect", 0x2);
statusLabel->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
// statusLabel->setMinimumSize(36,36);
infoLabel = new GrayInfoButton(this);
@ -91,13 +89,18 @@ void LanItem::stopLoading(){
void LanItem::paintEvent(QPaintEvent *event)
{
QPalette pal = this->palette();
QPalette pal = qApp->palette();
QPainter painter(this);
painter.setRenderHint(QPainter:: Antialiasing, true); //设置渲染,启动反锯齿
painter.setPen(Qt::NoPen);
painter.setBrush(pal.color(QPalette::Base));
QColor color = pal.color(QPalette::Button);
color.setAlphaF(0.5);
pal.setColor(QPalette::Button, color);
this->setPalette(pal);
QRect rect = this->rect();
painter.drawRect(rect);

View File

@ -45,7 +45,7 @@
#define PROXY_HOST_KEY "host"
#define PROXY_PORT_KEY "port"
#define THEME_SCHAME "org.ukui.style"
#define FRAME_LAYOUT_MARGINS 16,0,16,0
#define FRAME_LAYOUT_SPACING 8
#define LABEL_WIDTH 136
@ -1160,18 +1160,22 @@ void Proxy::setAppListFrameUi(QWidget *widget)
m_allowAppProxyLabel->setText(tr("The following applications are allowed to use this configuration:")); //允许以下应用使用该配置:
m_appListWidget = new QListWidget(m_appListFrame);
m_appListWidget->setMinimumHeight(240);
m_appListWidget->setBackgroundRole(QPalette::Base);
m_appListWidget->setFocusPolicy(Qt::FocusPolicy::NoFocus);
m_appListWidget->setFrameShape(QFrame::Shape::Panel);
appListLayout->addWidget(m_allowAppProxyLabel);
appListLayout->addWidget(m_appListWidget);
QPalette mpal(m_appListWidget->palette());
mpal.setColor(QPalette::Base, qApp->palette().base().color());
mpal.setColor(QPalette::AlternateBase, qApp->palette().alternateBase().color());
m_appListWidget->setAlternatingRowColors(true);
m_appListWidget->setPalette(mpal);
onPaletteChanged();
const QByteArray style_id(THEME_SCHAME);
if (QGSettings::isSchemaInstalled(style_id)) {
QGSettings * styleGsettings = new QGSettings(style_id, QByteArray(), this);
connect(styleGsettings, &QGSettings::changed, this, [=](QString key){
if ("styleName" == key) {
onPaletteChanged();
}
});
}
}
void Proxy::appProxyInfoPadding()
@ -1269,6 +1273,16 @@ void Proxy::onAppProxyConfEditFinished()
}
}
void Proxy::onPaletteChanged()
{
QPalette mpal(m_appListWidget->palette());
mpal.setColor(QPalette::Base, qApp->palette().base().color());
mpal.setColor(QPalette::AlternateBase, qApp->palette().alternateBase().color());
m_appListWidget->setBackgroundRole(QPalette::Base);
m_appListWidget->setAlternatingRowColors(true);
m_appListWidget->setPalette(mpal);
}
void Proxy::onappProxyEnableChanged(bool enable)
{
m_proxyTypeFrame->setVisible(enable);

View File

@ -277,6 +277,7 @@ private slots:
void onipEditStateChanged(); //IP地址无效提示
void onAppProxyConfChanged(); //应用代理配置信息变化
void onAppProxyConfEditFinished();
void onPaletteChanged();
// void onCancelBtnClicked();
// void onSaveBtnClicked();
// void setBtnEnable();

View File

@ -19,6 +19,7 @@
*/
#include "wlanitem.h"
#include <QPainter>
#include <QApplication>
#define FRAME_SPEED 150
#define LIMIT_TIME 60*1000
#define TOTAL_PAGE 8
@ -33,11 +34,7 @@ WlanItem::WlanItem(bool bAcitve, bool isLock, QWidget *parent)
this->setMinimumSize(550, 58);
this->setProperty("useButtonPalette", true);
this->setFlat(true);
QPalette pal = this->palette();
QColor color = pal.color(QPalette::Button);
color.setAlphaF(0.5);
pal.setColor(QPalette::Button, color);
this->setPalette(pal);
QHBoxLayout *mLanLyt = new QHBoxLayout(this);
mLanLyt->setContentsMargins(16,0,16,0);
mLanLyt->setSpacing(16);
@ -45,6 +42,7 @@ WlanItem::WlanItem(bool bAcitve, bool isLock, QWidget *parent)
iconLabel->setProperty("useIconHighlightEffect", 0x2);
titileLabel = new FixLabel(this);
statusLabel = new QLabel(this);
statusLabel->setProperty("useIconHighlightEffect", 0x2);
statusLabel->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
// statusLabel->setMinimumSize(36,36);
infoLabel = new GrayInfoButton(this);
@ -64,7 +62,6 @@ WlanItem::WlanItem(bool bAcitve, bool isLock, QWidget *parent)
waitTimer = new QTimer(this);
connect(waitTimer, &QTimer::timeout, this, &WlanItem::updateIcon);
}
WlanItem::~WlanItem()
@ -94,13 +91,18 @@ void WlanItem::stopLoading(){
void WlanItem::paintEvent(QPaintEvent *event)
{
QPalette pal = this->palette();
QPalette pal = qApp->palette();
QPainter painter(this);
painter.setRenderHint(QPainter:: Antialiasing, true); //设置渲染,启动反锯齿
painter.setPen(Qt::NoPen);
painter.setBrush(pal.color(QPalette::Base));
QColor color = pal.color(QPalette::Button);
color.setAlphaF(0.5);
pal.setColor(QPalette::Button, color);
this->setPalette(pal);
QRect rect = this->rect();
#if 0

View File

@ -959,6 +959,7 @@ void WlanPage::onConnectionStateChanged(QString uuid,
if (ssid.isEmpty()) {
qDebug()<< LOG_FLAG << "ssid or devicename is empty"
<< "devicename"<< devName <<"ssid"<<ssid;
NetworkModeConfig::getInstance()->breakNetworkConnect(uuid, devName, ssid);
return;
}