修改控件最大圆角,不与窗口圆角挂钩

This commit is contained in:
tanjing 2023-11-17 11:40:30 +08:00
parent dfd7a0863f
commit 93dd094cbc
12 changed files with 31 additions and 48 deletions

View File

@ -1684,8 +1684,18 @@ void KyNativeFileDialog::paintEvent(QPaintEvent *e)
// sidebarPath.addRect(adjustedRect.adjusted(6, 0, 0, 0));
QPainter p(this);
QPainterPath contentPath;
if(this && this->property("windowRadius").isValid())
radius = this->property("windowRadius").toInt();
if (UKUIStyleSettings::isSchemaInstalled("org.ukui.style")) {
auto settings = UKUIStyleSettings::globalInstance();
if(settings->keys().contains("windowRadius"))
radius = settings->get("windowRadius").toInt();
else if(this && this->property("maxRadius").isValid())
radius = this->property("maxRadius").toInt();
}
else if(this && this->property("maxRadius").isValid())
radius = this->property("maxRadius").toInt();
// qDebug() << "KyNativeFileDialog radius........" << radius;
contentPath.addRoundedRect(this->rect(), radius, radius);
auto bgPath = contentPath - sidebarPath;

View File

@ -282,8 +282,8 @@ void BlurHelper::delayUpdate(QWidget *w, bool updateBlurRegionOnly)
}
QPainterPath path;
int radius = 8;
if(widget->property("windowRadius").isValid())
radius = widget->property("windowRadius").toInt();
if(widget->property("maxRadius").isValid())
radius = widget->property("maxRadius").toInt();
path.addRoundedRect(widget->rect(), radius, radius);
KWindowEffects::enableBlurBehind(widget->winId(), true, path.toFillPolygon().toPolygon());
if (!updateBlurRegionOnly)

View File

@ -155,8 +155,8 @@ QPixmap ConfigShadowHelper::getShadowPixmap(QColor color, /*ConfigShadowHelper::
QPoint currentPos;
int qAppMaxradius = maxRadius;
if(widget && widget->property("windowRadius").isValid()){
qAppMaxradius = widget->property("windowRadius").toInt();
if(widget && widget->property("maxRadius").isValid()){
qAppMaxradius = widget->property("maxRadius").toInt();
// qDebug() << "radius...." << qAppMaxradius;
}
// move to top left arc start point
@ -259,8 +259,8 @@ QPainterPath ConfigShadowHelper::caculateRelativePainterPath(QWidget *widget, qr
QPointF currentPos;
int qAppMaxradius = maxRadius;
if(widget && widget->property("windowRadius").isValid()){
qAppMaxradius = widget->property("windowRadius").toInt();
if(widget && widget->property("maxRadius").isValid()){
qAppMaxradius = widget->property("maxRadius").toInt();
//qDebug() << "radius...." << qAppMaxradius;
}

View File

@ -1,6 +1,6 @@
{
"Radius":{
"Window_Radius" : {"value": "0", "type": "int"},
"Max_Radius" : {"value": "0", "type": "int"},
"Normal_Radius" : {"value": "0", "type": "int"},
"Min_Radius" : {"value": "0", "type": "int"}
},

View File

@ -1,6 +1,6 @@
{
"Radius":{
"Window_Radius" : {"value": "8", "type": "int"},
"Max_Radius" : {"value": "8", "type": "int"},
"Normal_Radius" : {"value": "6", "type": "int"},
"Min_Radius" : {"value": "4", "type": "int"}
},

View File

@ -1,6 +1,6 @@
{
"Radius":{
"Window_Radius" : {"value": "8", "type": "int"},
"Max_Radius" : {"value": "8", "type": "int"},
"Normal_Radius" : {"value": "6", "type": "int"},
"Min_Radius" : {"value": "4", "type": "int"}
},

View File

@ -3948,8 +3948,8 @@ void UKUIConfigStyleParameters::initConfigTabWidgetParameters(bool isDark, const
void UKUIConfigStyleParameters::initConfigMenuParameters(bool isDark, const QStyleOption *option, const QWidget *widget)
{
int frameradius = (widget && widget->property("windowRadius").isValid()) ?
widget->property("windowRadius").toInt() : m_radiusStruct.maxRadius;
int frameradius = (widget && widget->property("maxRadius").isValid()) ?
widget->property("maxRadius").toInt() : m_radiusStruct.maxRadius;
int itemradius = (widget && widget->property("normalRadius").isValid()) ?
widget->property("normalRadius").toInt() : m_radiusStruct.normalRadius;
// QPixmap framePixmap(option->rect.size());

View File

@ -265,13 +265,7 @@ UKUIConfigStyle::UKUIConfigStyle(bool dark, bool useDefault, QString type) : QPr
sp = new UKUIConfigStyleParameters(this, isUseDarkPalette(), m_widget_theme);
if (UKUIStyleSettings::isSchemaInstalled("org.ukui.style")) {
auto settings = UKUIStyleSettings::globalInstance();
if(settings->keys().contains("windowRadius"))
setProperty("windowRadius", settings->get("windowRadius").toInt());
else
setProperty("windowRadius", sp->radiusProperty().maxRadius);
}
setProperty("maxRadius", sp->radiusProperty().maxRadius);
setProperty("normalRadius", sp->radiusProperty().normalRadius);
setProperty("minRadius", sp->radiusProperty().minRadius);
}
@ -968,30 +962,9 @@ void UKUIConfigStyle::polish(QWidget *widget)
if(!widget)
return;
if (UKUIStyleSettings::isSchemaInstalled("org.ukui.style")) {
auto settings = UKUIStyleSettings::globalInstance();
if(settings->keys().contains("windowRadius"))
widget->setProperty("windowRadius", settings->get("windowRadius").toInt());
else
widget->setProperty("windowRadius", sp->radiusProperty().maxRadius);
}
// if(settings->keys().contains("normalRadius"))
// widget->setProperty("normalRadius", settings->get("normalRadius").toInt());
// else
// widget->setProperty("normalRadius", sp->radiusProperty().normalRadius);
// if(settings->keys().contains("minRadius"))
// widget->setProperty("minRadius", settings->get("minRadius").toInt());
// else
// widget->setProperty("minRadius", sp->radiusProperty().minRadius);
// }
// else{
widget->setProperty("normalRadius", sp->radiusProperty().normalRadius);
widget->setProperty("minRadius", sp->radiusProperty().minRadius);
// }
widget->setProperty("maxRadius", sp->radiusProperty().maxRadius);
widget->setProperty("normalRadius", sp->radiusProperty().normalRadius);
widget->setProperty("minRadius", sp->radiusProperty().minRadius);
Style::polish(widget);

View File

@ -261,7 +261,7 @@ Qt5UKUIStyle::Qt5UKUIStyle(bool dark, bool useDefault, QString type) : QProxySty
sp = new KClassicalStyleParameters(this, isUseDarkPalette());
qDebug() << "classical setproperty........" << sp->radiusProperty().maxRadius << sp->radiusProperty().normalRadius << sp->radiusProperty().minRadius;
setProperty("windowRadius", sp->radiusProperty().maxRadius);
setProperty("maxRadius", sp->radiusProperty().maxRadius);
setProperty("normalRadius", sp->radiusProperty().normalRadius);
setProperty("minRadius", sp->radiusProperty().minRadius);
}

View File

@ -1,6 +1,6 @@
{
"Radius":{
"Window_Radius" : {"value": "0", "type": "int"},
"Max_Radius" : {"value": "0", "type": "int"},
"Normal_Radius" : {"value": "0", "type": "int"},
"Min_Radius" : {"value": "0", "type": "int"}
}

View File

@ -1128,7 +1128,7 @@ UKUIRadiusInformation::UKUIRadiusStruct ReadThemeConfig::getRadiusStruct(QString
if(!m_loadConfig)
return m_radiusStruct;
getRadius(Window_Radius, m_radiusStruct.maxRadius);
getRadius(Max_Radius, m_radiusStruct.maxRadius);
getRadius(Normal_Radius, m_radiusStruct.normalRadius);
getRadius(Min_Radius, m_radiusStruct.minRadius);
return m_radiusStruct;

View File

@ -43,7 +43,7 @@
#define Obj_PaletteRole_Type "paletterole"
#define UKUI_Radius "Radius"
#define Window_Radius "Window_Radius"
#define Max_Radius "Max_Radius"
#define Normal_Radius "Normal_Radius"
#define Min_Radius "Min_Radius"