控制面板有线/无线/VPN网络项悬停效果增加透明度
This commit is contained in:
parent
6daa149db7
commit
8e0f17806c
|
@ -34,6 +34,7 @@ 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;
|
||||
|
||||
|
@ -79,18 +80,11 @@ void AddNetBtn::leaveEvent(QEvent *event){
|
|||
|
||||
void AddNetBtn::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);
|
||||
|
||||
QRect rect = this->rect();
|
||||
QPainterPath path;
|
||||
|
||||
|
|
|
@ -33,6 +33,7 @@ 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);
|
||||
|
@ -89,18 +90,11 @@ void LanItem::stopLoading(){
|
|||
|
||||
void LanItem::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);
|
||||
|
||||
QRect rect = this->rect();
|
||||
|
||||
painter.drawRect(rect);
|
||||
|
|
|
@ -34,11 +34,8 @@ VpnItem::VpnItem(bool bAcitve, 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);
|
||||
this->setProperty("needTranslucent", true);
|
||||
|
||||
QHBoxLayout *mLanLyt = new QHBoxLayout(this);
|
||||
mLanLyt->setContentsMargins(16,0,16,0);
|
||||
mLanLyt->setSpacing(16);
|
||||
|
|
|
@ -35,6 +35,7 @@ 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);
|
||||
|
|
Loading…
Reference in New Issue