diff --git a/src/confform.cpp b/src/confform.cpp index e50610b4..96deb0dc 100644 --- a/src/confform.cpp +++ b/src/confform.cpp @@ -42,12 +42,6 @@ ConfForm::ConfForm(QWidget *parent) : //需要添加 void paintEvent(QPaintEvent *event) 函数 //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;}"; 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);}" @@ -134,7 +128,6 @@ ConfForm::ConfForm(QWidget *parent) : ui->leAddr_ipv6->setValidator(new QRegExpValidator(ipv6_rx, this)); setModal(false); - KWindowEffects::enableBlurBehind(this->winId(), true, QRegion(path.toFillPolygon().toPolygon())); setEnableOfBtn(); } @@ -746,10 +739,14 @@ void ConfForm::paintEvent(QPaintEvent *event) style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this); 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())); } diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 8c4928c3..a822ea6f 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -64,12 +64,6 @@ MainWindow::MainWindow(QWidget *parent) : 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 createTopLanUI(); //创建顶部有线网item createTopWifiUI(); //创建顶部无线网item @@ -127,8 +121,6 @@ MainWindow::MainWindow(QWidget *parent) : ui->btnWifiList->setAttribute(Qt::WA_Hover,true); ui->btnWifiList->installEventFilter(this); - KWindowEffects::enableBlurBehind(this->winId(), true, QRegion(path.toFillPolygon().toPolygon())); - hasWifiConnected = false; numberForWifiScan = 0; } @@ -3639,12 +3631,16 @@ void MainWindow::paintEvent(QPaintEvent *event) opt.init(this); QPainter p(this); 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())); } bool MainWindow::event(QEvent *event) diff --git a/src/wificonfigdialog.cpp b/src/wificonfigdialog.cpp index 75a68827..4e35d9ed 100644 --- a/src/wificonfigdialog.cpp +++ b/src/wificonfigdialog.cpp @@ -23,12 +23,6 @@ WiFiConfigDialog::WiFiConfigDialog(QWidget *parent) : this->setAttribute(Qt::WA_TranslucentBackground); 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->lbWifiId->setText(tr("Wi-Fi ID:")); //Wi-Fi连接名称: ui->lbWifiName->setText(tr("Wi-Fi Name:")); //Wi-Fi名称: @@ -49,8 +43,6 @@ WiFiConfigDialog::WiFiConfigDialog(QWidget *parent) : ui->leWifiPassword->setContextMenuPolicy(Qt::NoContextMenu); this->setEnableOfBtn(); - - KWindowEffects::enableBlurBehind(this->winId(), true, QRegion(path.toFillPolygon().toPolygon())); } WiFiConfigDialog::~WiFiConfigDialog() @@ -68,12 +60,16 @@ void WiFiConfigDialog::paintEvent(QPaintEvent *event) style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this); 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())); } //创建获取窗口透明度信息的GSetting的对象 diff --git a/src/wpawifidialog.cpp b/src/wpawifidialog.cpp index f8eaf9bb..6dd39f71 100644 --- a/src/wpawifidialog.cpp +++ b/src/wpawifidialog.cpp @@ -72,13 +72,6 @@ WpaWifiDialog::WpaWifiDialog(QWidget *parent, MainWindow *mainWindow, QString co connectionName = conname; // 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(); initCombox(); initConnect(); @@ -681,10 +674,14 @@ void WpaWifiDialog::paintEvent(QPaintEvent *event) style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this); 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())); } diff --git a/wireless-security/dlghidewifi.cpp b/wireless-security/dlghidewifi.cpp index f8c9f9e7..3b049473 100644 --- a/wireless-security/dlghidewifi.cpp +++ b/wireless-security/dlghidewifi.cpp @@ -44,12 +44,6 @@ DlgHideWifi::DlgHideWifi(int type, MainWindow *mainWindow, QWidget *parent) : this->setWindowIcon(QIcon::fromTheme("kylin-network", QIcon(":/res/x/setup.png")) ); //需要添加 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; 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->mw = mainWindow; - - KWindowEffects::enableBlurBehind(this->winId(), true, QRegion(path.toFillPolygon().toPolygon())); } DlgHideWifi::~DlgHideWifi() @@ -362,10 +354,14 @@ void DlgHideWifi::paintEvent(QPaintEvent *event) style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this); 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())); } diff --git a/wireless-security/dlghidewifieapfast.cpp b/wireless-security/dlghidewifieapfast.cpp index c141375b..1e1a87ad 100644 --- a/wireless-security/dlghidewifieapfast.cpp +++ b/wireless-security/dlghidewifieapfast.cpp @@ -20,6 +20,7 @@ #include "dlghidewifieapfast.h" #include "ui_dlghidewifieapfast.h" #include "kylinheadfile.h" +#include "src/kylin-dbus-interface.h" #include @@ -34,12 +35,6 @@ DlgHideWifiEapFast::DlgHideWifiEapFast(int type, QWidget *parent) : this->setAttribute(Qt::WA_TranslucentBackground); //需要添加 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);}"); MyQss objQss; @@ -154,8 +149,6 @@ DlgHideWifiEapFast::DlgHideWifiEapFast(int type, QWidget *parent) : ui->btnConnect->setEnabled(false); this->setFixedSize(432,673); - - KWindowEffects::enableBlurBehind(this->winId(), true, QRegion(path.toFillPolygon().toPolygon())); } DlgHideWifiEapFast::~DlgHideWifiEapFast() @@ -343,9 +336,23 @@ void DlgHideWifiEapFast::on_lePassword_textEdited(const QString &arg1) void DlgHideWifiEapFast::paintEvent(QPaintEvent *event) { + KylinDBus mkylindbus; + double trans = mkylindbus.getTransparentData(); + QStyleOption opt; - opt.init(this); - QPainter p(this); - style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this); - QWidget::paintEvent(event); + opt.init(this); + QPainter p(this); + style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this); + + 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())); } diff --git a/wireless-security/dlghidewifieapleap.cpp b/wireless-security/dlghidewifieapleap.cpp index b369a4ff..335f3585 100644 --- a/wireless-security/dlghidewifieapleap.cpp +++ b/wireless-security/dlghidewifieapleap.cpp @@ -20,6 +20,7 @@ #include "dlghidewifieapleap.h" #include "ui_dlghidewifieapleap.h" #include "kylinheadfile.h" +#include "src/kylin-dbus-interface.h" #include @@ -34,12 +35,6 @@ DlgHideWifiEapLeap::DlgHideWifiEapLeap(int type, QWidget *parent) : this->setAttribute(Qt::WA_TranslucentBackground); //需要添加 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);}"); MyQss objQss; @@ -124,8 +119,6 @@ DlgHideWifiEapLeap::DlgHideWifiEapLeap(int type, QWidget *parent) : ui->btnConnect->setEnabled(false); this->setFixedSize(432,487); - - KWindowEffects::enableBlurBehind(this->winId(), true, QRegion(path.toFillPolygon().toPolygon())); } DlgHideWifiEapLeap::~DlgHideWifiEapLeap() @@ -283,9 +276,23 @@ void DlgHideWifiEapLeap::on_lePassword_textEdited(const QString &arg1) void DlgHideWifiEapLeap::paintEvent(QPaintEvent *event) { + KylinDBus mkylindbus; + double trans = mkylindbus.getTransparentData(); + QStyleOption opt; - opt.init(this); - QPainter p(this); - style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this); - QWidget::paintEvent(event); + opt.init(this); + QPainter p(this); + style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this); + + 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())); } diff --git a/wireless-security/dlghidewifieappeap.cpp b/wireless-security/dlghidewifieappeap.cpp index cb71d791..77173491 100644 --- a/wireless-security/dlghidewifieappeap.cpp +++ b/wireless-security/dlghidewifieappeap.cpp @@ -41,12 +41,6 @@ DlgHideWifiEapPeap::DlgHideWifiEapPeap(int type, int beUsed, MainWindow *mainWin this->setWindowIcon(QIcon::fromTheme("kylin-network", QIcon(":/res/x/setup.png")) ); //需要添加 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; 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->mw = mainWindow; - - KWindowEffects::enableBlurBehind(this->winId(), true, QRegion(path.toFillPolygon().toPolygon())); } DlgHideWifiEapPeap::~DlgHideWifiEapPeap() @@ -536,10 +528,14 @@ void DlgHideWifiEapPeap::paintEvent(QPaintEvent *event) style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this); 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())); } diff --git a/wireless-security/dlghidewifieappwd.cpp b/wireless-security/dlghidewifieappwd.cpp index f0ac25ff..e88df1a1 100644 --- a/wireless-security/dlghidewifieappwd.cpp +++ b/wireless-security/dlghidewifieappwd.cpp @@ -20,6 +20,7 @@ #include "dlghidewifieappwd.h" #include "ui_dlghidewifieappwd.h" #include "kylinheadfile.h" +#include "src/kylin-dbus-interface.h" #include @@ -34,12 +35,6 @@ DlgHideWifiEapPwd::DlgHideWifiEapPwd(int type, QWidget *parent) : this->setAttribute(Qt::WA_TranslucentBackground); //需要添加 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);}"); MyQss objQss; @@ -125,8 +120,6 @@ DlgHideWifiEapPwd::DlgHideWifiEapPwd(int type, QWidget *parent) : ui->btnConnect->setEnabled(false); this->setFixedSize(432,487); - - KWindowEffects::enableBlurBehind(this->winId(), true, QRegion(path.toFillPolygon().toPolygon())); } DlgHideWifiEapPwd::~DlgHideWifiEapPwd() @@ -284,9 +277,23 @@ void DlgHideWifiEapPwd::on_lePassword_textEdited(const QString &arg1) void DlgHideWifiEapPwd::paintEvent(QPaintEvent *event) { + KylinDBus mkylindbus; + double trans = mkylindbus.getTransparentData(); + QStyleOption opt; - opt.init(this); - QPainter p(this); - style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this); - QWidget::paintEvent(event); + opt.init(this); + QPainter p(this); + style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this); + + 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())); } diff --git a/wireless-security/dlghidewifieaptls.cpp b/wireless-security/dlghidewifieaptls.cpp index 931c84de..69124d00 100644 --- a/wireless-security/dlghidewifieaptls.cpp +++ b/wireless-security/dlghidewifieaptls.cpp @@ -40,12 +40,6 @@ DlgHideWifiEapTls::DlgHideWifiEapTls(int type, int beUsed, MainWindow *mainWindo this->setWindowIcon(QIcon::fromTheme("kylin-network", QIcon(":/res/x/setup.png")) ); //需要添加 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; 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->mw = mainWindow; - - KWindowEffects::enableBlurBehind(this->winId(), true, QRegion(path.toFillPolygon().toPolygon())); } DlgHideWifiEapTls::~DlgHideWifiEapTls() @@ -645,10 +637,14 @@ void DlgHideWifiEapTls::paintEvent(QPaintEvent *event) style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this); 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())); } diff --git a/wireless-security/dlghidewifieapttls.cpp b/wireless-security/dlghidewifieapttls.cpp index 969bda81..c2415521 100644 --- a/wireless-security/dlghidewifieapttls.cpp +++ b/wireless-security/dlghidewifieapttls.cpp @@ -20,6 +20,7 @@ #include "dlghidewifieapttls.h" #include "ui_dlghidewifieapttls.h" #include "kylinheadfile.h" +#include "src/kylin-dbus-interface.h" #include @@ -34,12 +35,6 @@ DlgHideWifiEapTTLS::DlgHideWifiEapTTLS(int type, QWidget *parent) : this->setAttribute(Qt::WA_TranslucentBackground); //需要添加 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);}"); MyQss objQss; @@ -159,8 +154,6 @@ DlgHideWifiEapTTLS::DlgHideWifiEapTTLS(int type, QWidget *parent) : ui->btnConnect->setEnabled(false); this->setFixedSize(432,665); - - KWindowEffects::enableBlurBehind(this->winId(), true, QRegion(path.toFillPolygon().toPolygon())); } DlgHideWifiEapTTLS::~DlgHideWifiEapTTLS() @@ -450,9 +443,23 @@ void DlgHideWifiEapTTLS::on_lePwd_textEdited(const QString &arg1) void DlgHideWifiEapTTLS::paintEvent(QPaintEvent *event) { + KylinDBus mkylindbus; + double trans = mkylindbus.getTransparentData(); + QStyleOption opt; - opt.init(this); - QPainter p(this); - style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this); - QWidget::paintEvent(event); + opt.init(this); + QPainter p(this); + style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this); + + 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())); } diff --git a/wireless-security/dlghidewifileap.cpp b/wireless-security/dlghidewifileap.cpp index c46660f4..314345b6 100644 --- a/wireless-security/dlghidewifileap.cpp +++ b/wireless-security/dlghidewifileap.cpp @@ -19,6 +19,7 @@ #include "ui_dlghidewifileap.h" #include "kylinheadfile.h" +#include "src/kylin-dbus-interface.h" #include @@ -32,12 +33,6 @@ DlgHideWifiLeap::DlgHideWifiLeap(QWidget *parent) : this->setAttribute(Qt::WA_TranslucentBackground); //需要添加 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);}"); MyQss objQss; @@ -105,8 +100,6 @@ DlgHideWifiLeap::DlgHideWifiLeap(QWidget *parent) : ui->btnConnect->setEnabled(false); this->setFixedSize(432,434); - - KWindowEffects::enableBlurBehind(this->winId(), true, QRegion(path.toFillPolygon().toPolygon())); } DlgHideWifiLeap::~DlgHideWifiLeap() @@ -230,9 +223,23 @@ void DlgHideWifiLeap::on_lePassword_textEdited(const QString &arg1) void DlgHideWifiLeap::paintEvent(QPaintEvent *event) { + KylinDBus mkylindbus; + double trans = mkylindbus.getTransparentData(); + QStyleOption opt; - opt.init(this); - QPainter p(this); - style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this); - QWidget::paintEvent(event); + opt.init(this); + QPainter p(this); + style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this); + + 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())); } diff --git a/wireless-security/dlghidewifiwep.cpp b/wireless-security/dlghidewifiwep.cpp index 3a7958bc..56c3758a 100644 --- a/wireless-security/dlghidewifiwep.cpp +++ b/wireless-security/dlghidewifiwep.cpp @@ -19,6 +19,7 @@ #include "ui_dlghidewifiwep.h" #include "kylinheadfile.h" +#include "src/kylin-dbus-interface.h" #include @@ -33,12 +34,6 @@ DlgHideWifiWep::DlgHideWifiWep(int type, QWidget *parent) : this->setAttribute(Qt::WA_TranslucentBackground); //需要添加 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);}"); MyQss objQss; @@ -125,8 +120,6 @@ DlgHideWifiWep::DlgHideWifiWep(int type, QWidget *parent) : ui->btnConnect->setEnabled(false); this->setFixedSize(432,493); - - KWindowEffects::enableBlurBehind(this->winId(), true, QRegion(path.toFillPolygon().toPolygon())); } DlgHideWifiWep::~DlgHideWifiWep() @@ -232,9 +225,23 @@ void DlgHideWifiWep::on_leNetName_textEdited(const QString &arg1) void DlgHideWifiWep::paintEvent(QPaintEvent *event) { + KylinDBus mkylindbus; + double trans = mkylindbus.getTransparentData(); + QStyleOption opt; - opt.init(this); - QPainter p(this); - style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this); - QWidget::paintEvent(event); + opt.init(this); + QPainter p(this); + style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this); + + 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())); } diff --git a/wireless-security/dlghidewifiwpa.cpp b/wireless-security/dlghidewifiwpa.cpp index db97e376..bd9e8a92 100644 --- a/wireless-security/dlghidewifiwpa.cpp +++ b/wireless-security/dlghidewifiwpa.cpp @@ -43,12 +43,6 @@ DlgHideWifiWpa::DlgHideWifiWpa(int type, MainWindow *mainWindow, QWidget *parent this->setWindowIcon(QIcon::fromTheme("kylin-network", QIcon(":/res/x/setup.png")) ); //需要添加 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; 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->mw = mainWindow; - - KWindowEffects::enableBlurBehind(this->winId(), true, QRegion(path.toFillPolygon().toPolygon())); } DlgHideWifiWpa::~DlgHideWifiWpa() @@ -434,10 +426,14 @@ void DlgHideWifiWpa::paintEvent(QPaintEvent *event) style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this); 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())); }