Merge branch '2303bug-tray' into 'yhkylin/v101'

调整控制面板网络项背景色为button色透明度0.5

See merge request kylinos-src/kylin-nm!178
This commit is contained in:
陈学超 2023-05-31 09:10:27 +00:00
commit fe66666737
4 changed files with 25 additions and 13 deletions

View File

@ -34,7 +34,6 @@ AddNetBtn::AddNetBtn(bool isWlan, QWidget *parent) : QPushButton(parent)
this->setMaximumSize(QSize(16777215, 60));
this->setProperty("useButtonPalette", true);
this->setFlat(true);
this->setProperty("needTranslucent", true);
QHBoxLayout *addLyt = new QHBoxLayout;
@ -85,6 +84,12 @@ void AddNetBtn::paintEvent(QPaintEvent *event)
painter.setPen(Qt::NoPen);
painter.setBrush(this->palette().base().color());
QPalette pal = qApp->palette();
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

@ -33,7 +33,6 @@ LanItem::LanItem(bool isAcitve, QWidget *parent)
this->setMinimumSize(550, 58);
this->setProperty("useButtonPalette", true);
this->setFlat(true);
this->setProperty("needTranslucent", true);
// setStyleSheet("QPushButton:!checked{background-color: palette(base)}");
QHBoxLayout *mLanLyt = new QHBoxLayout(this);
mLanLyt->setContentsMargins(16,0,16,0);
@ -95,6 +94,12 @@ void LanItem::paintEvent(QPaintEvent *event)
painter.setPen(Qt::NoPen);
painter.setBrush(this->palette().base().color());
QPalette pal = qApp->palette();
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

@ -20,6 +20,7 @@
#include "vpnitem.h"
#include <QPainter>
#include <QPainterPath>
#include <QApplication>
#define FRAME_SPEED 150
#define LIMIT_TIME 60*1000
#define TOTAL_PAGE 8
@ -34,7 +35,6 @@ VpnItem::VpnItem(bool bAcitve, QWidget *parent)
this->setMinimumSize(550, 58);
this->setProperty("useButtonPalette", true);
this->setFlat(true);
this->setProperty("needTranslucent", true);
QHBoxLayout *mLanLyt = new QHBoxLayout(this);
mLanLyt->setContentsMargins(16,0,16,0);
@ -133,12 +133,16 @@ void VpnItem::onDeletetTriggered()
void VpnItem::paintEvent(QPaintEvent *event)
{
QPalette pal = this->palette();
QPainter painter(this);
painter.setRenderHint(QPainter:: Antialiasing, true); //设置渲染,启动反锯齿
painter.setPen(Qt::NoPen);
painter.setBrush(pal.color(QPalette::Base));
painter.setBrush(this->palette().base().color());
QPalette pal = qApp->palette();
QColor color = pal.color(QPalette::Button);
color.setAlphaF(0.5);
pal.setColor(QPalette::Button, color);
this->setPalette(pal);
QRect rect = this->rect();

View File

@ -35,7 +35,6 @@ WlanItem::WlanItem(bool bAcitve, bool isLock, QWidget *parent)
this->setMinimumSize(550, 58);
this->setProperty("useButtonPalette", true);
this->setFlat(true);
this->setProperty("needTranslucent", true);
QHBoxLayout *mLanLyt = new QHBoxLayout(this);
mLanLyt->setContentsMargins(16,0,16,0);
@ -93,17 +92,16 @@ void WlanItem::stopLoading(){
void WlanItem::paintEvent(QPaintEvent *event)
{
// QPalette pal = qApp->palette();
QPainter painter(this);
painter.setRenderHint(QPainter:: Antialiasing, true); //设置渲染,启动反锯齿
painter.setPen(Qt::NoPen);
painter.setBrush(this->palette().base().color());
// QColor color = pal.color(QPalette::Button);
// color.setAlphaF(0.5);
// pal.setColor(QPalette::Button, color);
// this->setPalette(pal);
QPalette pal = qApp->palette();
QColor color = pal.color(QPalette::Button);
color.setAlphaF(0.5);
pal.setColor(QPalette::Button, color);
this->setPalette(pal);
QRect rect = this->rect();