调整控制面板网络项背景色为button色透明度0.5
This commit is contained in:
parent
3f7228e879
commit
ca06d65e2e
|
@ -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;
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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();
|
||||
|
||||
|
|
|
@ -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();
|
||||
|
||||
|
|
Loading…
Reference in New Issue