Remove redundant code

This commit is contained in:
chenlelin 2021-04-10 16:08:45 +08:00
parent ddc35a9109
commit aa83bc0886
14 changed files with 146 additions and 134 deletions

View File

@ -42,12 +42,6 @@ ConfForm::ConfForm(QWidget *parent) :
//需要添加 void paintEvent(QPaintEvent *event) 函数 //需要添加 void paintEvent(QPaintEvent *event) 函数
//this->setWindowIcon(QIcon::fromTheme("indicator-china-weather", QIcon(":/res/x/setup.png")) ); //this->setWindowIcon(QIcon::fromTheme("indicator-china-weather", QIcon(":/res/x/setup.png")) );
QPainterPath path;
auto rect = this->rect();
rect.adjust(1, 1, -1, -1);
path.addRoundedRect(rect, 6, 6);
setProperty("blurRegion", QRegion(path.toFillPolygon().toPolygon()));
labelQss = "QLabel{border:0px;color:rgba(255,255,255,0.97);background-color:transparent;}"; labelQss = "QLabel{border:0px;color:rgba(255,255,255,0.97);background-color:transparent;}";
cbxQss = "QComboBox{padding-left:20px;font-size:13px;color:rgba(255,255,255,0.91);" cbxQss = "QComboBox{padding-left:20px;font-size:13px;color:rgba(255,255,255,0.91);"
"border:1px solid rgba(255, 255, 255, 0.05);border-radius:4px;background:rgba(255,255,255,0.08);}" "border:1px solid rgba(255, 255, 255, 0.05);border-radius:4px;background:rgba(255,255,255,0.08);}"
@ -134,7 +128,6 @@ ConfForm::ConfForm(QWidget *parent) :
ui->leAddr_ipv6->setValidator(new QRegExpValidator(ipv6_rx, this)); ui->leAddr_ipv6->setValidator(new QRegExpValidator(ipv6_rx, this));
setModal(false); setModal(false);
KWindowEffects::enableBlurBehind(this->winId(), true, QRegion(path.toFillPolygon().toPolygon()));
setEnableOfBtn(); setEnableOfBtn();
} }
@ -746,10 +739,14 @@ void ConfForm::paintEvent(QPaintEvent *event)
style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this); style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this);
QRect rect = this->rect(); QRect rect = this->rect();
rect.adjust(1, 1, -1, -1);
p.setRenderHint(QPainter::Antialiasing); // 反锯齿; p.setRenderHint(QPainter::Antialiasing); // 反锯齿;
p.setBrush(opt.palette.color(QPalette::Base)); p.setBrush(opt.palette.color(QPalette::Base));
p.setOpacity(trans); p.setOpacity(trans);
p.setPen(Qt::NoPen); p.setPen(Qt::NoPen);
p.drawRoundedRect(rect, 6, 6); p.drawRoundedRect(rect, 6, 6);
QWidget::paintEvent(event); QWidget::paintEvent(event);
QPainterPath path;
KWindowEffects::enableBlurBehind(this->winId(), true, QRegion(path.toFillPolygon().toPolygon()));
} }

View File

@ -64,12 +64,6 @@ MainWindow::MainWindow(QWidget *parent) :
UseQssFile::setStyle("style.qss"); UseQssFile::setStyle("style.qss");
QPainterPath path;
auto rect = this->rect();
rect.adjust(1, 1, -1, -1);
path.addRoundedRect(rect, 6, 6);
setProperty("blurRegion", QRegion(path.toFillPolygon().toPolygon()));
editQssString(); //编辑部分控件QSS editQssString(); //编辑部分控件QSS
createTopLanUI(); //创建顶部有线网item createTopLanUI(); //创建顶部有线网item
createTopWifiUI(); //创建顶部无线网item createTopWifiUI(); //创建顶部无线网item
@ -127,8 +121,6 @@ MainWindow::MainWindow(QWidget *parent) :
ui->btnWifiList->setAttribute(Qt::WA_Hover,true); ui->btnWifiList->setAttribute(Qt::WA_Hover,true);
ui->btnWifiList->installEventFilter(this); ui->btnWifiList->installEventFilter(this);
KWindowEffects::enableBlurBehind(this->winId(), true, QRegion(path.toFillPolygon().toPolygon()));
hasWifiConnected = false; hasWifiConnected = false;
numberForWifiScan = 0; numberForWifiScan = 0;
} }
@ -3639,12 +3631,16 @@ void MainWindow::paintEvent(QPaintEvent *event)
opt.init(this); opt.init(this);
QPainter p(this); QPainter p(this);
QRect rect = this->rect(); QRect rect = this->rect();
rect.adjust(1, 1, -1, -1);
p.setRenderHint(QPainter::Antialiasing); // 反锯齿; p.setRenderHint(QPainter::Antialiasing); // 反锯齿;
p.setBrush(opt.palette.color(QPalette::Base)); p.setBrush(opt.palette.color(QPalette::Base));
p.setOpacity(trans); p.setOpacity(trans);
p.setPen(Qt::NoPen); p.setPen(Qt::NoPen);
p.drawRoundedRect(rect, 6, 6); p.drawRoundedRect(rect, 6, 6);
QWidget::paintEvent(event); QWidget::paintEvent(event);
QPainterPath path;
KWindowEffects::enableBlurBehind(this->winId(), true, QRegion(path.toFillPolygon().toPolygon()));
} }
bool MainWindow::event(QEvent *event) bool MainWindow::event(QEvent *event)

View File

@ -23,12 +23,6 @@ WiFiConfigDialog::WiFiConfigDialog(QWidget *parent) :
this->setAttribute(Qt::WA_TranslucentBackground); this->setAttribute(Qt::WA_TranslucentBackground);
this->setWindowIcon(QIcon::fromTheme("kylin-network", QIcon(":/res/x/setup.png")) ); this->setWindowIcon(QIcon::fromTheme("kylin-network", QIcon(":/res/x/setup.png")) );
QPainterPath path;
auto rect = this->rect();
rect.adjust(1, 1, -1, -1);
path.addRoundedRect(rect, 6, 6);
setProperty("blurRegion", QRegion(path.toFillPolygon().toPolygon()));
ui->lbTitle->setText(tr("Input Wi-Fi Information Please")); //输入Wi-Fi名称和密码后点击确定 ui->lbTitle->setText(tr("Input Wi-Fi Information Please")); //输入Wi-Fi名称和密码后点击确定
ui->lbWifiId->setText(tr("Wi-Fi ID")); //Wi-Fi连接名称 ui->lbWifiId->setText(tr("Wi-Fi ID")); //Wi-Fi连接名称
ui->lbWifiName->setText(tr("Wi-Fi Name")); //Wi-Fi名称 ui->lbWifiName->setText(tr("Wi-Fi Name")); //Wi-Fi名称
@ -49,8 +43,6 @@ WiFiConfigDialog::WiFiConfigDialog(QWidget *parent) :
ui->leWifiPassword->setContextMenuPolicy(Qt::NoContextMenu); ui->leWifiPassword->setContextMenuPolicy(Qt::NoContextMenu);
this->setEnableOfBtn(); this->setEnableOfBtn();
KWindowEffects::enableBlurBehind(this->winId(), true, QRegion(path.toFillPolygon().toPolygon()));
} }
WiFiConfigDialog::~WiFiConfigDialog() WiFiConfigDialog::~WiFiConfigDialog()
@ -68,12 +60,16 @@ void WiFiConfigDialog::paintEvent(QPaintEvent *event)
style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this); style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this);
QRect rect = this->rect(); QRect rect = this->rect();
rect.adjust(1, 1, -1, -1);
p.setRenderHint(QPainter::Antialiasing); // 反锯齿; p.setRenderHint(QPainter::Antialiasing); // 反锯齿;
p.setBrush(opt.palette.color(QPalette::Base)); p.setBrush(opt.palette.color(QPalette::Base));
p.setOpacity(trans); p.setOpacity(trans);
p.setPen(Qt::NoPen); p.setPen(Qt::NoPen);
p.drawRoundedRect(rect, 6, 6); p.drawRoundedRect(rect, 6, 6);
QWidget::paintEvent(event); QWidget::paintEvent(event);
QPainterPath path;
KWindowEffects::enableBlurBehind(this->winId(), true, QRegion(path.toFillPolygon().toPolygon()));
} }
//创建获取窗口透明度信息的GSetting的对象 //创建获取窗口透明度信息的GSetting的对象

View File

@ -72,13 +72,6 @@ WpaWifiDialog::WpaWifiDialog(QWidget *parent, MainWindow *mainWindow, QString co
connectionName = conname; connectionName = conname;
// configPath = getenv("HOME") + CONFIG_FILE; // configPath = getenv("HOME") + CONFIG_FILE;
QPainterPath path;
auto rect = this->rect();
rect.adjust(1, 1, -1, -1);
path.addRoundedRect(rect, 6, 6);
setProperty("blurRegion", QRegion(path.toFillPolygon().toPolygon()));
KWindowEffects::enableBlurBehind(this->winId(), true, QRegion(path.toFillPolygon().toPolygon()));
initUI(); initUI();
initCombox(); initCombox();
initConnect(); initConnect();
@ -681,10 +674,14 @@ void WpaWifiDialog::paintEvent(QPaintEvent *event)
style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this); style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this);
QRect rect = this->rect(); QRect rect = this->rect();
rect.adjust(1, 1, -1, -1);
p.setRenderHint(QPainter::Antialiasing); // 反锯齿; p.setRenderHint(QPainter::Antialiasing); // 反锯齿;
p.setBrush(opt.palette.color(QPalette::Base)); p.setBrush(opt.palette.color(QPalette::Base));
p.setOpacity(trans); p.setOpacity(trans);
p.setPen(Qt::NoPen); p.setPen(Qt::NoPen);
p.drawRoundedRect(rect, 6, 6); p.drawRoundedRect(rect, 6, 6);
QWidget::paintEvent(event); QWidget::paintEvent(event);
QPainterPath path;
KWindowEffects::enableBlurBehind(this->winId(), true, QRegion(path.toFillPolygon().toPolygon()));
} }

View File

@ -44,12 +44,6 @@ DlgHideWifi::DlgHideWifi(int type, MainWindow *mainWindow, QWidget *parent) :
this->setWindowIcon(QIcon::fromTheme("kylin-network", QIcon(":/res/x/setup.png")) ); this->setWindowIcon(QIcon::fromTheme("kylin-network", QIcon(":/res/x/setup.png")) );
//需要添加 void paintEvent(QPaintEvent *event) 函数 //需要添加 void paintEvent(QPaintEvent *event) 函数
QPainterPath path;
auto rect = this->rect();
rect.adjust(1, 1, -1, -1);
path.addRoundedRect(rect, 6, 6);
setProperty("blurRegion", QRegion(path.toFillPolygon().toPolygon()));
MyQss objQss; MyQss objQss;
ui->lbBoder->setStyleSheet("QLabel{border-radius:6px;background-color:rgba(19,19,20,0.95);border:1px solid rgba(255, 255, 255, 0.05);}"); ui->lbBoder->setStyleSheet("QLabel{border-radius:6px;background-color:rgba(19,19,20,0.95);border:1px solid rgba(255, 255, 255, 0.05);}");
@ -102,8 +96,6 @@ DlgHideWifi::DlgHideWifi(int type, MainWindow *mainWindow, QWidget *parent) :
this->setFixedSize(432,358); this->setFixedSize(432,358);
this->mw = mainWindow; this->mw = mainWindow;
KWindowEffects::enableBlurBehind(this->winId(), true, QRegion(path.toFillPolygon().toPolygon()));
} }
DlgHideWifi::~DlgHideWifi() DlgHideWifi::~DlgHideWifi()
@ -362,10 +354,14 @@ void DlgHideWifi::paintEvent(QPaintEvent *event)
style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this); style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this);
QRect rect = this->rect(); QRect rect = this->rect();
rect.adjust(1, 1, -1, -1);
p.setRenderHint(QPainter::Antialiasing); // 反锯齿; p.setRenderHint(QPainter::Antialiasing); // 反锯齿;
p.setBrush(opt.palette.color(QPalette::Base)); p.setBrush(opt.palette.color(QPalette::Base));
p.setOpacity(trans); p.setOpacity(trans);
p.setPen(Qt::NoPen); p.setPen(Qt::NoPen);
p.drawRoundedRect(rect, 6, 6); p.drawRoundedRect(rect, 6, 6);
QWidget::paintEvent(event); QWidget::paintEvent(event);
QPainterPath path;
KWindowEffects::enableBlurBehind(this->winId(), true, QRegion(path.toFillPolygon().toPolygon()));
} }

View File

@ -20,6 +20,7 @@
#include "dlghidewifieapfast.h" #include "dlghidewifieapfast.h"
#include "ui_dlghidewifieapfast.h" #include "ui_dlghidewifieapfast.h"
#include "kylinheadfile.h" #include "kylinheadfile.h"
#include "src/kylin-dbus-interface.h"
#include <sys/syslog.h> #include <sys/syslog.h>
@ -34,12 +35,6 @@ DlgHideWifiEapFast::DlgHideWifiEapFast(int type, QWidget *parent) :
this->setAttribute(Qt::WA_TranslucentBackground); this->setAttribute(Qt::WA_TranslucentBackground);
//需要添加 void paintEvent(QPaintEvent *event) 函数 //需要添加 void paintEvent(QPaintEvent *event) 函数
QPainterPath path;
auto rect = this->rect();
rect.adjust(1, 1, -1, -1);
path.addRoundedRect(rect, 6, 6);
setProperty("blurRegion", QRegion(path.toFillPolygon().toPolygon()));
this->setStyleSheet("QWidget{border-radius:6px;background-color:rgba(19,19,20,0.7);border:1px solid rgba(255, 255, 255, 0.05);}"); this->setStyleSheet("QWidget{border-radius:6px;background-color:rgba(19,19,20,0.7);border:1px solid rgba(255, 255, 255, 0.05);}");
MyQss objQss; MyQss objQss;
@ -154,8 +149,6 @@ DlgHideWifiEapFast::DlgHideWifiEapFast(int type, QWidget *parent) :
ui->btnConnect->setEnabled(false); ui->btnConnect->setEnabled(false);
this->setFixedSize(432,673); this->setFixedSize(432,673);
KWindowEffects::enableBlurBehind(this->winId(), true, QRegion(path.toFillPolygon().toPolygon()));
} }
DlgHideWifiEapFast::~DlgHideWifiEapFast() DlgHideWifiEapFast::~DlgHideWifiEapFast()
@ -343,9 +336,23 @@ void DlgHideWifiEapFast::on_lePassword_textEdited(const QString &arg1)
void DlgHideWifiEapFast::paintEvent(QPaintEvent *event) void DlgHideWifiEapFast::paintEvent(QPaintEvent *event)
{ {
KylinDBus mkylindbus;
double trans = mkylindbus.getTransparentData();
QStyleOption opt; QStyleOption opt;
opt.init(this); opt.init(this);
QPainter p(this); QPainter p(this);
style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this); style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this);
QWidget::paintEvent(event);
QRect rect = this->rect();
rect.adjust(1, 1, -1, -1);
p.setRenderHint(QPainter::Antialiasing); // 反锯齿;
p.setBrush(opt.palette.color(QPalette::Base));
p.setOpacity(trans);
p.setPen(Qt::NoPen);
p.drawRoundedRect(rect, 6, 6);
QWidget::paintEvent(event);
QPainterPath path;
KWindowEffects::enableBlurBehind(this->winId(), true, QRegion(path.toFillPolygon().toPolygon()));
} }

View File

@ -20,6 +20,7 @@
#include "dlghidewifieapleap.h" #include "dlghidewifieapleap.h"
#include "ui_dlghidewifieapleap.h" #include "ui_dlghidewifieapleap.h"
#include "kylinheadfile.h" #include "kylinheadfile.h"
#include "src/kylin-dbus-interface.h"
#include <sys/syslog.h> #include <sys/syslog.h>
@ -34,12 +35,6 @@ DlgHideWifiEapLeap::DlgHideWifiEapLeap(int type, QWidget *parent) :
this->setAttribute(Qt::WA_TranslucentBackground); this->setAttribute(Qt::WA_TranslucentBackground);
//需要添加 void paintEvent(QPaintEvent *event) 函数 //需要添加 void paintEvent(QPaintEvent *event) 函数
QPainterPath path;
auto rect = this->rect();
rect.adjust(1, 1, -1, -1);
path.addRoundedRect(rect, 6, 6);
setProperty("blurRegion", QRegion(path.toFillPolygon().toPolygon()));
this->setStyleSheet("QWidget{border-radius:6px;background-color:rgba(19,19,20,0.7);border:1px solid rgba(255, 255, 255, 0.05);}"); this->setStyleSheet("QWidget{border-radius:6px;background-color:rgba(19,19,20,0.7);border:1px solid rgba(255, 255, 255, 0.05);}");
MyQss objQss; MyQss objQss;
@ -124,8 +119,6 @@ DlgHideWifiEapLeap::DlgHideWifiEapLeap(int type, QWidget *parent) :
ui->btnConnect->setEnabled(false); ui->btnConnect->setEnabled(false);
this->setFixedSize(432,487); this->setFixedSize(432,487);
KWindowEffects::enableBlurBehind(this->winId(), true, QRegion(path.toFillPolygon().toPolygon()));
} }
DlgHideWifiEapLeap::~DlgHideWifiEapLeap() DlgHideWifiEapLeap::~DlgHideWifiEapLeap()
@ -283,9 +276,23 @@ void DlgHideWifiEapLeap::on_lePassword_textEdited(const QString &arg1)
void DlgHideWifiEapLeap::paintEvent(QPaintEvent *event) void DlgHideWifiEapLeap::paintEvent(QPaintEvent *event)
{ {
KylinDBus mkylindbus;
double trans = mkylindbus.getTransparentData();
QStyleOption opt; QStyleOption opt;
opt.init(this); opt.init(this);
QPainter p(this); QPainter p(this);
style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this); style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this);
QWidget::paintEvent(event);
QRect rect = this->rect();
rect.adjust(1, 1, -1, -1);
p.setRenderHint(QPainter::Antialiasing); // 反锯齿;
p.setBrush(opt.palette.color(QPalette::Base));
p.setOpacity(trans);
p.setPen(Qt::NoPen);
p.drawRoundedRect(rect, 6, 6);
QWidget::paintEvent(event);
QPainterPath path;
KWindowEffects::enableBlurBehind(this->winId(), true, QRegion(path.toFillPolygon().toPolygon()));
} }

View File

@ -41,12 +41,6 @@ DlgHideWifiEapPeap::DlgHideWifiEapPeap(int type, int beUsed, MainWindow *mainWin
this->setWindowIcon(QIcon::fromTheme("kylin-network", QIcon(":/res/x/setup.png")) ); this->setWindowIcon(QIcon::fromTheme("kylin-network", QIcon(":/res/x/setup.png")) );
//需要添加 void paintEvent(QPaintEvent *event) 函数 //需要添加 void paintEvent(QPaintEvent *event) 函数
QPainterPath path;
auto rect = this->rect();
rect.adjust(1, 1, -1, -1);
path.addRoundedRect(rect, 6, 6);
setProperty("blurRegion", QRegion(path.toFillPolygon().toPolygon()));
MyQss objQss; MyQss objQss;
ui->lbBoder->setStyleSheet("QLabel{border-radius:6px;background-color:rgba(19,19,20,0.95);border:1px solid rgba(255, 255, 255, 0.05);}"); ui->lbBoder->setStyleSheet("QLabel{border-radius:6px;background-color:rgba(19,19,20,0.95);border:1px solid rgba(255, 255, 255, 0.05);}");
@ -157,8 +151,6 @@ DlgHideWifiEapPeap::DlgHideWifiEapPeap(int type, int beUsed, MainWindow *mainWin
this->setFixedSize(432,700); this->setFixedSize(432,700);
this->mw = mainWindow; this->mw = mainWindow;
KWindowEffects::enableBlurBehind(this->winId(), true, QRegion(path.toFillPolygon().toPolygon()));
} }
DlgHideWifiEapPeap::~DlgHideWifiEapPeap() DlgHideWifiEapPeap::~DlgHideWifiEapPeap()
@ -536,10 +528,14 @@ void DlgHideWifiEapPeap::paintEvent(QPaintEvent *event)
style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this); style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this);
QRect rect = this->rect(); QRect rect = this->rect();
rect.adjust(1, 1, -1, -1);
p.setRenderHint(QPainter::Antialiasing); // 反锯齿; p.setRenderHint(QPainter::Antialiasing); // 反锯齿;
p.setBrush(opt.palette.color(QPalette::Base)); p.setBrush(opt.palette.color(QPalette::Base));
p.setOpacity(trans); p.setOpacity(trans);
p.setPen(Qt::NoPen); p.setPen(Qt::NoPen);
p.drawRoundedRect(rect, 6, 6); p.drawRoundedRect(rect, 6, 6);
QWidget::paintEvent(event); QWidget::paintEvent(event);
QPainterPath path;
KWindowEffects::enableBlurBehind(this->winId(), true, QRegion(path.toFillPolygon().toPolygon()));
} }

View File

@ -20,6 +20,7 @@
#include "dlghidewifieappwd.h" #include "dlghidewifieappwd.h"
#include "ui_dlghidewifieappwd.h" #include "ui_dlghidewifieappwd.h"
#include "kylinheadfile.h" #include "kylinheadfile.h"
#include "src/kylin-dbus-interface.h"
#include <sys/syslog.h> #include <sys/syslog.h>
@ -34,12 +35,6 @@ DlgHideWifiEapPwd::DlgHideWifiEapPwd(int type, QWidget *parent) :
this->setAttribute(Qt::WA_TranslucentBackground); this->setAttribute(Qt::WA_TranslucentBackground);
//需要添加 void paintEvent(QPaintEvent *event) 函数 //需要添加 void paintEvent(QPaintEvent *event) 函数
QPainterPath path;
auto rect = this->rect();
rect.adjust(1, 1, -1, -1);
path.addRoundedRect(rect, 6, 6);
setProperty("blurRegion", QRegion(path.toFillPolygon().toPolygon()));
this->setStyleSheet("QWidget{border-radius:6px;background-color:rgba(19,19,20,0.7);border:1px solid rgba(255, 255, 255, 0.05);}"); this->setStyleSheet("QWidget{border-radius:6px;background-color:rgba(19,19,20,0.7);border:1px solid rgba(255, 255, 255, 0.05);}");
MyQss objQss; MyQss objQss;
@ -125,8 +120,6 @@ DlgHideWifiEapPwd::DlgHideWifiEapPwd(int type, QWidget *parent) :
ui->btnConnect->setEnabled(false); ui->btnConnect->setEnabled(false);
this->setFixedSize(432,487); this->setFixedSize(432,487);
KWindowEffects::enableBlurBehind(this->winId(), true, QRegion(path.toFillPolygon().toPolygon()));
} }
DlgHideWifiEapPwd::~DlgHideWifiEapPwd() DlgHideWifiEapPwd::~DlgHideWifiEapPwd()
@ -284,9 +277,23 @@ void DlgHideWifiEapPwd::on_lePassword_textEdited(const QString &arg1)
void DlgHideWifiEapPwd::paintEvent(QPaintEvent *event) void DlgHideWifiEapPwd::paintEvent(QPaintEvent *event)
{ {
KylinDBus mkylindbus;
double trans = mkylindbus.getTransparentData();
QStyleOption opt; QStyleOption opt;
opt.init(this); opt.init(this);
QPainter p(this); QPainter p(this);
style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this); style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this);
QWidget::paintEvent(event);
QRect rect = this->rect();
rect.adjust(1, 1, -1, -1);
p.setRenderHint(QPainter::Antialiasing); // 反锯齿;
p.setBrush(opt.palette.color(QPalette::Base));
p.setOpacity(trans);
p.setPen(Qt::NoPen);
p.drawRoundedRect(rect, 6, 6);
QWidget::paintEvent(event);
QPainterPath path;
KWindowEffects::enableBlurBehind(this->winId(), true, QRegion(path.toFillPolygon().toPolygon()));
} }

View File

@ -40,12 +40,6 @@ DlgHideWifiEapTls::DlgHideWifiEapTls(int type, int beUsed, MainWindow *mainWindo
this->setWindowIcon(QIcon::fromTheme("kylin-network", QIcon(":/res/x/setup.png")) ); this->setWindowIcon(QIcon::fromTheme("kylin-network", QIcon(":/res/x/setup.png")) );
//需要添加 void paintEvent(QPaintEvent *event) 函数 //需要添加 void paintEvent(QPaintEvent *event) 函数
QPainterPath path;
auto rect = this->rect();
rect.adjust(1, 1, -1, -1);
path.addRoundedRect(rect, 6, 6);
setProperty("blurRegion", QRegion(path.toFillPolygon().toPolygon()));
MyQss objQss; MyQss objQss;
ui->lbBoder->setStyleSheet("QLabel{border-radius:6px;background-color:rgba(19,19,20,0.95);border:1px solid rgba(255, 255, 255, 0.05);}"); ui->lbBoder->setStyleSheet("QLabel{border-radius:6px;background-color:rgba(19,19,20,0.95);border:1px solid rgba(255, 255, 255, 0.05);}");
@ -145,8 +139,6 @@ DlgHideWifiEapTls::DlgHideWifiEapTls(int type, int beUsed, MainWindow *mainWindo
this->setFixedSize(432,705); this->setFixedSize(432,705);
this->mw = mainWindow; this->mw = mainWindow;
KWindowEffects::enableBlurBehind(this->winId(), true, QRegion(path.toFillPolygon().toPolygon()));
} }
DlgHideWifiEapTls::~DlgHideWifiEapTls() DlgHideWifiEapTls::~DlgHideWifiEapTls()
@ -645,10 +637,14 @@ void DlgHideWifiEapTls::paintEvent(QPaintEvent *event)
style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this); style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this);
QRect rect = this->rect(); QRect rect = this->rect();
rect.adjust(1, 1, -1, -1);
p.setRenderHint(QPainter::Antialiasing); // 反锯齿; p.setRenderHint(QPainter::Antialiasing); // 反锯齿;
p.setBrush(opt.palette.color(QPalette::Base)); p.setBrush(opt.palette.color(QPalette::Base));
p.setOpacity(trans); p.setOpacity(trans);
p.setPen(Qt::NoPen); p.setPen(Qt::NoPen);
p.drawRoundedRect(rect, 6, 6); p.drawRoundedRect(rect, 6, 6);
QWidget::paintEvent(event); QWidget::paintEvent(event);
QPainterPath path;
KWindowEffects::enableBlurBehind(this->winId(), true, QRegion(path.toFillPolygon().toPolygon()));
} }

View File

@ -20,6 +20,7 @@
#include "dlghidewifieapttls.h" #include "dlghidewifieapttls.h"
#include "ui_dlghidewifieapttls.h" #include "ui_dlghidewifieapttls.h"
#include "kylinheadfile.h" #include "kylinheadfile.h"
#include "src/kylin-dbus-interface.h"
#include <sys/syslog.h> #include <sys/syslog.h>
@ -34,12 +35,6 @@ DlgHideWifiEapTTLS::DlgHideWifiEapTTLS(int type, QWidget *parent) :
this->setAttribute(Qt::WA_TranslucentBackground); this->setAttribute(Qt::WA_TranslucentBackground);
//需要添加 void paintEvent(QPaintEvent *event) 函数 //需要添加 void paintEvent(QPaintEvent *event) 函数
QPainterPath path;
auto rect = this->rect();
rect.adjust(1, 1, -1, -1);
path.addRoundedRect(rect, 6, 6);
setProperty("blurRegion", QRegion(path.toFillPolygon().toPolygon()));
this->setStyleSheet("QWidget{border-radius:6px;background-color:rgba(19,19,20,0.7);border:1px solid rgba(255, 255, 255, 0.05);}"); this->setStyleSheet("QWidget{border-radius:6px;background-color:rgba(19,19,20,0.7);border:1px solid rgba(255, 255, 255, 0.05);}");
MyQss objQss; MyQss objQss;
@ -159,8 +154,6 @@ DlgHideWifiEapTTLS::DlgHideWifiEapTTLS(int type, QWidget *parent) :
ui->btnConnect->setEnabled(false); ui->btnConnect->setEnabled(false);
this->setFixedSize(432,665); this->setFixedSize(432,665);
KWindowEffects::enableBlurBehind(this->winId(), true, QRegion(path.toFillPolygon().toPolygon()));
} }
DlgHideWifiEapTTLS::~DlgHideWifiEapTTLS() DlgHideWifiEapTTLS::~DlgHideWifiEapTTLS()
@ -450,9 +443,23 @@ void DlgHideWifiEapTTLS::on_lePwd_textEdited(const QString &arg1)
void DlgHideWifiEapTTLS::paintEvent(QPaintEvent *event) void DlgHideWifiEapTTLS::paintEvent(QPaintEvent *event)
{ {
KylinDBus mkylindbus;
double trans = mkylindbus.getTransparentData();
QStyleOption opt; QStyleOption opt;
opt.init(this); opt.init(this);
QPainter p(this); QPainter p(this);
style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this); style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this);
QWidget::paintEvent(event);
QRect rect = this->rect();
rect.adjust(1, 1, -1, -1);
p.setRenderHint(QPainter::Antialiasing); // 反锯齿;
p.setBrush(opt.palette.color(QPalette::Base));
p.setOpacity(trans);
p.setPen(Qt::NoPen);
p.drawRoundedRect(rect, 6, 6);
QWidget::paintEvent(event);
QPainterPath path;
KWindowEffects::enableBlurBehind(this->winId(), true, QRegion(path.toFillPolygon().toPolygon()));
} }

View File

@ -19,6 +19,7 @@
#include "ui_dlghidewifileap.h" #include "ui_dlghidewifileap.h"
#include "kylinheadfile.h" #include "kylinheadfile.h"
#include "src/kylin-dbus-interface.h"
#include <sys/syslog.h> #include <sys/syslog.h>
@ -32,12 +33,6 @@ DlgHideWifiLeap::DlgHideWifiLeap(QWidget *parent) :
this->setAttribute(Qt::WA_TranslucentBackground); this->setAttribute(Qt::WA_TranslucentBackground);
//需要添加 void paintEvent(QPaintEvent *event) 函数 //需要添加 void paintEvent(QPaintEvent *event) 函数
QPainterPath path;
auto rect = this->rect();
rect.adjust(1, 1, -1, -1);
path.addRoundedRect(rect, 6, 6);
setProperty("blurRegion", QRegion(path.toFillPolygon().toPolygon()));
this->setStyleSheet("QWidget{border-radius:6px;background-color:rgba(19,19,20,0.7);border:1px solid rgba(255, 255, 255, 0.05);}"); this->setStyleSheet("QWidget{border-radius:6px;background-color:rgba(19,19,20,0.7);border:1px solid rgba(255, 255, 255, 0.05);}");
MyQss objQss; MyQss objQss;
@ -105,8 +100,6 @@ DlgHideWifiLeap::DlgHideWifiLeap(QWidget *parent) :
ui->btnConnect->setEnabled(false); ui->btnConnect->setEnabled(false);
this->setFixedSize(432,434); this->setFixedSize(432,434);
KWindowEffects::enableBlurBehind(this->winId(), true, QRegion(path.toFillPolygon().toPolygon()));
} }
DlgHideWifiLeap::~DlgHideWifiLeap() DlgHideWifiLeap::~DlgHideWifiLeap()
@ -230,9 +223,23 @@ void DlgHideWifiLeap::on_lePassword_textEdited(const QString &arg1)
void DlgHideWifiLeap::paintEvent(QPaintEvent *event) void DlgHideWifiLeap::paintEvent(QPaintEvent *event)
{ {
KylinDBus mkylindbus;
double trans = mkylindbus.getTransparentData();
QStyleOption opt; QStyleOption opt;
opt.init(this); opt.init(this);
QPainter p(this); QPainter p(this);
style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this); style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this);
QWidget::paintEvent(event);
QRect rect = this->rect();
rect.adjust(1, 1, -1, -1);
p.setRenderHint(QPainter::Antialiasing); // 反锯齿;
p.setBrush(opt.palette.color(QPalette::Base));
p.setOpacity(trans);
p.setPen(Qt::NoPen);
p.drawRoundedRect(rect, 6, 6);
QWidget::paintEvent(event);
QPainterPath path;
KWindowEffects::enableBlurBehind(this->winId(), true, QRegion(path.toFillPolygon().toPolygon()));
} }

View File

@ -19,6 +19,7 @@
#include "ui_dlghidewifiwep.h" #include "ui_dlghidewifiwep.h"
#include "kylinheadfile.h" #include "kylinheadfile.h"
#include "src/kylin-dbus-interface.h"
#include <sys/syslog.h> #include <sys/syslog.h>
@ -33,12 +34,6 @@ DlgHideWifiWep::DlgHideWifiWep(int type, QWidget *parent) :
this->setAttribute(Qt::WA_TranslucentBackground); this->setAttribute(Qt::WA_TranslucentBackground);
//需要添加 void paintEvent(QPaintEvent *event) 函数 //需要添加 void paintEvent(QPaintEvent *event) 函数
QPainterPath path;
auto rect = this->rect();
rect.adjust(1, 1, -1, -1);
path.addRoundedRect(rect, 6, 6);
setProperty("blurRegion", QRegion(path.toFillPolygon().toPolygon()));
this->setStyleSheet("QWidget{border-radius:6px;background-color:rgba(19,19,20,0.7);border:1px solid rgba(255, 255, 255, 0.05);}"); this->setStyleSheet("QWidget{border-radius:6px;background-color:rgba(19,19,20,0.7);border:1px solid rgba(255, 255, 255, 0.05);}");
MyQss objQss; MyQss objQss;
@ -125,8 +120,6 @@ DlgHideWifiWep::DlgHideWifiWep(int type, QWidget *parent) :
ui->btnConnect->setEnabled(false); ui->btnConnect->setEnabled(false);
this->setFixedSize(432,493); this->setFixedSize(432,493);
KWindowEffects::enableBlurBehind(this->winId(), true, QRegion(path.toFillPolygon().toPolygon()));
} }
DlgHideWifiWep::~DlgHideWifiWep() DlgHideWifiWep::~DlgHideWifiWep()
@ -232,9 +225,23 @@ void DlgHideWifiWep::on_leNetName_textEdited(const QString &arg1)
void DlgHideWifiWep::paintEvent(QPaintEvent *event) void DlgHideWifiWep::paintEvent(QPaintEvent *event)
{ {
KylinDBus mkylindbus;
double trans = mkylindbus.getTransparentData();
QStyleOption opt; QStyleOption opt;
opt.init(this); opt.init(this);
QPainter p(this); QPainter p(this);
style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this); style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this);
QWidget::paintEvent(event);
QRect rect = this->rect();
rect.adjust(1, 1, -1, -1);
p.setRenderHint(QPainter::Antialiasing); // 反锯齿;
p.setBrush(opt.palette.color(QPalette::Base));
p.setOpacity(trans);
p.setPen(Qt::NoPen);
p.drawRoundedRect(rect, 6, 6);
QWidget::paintEvent(event);
QPainterPath path;
KWindowEffects::enableBlurBehind(this->winId(), true, QRegion(path.toFillPolygon().toPolygon()));
} }

View File

@ -43,12 +43,6 @@ DlgHideWifiWpa::DlgHideWifiWpa(int type, MainWindow *mainWindow, QWidget *parent
this->setWindowIcon(QIcon::fromTheme("kylin-network", QIcon(":/res/x/setup.png")) ); this->setWindowIcon(QIcon::fromTheme("kylin-network", QIcon(":/res/x/setup.png")) );
//需要添加 void paintEvent(QPaintEvent *event) 函数 //需要添加 void paintEvent(QPaintEvent *event) 函数
QPainterPath path;
auto rect = this->rect();
rect.adjust(1, 1, -1, -1);
path.addRoundedRect(rect, 6, 6);
setProperty("blurRegion", QRegion(path.toFillPolygon().toPolygon()));
MyQss objQss; MyQss objQss;
ui->lbBoder->setStyleSheet("QLabel{border-radius:6px;background-color:rgba(19,19,20,0.95);border:1px solid rgba(255, 255, 255, 0.05);}"); ui->lbBoder->setStyleSheet("QLabel{border-radius:6px;background-color:rgba(19,19,20,0.95);border:1px solid rgba(255, 255, 255, 0.05);}");
@ -112,8 +106,6 @@ DlgHideWifiWpa::DlgHideWifiWpa(int type, MainWindow *mainWindow, QWidget *parent
this->setFixedSize(432,397); this->setFixedSize(432,397);
this->mw = mainWindow; this->mw = mainWindow;
KWindowEffects::enableBlurBehind(this->winId(), true, QRegion(path.toFillPolygon().toPolygon()));
} }
DlgHideWifiWpa::~DlgHideWifiWpa() DlgHideWifiWpa::~DlgHideWifiWpa()
@ -434,10 +426,14 @@ void DlgHideWifiWpa::paintEvent(QPaintEvent *event)
style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this); style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this);
QRect rect = this->rect(); QRect rect = this->rect();
rect.adjust(1, 1, -1, -1);
p.setRenderHint(QPainter::Antialiasing); // 反锯齿; p.setRenderHint(QPainter::Antialiasing); // 反锯齿;
p.setBrush(opt.palette.color(QPalette::Base)); p.setBrush(opt.palette.color(QPalette::Base));
p.setOpacity(trans); p.setOpacity(trans);
p.setPen(Qt::NoPen); p.setPen(Qt::NoPen);
p.drawRoundedRect(rect, 6, 6); p.drawRoundedRect(rect, 6, 6);
QWidget::paintEvent(event); QWidget::paintEvent(event);
QPainterPath path;
KWindowEffects::enableBlurBehind(this->winId(), true, QRegion(path.toFillPolygon().toPolygon()));
} }