修改qmenu的阴影圆角

This commit is contained in:
tanjing 2024-01-31 10:17:24 +08:00
parent eca73264f6
commit 15cfe366fe
1 changed files with 20 additions and 6 deletions

View File

@ -37,6 +37,8 @@
#include <QApplication>
#include <QDebug>
#include <QMenu>
#include "settings/ukui-style-settings.h"
#define INNERRECT_WIDTH 1
@ -155,9 +157,15 @@ QPixmap ConfigShadowHelper::getShadowPixmap(QColor color, /*ConfigShadowHelper::
QPoint currentPos;
int qAppMaxradius = maxRadius;
if(widget && widget->property("maxRadius").isValid()){
qAppMaxradius = widget->property("maxRadius").toInt();
// qDebug() << "radius...." << qAppMaxradius;
if(widget){
if(qobject_cast<QMenu *>(widget)){
auto settings = UKUIStyleSettings::globalInstance();
if(settings && settings->keys().contains("windowRadius"))
qAppMaxradius = settings->get("windowRadius").toInt();
}
else if(widget->property("maxRadius").isValid())
qAppMaxradius = widget->property("maxRadius").toInt();
// qDebug() << "radius...." << qAppMaxradius;
}
// move to top left arc start point
windowRelativePath.moveTo(borderRadiusTopLeft, 0);
@ -259,9 +267,15 @@ QPainterPath ConfigShadowHelper::caculateRelativePainterPath(QWidget *widget, qr
QPointF currentPos;
int qAppMaxradius = maxRadius;
if(widget && widget->property("maxRadius").isValid()){
qAppMaxradius = widget->property("maxRadius").toInt();
//qDebug() << "radius...." << qAppMaxradius;
if(widget){
if(qobject_cast<QMenu *>(widget)){
auto settings = UKUIStyleSettings::globalInstance();
if(settings && settings->keys().contains("windowRadius"))
qAppMaxradius = settings->get("windowRadius").toInt();
}
else if(widget->property("maxRadius").isValid())
qAppMaxradius = widget->property("maxRadius").toInt();
}
// move to top left arc start point