阴影不受窗体透明度影响,增加重叠实现描边效果

This commit is contained in:
lixueman 2022-10-12 11:46:44 +08:00
parent bbe642c685
commit 81ee93a7e6
1 changed files with 5 additions and 1 deletions

View File

@ -685,15 +685,19 @@ void MainWindow::paintEvent(QPaintEvent *event)
painter.setPen(Qt::transparent);
painter.setOpacity(transparency);
painter.drawPath(path);
painter.restore();
KWindowEffects::enableBlurBehind(this->winId(), true, QRegion(path.toFillPolygon().toPolygon()));
QColor color = Qt::black;
for (int i = 0; i < 6; i++) {
painter.save();
for (int i = 0; i < 7; i++) {
rect = this->rect().adjusted(i, i, - i, - i);
color.setAlpha(i * 6);
painter.setBrush(Qt::NoBrush);
painter.setPen(QPen(color, 1));
painter.drawRoundedRect(rect, 10, 10);
}
painter.restore();
QMainWindow::paintEvent(event);
}
/**
*