From 2fe54d8b6c894579d5bdcac587d3dfffe727e9ec Mon Sep 17 00:00:00 2001 From: chenlelin Date: Mon, 3 May 2021 15:17:00 +0800 Subject: [PATCH] Update UI style --- src/confform.cpp | 14 +++++++------- src/mainwindow.cpp | 14 +++++++------- src/wificonfigdialog.cpp | 13 +++++++------ wireless-security/dlghidewifi.cpp | 13 +++++++------ wireless-security/dlghidewifieapfast.cpp | 13 +++++++------ wireless-security/dlghidewifieapleap.cpp | 13 +++++++------ wireless-security/dlghidewifieappeap.cpp | 13 +++++++------ wireless-security/dlghidewifieappwd.cpp | 13 +++++++------ wireless-security/dlghidewifieaptls.cpp | 13 +++++++------ wireless-security/dlghidewifieapttls.cpp | 13 +++++++------ wireless-security/dlghidewifileap.cpp | 13 +++++++------ wireless-security/dlghidewifiwep.cpp | 13 +++++++------ wireless-security/dlghidewifiwpa.cpp | 13 +++++++------ 13 files changed, 91 insertions(+), 80 deletions(-) diff --git a/src/confform.cpp b/src/confform.cpp index 9b00eb34..b185e22f 100644 --- a/src/confform.cpp +++ b/src/confform.cpp @@ -42,6 +42,13 @@ 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())); + KWindowEffects::enableBlurBehind(this->winId(), true, 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);}" @@ -127,7 +134,6 @@ ConfForm::ConfForm(QWidget *parent) : ui->leDns2->setValidator(new QRegExpValidator(rx, this)); ui->leAddr_ipv6->setValidator(new QRegExpValidator(ipv6_rx, this)); setModal(false); - setEnableOfBtn(); } @@ -843,16 +849,10 @@ 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; - path.addRoundedRect(rect, 6, 6); - setProperty("blurRegion", QRegion(path.toFillPolygon().toPolygon())); - KWindowEffects::enableBlurBehind(this->winId(), true, QRegion(path.toFillPolygon().toPolygon())); } diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 5c61fffd..acf82e76 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -64,6 +64,13 @@ 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())); + KWindowEffects::enableBlurBehind(this->winId(), true, QRegion(path.toFillPolygon().toPolygon())); + editQssString(); //编辑部分控件QSS createTopLanUI(); //创建顶部有线网item createTopWifiUI(); //创建顶部无线网item @@ -120,7 +127,6 @@ MainWindow::MainWindow(QWidget *parent) : ui->btnNetList->installEventFilter(this); ui->btnWifiList->setAttribute(Qt::WA_Hover,true); ui->btnWifiList->installEventFilter(this); - hasWifiConnected = false; numberForWifiScan = 0; @@ -3711,18 +3717,12 @@ 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; - path.addRoundedRect(rect, 6, 6); - setProperty("blurRegion", QRegion(path.toFillPolygon().toPolygon())); - 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 953a57a0..c127ac87 100644 --- a/src/wificonfigdialog.cpp +++ b/src/wificonfigdialog.cpp @@ -23,6 +23,13 @@ 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())); + KWindowEffects::enableBlurBehind(this->winId(), true, 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名称: @@ -61,18 +68,12 @@ 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; - path.addRoundedRect(rect, 6, 6); - setProperty("blurRegion", QRegion(path.toFillPolygon().toPolygon())); - KWindowEffects::enableBlurBehind(this->winId(), true, QRegion(path.toFillPolygon().toPolygon())); } //创建获取窗口透明度信息的GSetting的对象 diff --git a/wireless-security/dlghidewifi.cpp b/wireless-security/dlghidewifi.cpp index 1d195acd..0a3baebe 100644 --- a/wireless-security/dlghidewifi.cpp +++ b/wireless-security/dlghidewifi.cpp @@ -44,6 +44,13 @@ 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())); + KWindowEffects::enableBlurBehind(this->winId(), true, 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);}"); @@ -354,16 +361,10 @@ 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; - path.addRoundedRect(rect, 6, 6); - setProperty("blurRegion", QRegion(path.toFillPolygon().toPolygon())); - KWindowEffects::enableBlurBehind(this->winId(), true, QRegion(path.toFillPolygon().toPolygon())); } diff --git a/wireless-security/dlghidewifieapfast.cpp b/wireless-security/dlghidewifieapfast.cpp index 62ac22e5..25d5bfc1 100644 --- a/wireless-security/dlghidewifieapfast.cpp +++ b/wireless-security/dlghidewifieapfast.cpp @@ -35,6 +35,13 @@ 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())); + KWindowEffects::enableBlurBehind(this->winId(), true, 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; @@ -345,16 +352,10 @@ void DlgHideWifiEapFast::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; - path.addRoundedRect(rect, 6, 6); - setProperty("blurRegion", QRegion(path.toFillPolygon().toPolygon())); - KWindowEffects::enableBlurBehind(this->winId(), true, QRegion(path.toFillPolygon().toPolygon())); } diff --git a/wireless-security/dlghidewifieapleap.cpp b/wireless-security/dlghidewifieapleap.cpp index 536d592e..71ba7679 100644 --- a/wireless-security/dlghidewifieapleap.cpp +++ b/wireless-security/dlghidewifieapleap.cpp @@ -35,6 +35,13 @@ 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())); + KWindowEffects::enableBlurBehind(this->winId(), true, 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; @@ -285,16 +292,10 @@ void DlgHideWifiEapLeap::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; - path.addRoundedRect(rect, 6, 6); - setProperty("blurRegion", QRegion(path.toFillPolygon().toPolygon())); - KWindowEffects::enableBlurBehind(this->winId(), true, QRegion(path.toFillPolygon().toPolygon())); } diff --git a/wireless-security/dlghidewifieappeap.cpp b/wireless-security/dlghidewifieappeap.cpp index 4766aa04..6681dd4a 100644 --- a/wireless-security/dlghidewifieappeap.cpp +++ b/wireless-security/dlghidewifieappeap.cpp @@ -41,6 +41,13 @@ 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())); + KWindowEffects::enableBlurBehind(this->winId(), true, 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);}"); @@ -528,16 +535,10 @@ 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; - path.addRoundedRect(rect, 6, 6); - setProperty("blurRegion", QRegion(path.toFillPolygon().toPolygon())); - KWindowEffects::enableBlurBehind(this->winId(), true, QRegion(path.toFillPolygon().toPolygon())); } diff --git a/wireless-security/dlghidewifieappwd.cpp b/wireless-security/dlghidewifieappwd.cpp index 6fb0bee7..31799425 100644 --- a/wireless-security/dlghidewifieappwd.cpp +++ b/wireless-security/dlghidewifieappwd.cpp @@ -37,6 +37,13 @@ DlgHideWifiEapPwd::DlgHideWifiEapPwd(int type, QWidget *parent) : this->setStyleSheet("QWidget{border-radius:6px;background-color:rgba(19,19,20,0.7);border:1px solid rgba(255, 255, 255, 0.05);}"); + 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())); + 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);}"); @@ -286,16 +293,10 @@ void DlgHideWifiEapPwd::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; - path.addRoundedRect(rect, 6, 6); - setProperty("blurRegion", QRegion(path.toFillPolygon().toPolygon())); - KWindowEffects::enableBlurBehind(this->winId(), true, QRegion(path.toFillPolygon().toPolygon())); } diff --git a/wireless-security/dlghidewifieaptls.cpp b/wireless-security/dlghidewifieaptls.cpp index 8c61573b..9bd0230f 100644 --- a/wireless-security/dlghidewifieaptls.cpp +++ b/wireless-security/dlghidewifieaptls.cpp @@ -40,6 +40,13 @@ 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())); + KWindowEffects::enableBlurBehind(this->winId(), true, 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);}"); @@ -637,16 +644,10 @@ 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; - path.addRoundedRect(rect, 6, 6); - setProperty("blurRegion", QRegion(path.toFillPolygon().toPolygon())); - KWindowEffects::enableBlurBehind(this->winId(), true, QRegion(path.toFillPolygon().toPolygon())); } diff --git a/wireless-security/dlghidewifieapttls.cpp b/wireless-security/dlghidewifieapttls.cpp index e87dbe77..5ff7f7a5 100644 --- a/wireless-security/dlghidewifieapttls.cpp +++ b/wireless-security/dlghidewifieapttls.cpp @@ -37,6 +37,13 @@ DlgHideWifiEapTTLS::DlgHideWifiEapTTLS(int type, QWidget *parent) : this->setStyleSheet("QWidget{border-radius:6px;background-color:rgba(19,19,20,0.7);border:1px solid rgba(255, 255, 255, 0.05);}"); + 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())); + 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);}"); @@ -452,16 +459,10 @@ void DlgHideWifiEapTTLS::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; - path.addRoundedRect(rect, 6, 6); - setProperty("blurRegion", QRegion(path.toFillPolygon().toPolygon())); - KWindowEffects::enableBlurBehind(this->winId(), true, QRegion(path.toFillPolygon().toPolygon())); } diff --git a/wireless-security/dlghidewifileap.cpp b/wireless-security/dlghidewifileap.cpp index f51bb264..103d2efb 100644 --- a/wireless-security/dlghidewifileap.cpp +++ b/wireless-security/dlghidewifileap.cpp @@ -35,6 +35,13 @@ DlgHideWifiLeap::DlgHideWifiLeap(QWidget *parent) : this->setStyleSheet("QWidget{border-radius:6px;background-color:rgba(19,19,20,0.7);border:1px solid rgba(255, 255, 255, 0.05);}"); + 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())); + 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);}"); @@ -232,16 +239,10 @@ void DlgHideWifiLeap::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; - path.addRoundedRect(rect, 6, 6); - setProperty("blurRegion", QRegion(path.toFillPolygon().toPolygon())); - KWindowEffects::enableBlurBehind(this->winId(), true, QRegion(path.toFillPolygon().toPolygon())); } diff --git a/wireless-security/dlghidewifiwep.cpp b/wireless-security/dlghidewifiwep.cpp index d01a2169..ab9752ef 100644 --- a/wireless-security/dlghidewifiwep.cpp +++ b/wireless-security/dlghidewifiwep.cpp @@ -36,6 +36,13 @@ DlgHideWifiWep::DlgHideWifiWep(int type, QWidget *parent) : this->setStyleSheet("QWidget{border-radius:6px;background-color:rgba(19,19,20,0.7);border:1px solid rgba(255, 255, 255, 0.05);}"); + 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())); + 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);}"); @@ -234,16 +241,10 @@ void DlgHideWifiWep::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; - path.addRoundedRect(rect, 6, 6); - setProperty("blurRegion", QRegion(path.toFillPolygon().toPolygon())); - KWindowEffects::enableBlurBehind(this->winId(), true, QRegion(path.toFillPolygon().toPolygon())); } diff --git a/wireless-security/dlghidewifiwpa.cpp b/wireless-security/dlghidewifiwpa.cpp index 99457cbe..98e57ea0 100644 --- a/wireless-security/dlghidewifiwpa.cpp +++ b/wireless-security/dlghidewifiwpa.cpp @@ -43,6 +43,13 @@ 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())); + KWindowEffects::enableBlurBehind(this->winId(), true, 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);}"); @@ -426,16 +433,10 @@ 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; - path.addRoundedRect(rect, 6, 6); - setProperty("blurRegion", QRegion(path.toFillPolygon().toPolygon())); - KWindowEffects::enableBlurBehind(this->winId(), true, QRegion(path.toFillPolygon().toPolygon())); }