Redraw the PushButton in the way of DT
This commit is contained in:
parent
4553f8da17
commit
e4eb5828a7
|
@ -699,175 +699,37 @@ void UKUIConfigStyleParameters::initConfigPushButtonBevelParameters(bool isDark,
|
|||
|
||||
UKUIColorTheme::ButtonColorCfg buttonColorCfg = readCfg()->buttonColorCfg(palette);
|
||||
|
||||
|
||||
int radius = (widget && widget->property("normalRadius").isValid()) ?
|
||||
widget->property("normalRadius").toInt() : m_dtconfig->kradiusNormal();
|
||||
|
||||
QBrush defaultBrush = parseDTColor(option ? option->rect : QRect(), m_dtconfig->buttonActive());
|
||||
QBrush disableBrush = parseDTColor(option ? option->rect : QRect(), m_dtconfig->buttonDisable());
|
||||
QBrush clickBrush;
|
||||
QBrush hoverBrush;
|
||||
QColor startColor;
|
||||
QColor endColor;
|
||||
QLinearGradient linearGradient;
|
||||
linearGradient.setStart(option ? option->rect.topLeft() : QPoint(0, 0));
|
||||
linearGradient.setFinalStop(option ? option->rect.bottomLeft() :QPoint(0, 0));
|
||||
|
||||
QColor highlight = palette.color(QPalette::Active, QPalette::Highlight);
|
||||
QColor mix = palette.color(QPalette::Active, QPalette::BrightText);
|
||||
|
||||
QPen defaultPen ;
|
||||
QPen hoverPen ;
|
||||
QPen clickPen ;
|
||||
QPen disablePen ;
|
||||
QPen checkPen ;
|
||||
QPen checkHoverPen ;
|
||||
QPen checkClickPen ;
|
||||
QPen checkDisablePen;
|
||||
QPen focusPen;
|
||||
|
||||
QBrush checkBrush;
|
||||
QBrush checkHoverBrush;
|
||||
QBrush checkClickBrush;
|
||||
QBrush checkDisableBrush;
|
||||
|
||||
defaultPen = QPen(QBrush(buttonColorCfg.defaultPen), (buttonColorCfg.defaultPen == Qt::NoPen || buttonColorCfg.defaultPen.alpha() == 0)
|
||||
QBrush clickBrush = parseDTColor(option ? option->rect : QRect(), m_dtconfig->kComponentClick());
|
||||
QBrush hoverBrush = parseDTColor(option ? option->rect : QRect(), m_dtconfig->kComponentHover());
|
||||
QPen defaultPen = QPen(parseDTColor(option ? option->rect : QRect(), m_dtconfig->kLineComponentNormal()), (parseDTColor(option ? option->rect : QRect(), m_dtconfig->kLineComponentNormal()).color() == Qt::NoPen || parseDTColor(option ? option->rect : QRect(), m_dtconfig->kLineComponentNormal()).color().alpha() == 0)
|
||||
? 0 : 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
|
||||
hoverPen = QPen(QBrush(buttonColorCfg.hoverPen), (buttonColorCfg.hoverPen == Qt::NoPen || buttonColorCfg.hoverPen.alpha() == 0)
|
||||
QPen hoverPen = QPen(parseDTColor(option ? option->rect : QRect(), m_dtconfig->kLineComponentHover()), (parseDTColor(option ? option->rect : QRect(), m_dtconfig->kLineComponentHover()).color() == Qt::NoPen || parseDTColor(option ? option->rect : QRect(), m_dtconfig->kLineComponentHover()).color().alpha() == 0)
|
||||
? 0 : 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
|
||||
clickPen = QPen(QBrush(buttonColorCfg.clickPen), (buttonColorCfg.clickPen == Qt::NoPen || buttonColorCfg.clickPen.alpha() == 0)
|
||||
QPen clickPen = QPen(parseDTColor(option ? option->rect : QRect(), m_dtconfig->kLineComponentClick()), (parseDTColor(option ? option->rect : QRect(), m_dtconfig->kLineComponentClick()).color() == Qt::NoPen || parseDTColor(option ? option->rect : QRect(), m_dtconfig->kLineComponentClick()).color().alpha() == 0)
|
||||
? 0 : 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
|
||||
disablePen = QPen(QBrush(buttonColorCfg.disablePen), (buttonColorCfg.disablePen == Qt::NoPen || buttonColorCfg.disablePen.alpha() == 0)
|
||||
QPen disablePen = QPen(parseDTColor(option ? option->rect : QRect(), m_dtconfig->kLineComponentDisable()), (parseDTColor(option ? option->rect : QRect(), m_dtconfig->kLineComponentDisable()).color() == Qt::NoPen || parseDTColor(option ? option->rect : QRect(), m_dtconfig->kLineComponentDisable()).color().alpha() == 0)
|
||||
? 0 : 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
|
||||
|
||||
auto checkableColorCfg = readCfg()->buttonColorCfg(palette, C_Button_ImportButton);
|
||||
{
|
||||
checkPen = QPen(QBrush(checkableColorCfg.defaultPen), (checkableColorCfg.defaultPen == Qt::NoPen || checkableColorCfg.defaultPen.alpha() == 0)
|
||||
? 0 : 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
|
||||
checkHoverPen = QPen(QBrush(checkableColorCfg.hoverPen), (checkableColorCfg.hoverPen == Qt::NoPen || checkableColorCfg.hoverPen.alpha() == 0)
|
||||
? 0 : 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
|
||||
checkClickPen = QPen(QBrush(checkableColorCfg.clickPen), (checkableColorCfg.clickPen == Qt::NoPen || checkableColorCfg.clickPen.alpha() == 0)
|
||||
? 0 : 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
|
||||
checkDisablePen = QPen(QBrush(checkableColorCfg.disablePen), (checkableColorCfg.disablePen == Qt::NoPen || checkableColorCfg.disablePen.alpha() == 0)
|
||||
? 0 : 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
|
||||
QBrush checkBrush= parseDTColor(option ? option->rect : QRect(), m_dtconfig->highLightActive());
|
||||
QBrush checkHoverBrush= parseDTColor(option ? option->rect : QRect(), m_dtconfig->kBrandHover());
|
||||
QBrush checkClickBrush= parseDTColor(option ? option->rect : QRect(), m_dtconfig->kBrandClick());
|
||||
QBrush checkDisableBrush= parseDTColor(option ? option->rect : QRect(), m_dtconfig->highLightDisable());
|
||||
QPen checkPen = QPen(parseDTColor(option ? option->rect : QRect(), m_dtconfig->kLineBrandNormal()), (parseDTColor(option ? option->rect : QRect(), m_dtconfig->kLineBrandNormal()).color() == Qt::NoPen || parseDTColor(option ? option->rect : QRect(), m_dtconfig->kLineBrandNormal()).color().alpha() == 0)
|
||||
? 0 : 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
|
||||
QPen checkHoverPen = QPen(parseDTColor(option ? option->rect : QRect(), m_dtconfig->kLineBrandHover()), (parseDTColor(option ? option->rect : QRect(), m_dtconfig->kLineBrandHover()).color() == Qt::NoPen || parseDTColor(option ? option->rect : QRect(), m_dtconfig->kLineBrandHover()).color().alpha() == 0)
|
||||
? 0 : 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
|
||||
QPen checkClickPen = QPen(parseDTColor(option ? option->rect : QRect(), m_dtconfig->kLineBrandClick()), (parseDTColor(option ? option->rect : QRect(), m_dtconfig->kLineBrandClick()).color() == Qt::NoPen || parseDTColor(option ? option->rect : QRect(), m_dtconfig->kLineBrandClick()).color().alpha() == 0)
|
||||
? 0 : 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
|
||||
QPen checkDisablePen= QPen(parseDTColor(option ? option->rect : QRect(), m_dtconfig->kLineBrandDisable()), (parseDTColor(option ? option->rect : QRect(), m_dtconfig->kLineBrandDisable()).color() == Qt::NoPen || parseDTColor(option ? option->rect : QRect(), m_dtconfig->kLineBrandDisable()).color().alpha() == 0)
|
||||
? 0 : 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
|
||||
|
||||
checkBrush = palette.color(QPalette::Active, QPalette::Highlight);
|
||||
checkHoverBrush = checkableColorCfg.hoverBrush;
|
||||
checkClickBrush = checkableColorCfg.clickBrush;
|
||||
checkDisableBrush = palette.brush(QPalette::Disabled, QPalette::NoRole);
|
||||
}
|
||||
|
||||
if (isWindowColoseButton) {
|
||||
if (buttonColorCfg.hoverType == Obj_Gradient_Type){
|
||||
linearGradient.setColorAt(0, buttonColorCfg.hoverGradientList.value(0));
|
||||
linearGradient.setColorAt(1, buttonColorCfg.hoverGradientList.value(1));
|
||||
hoverBrush = QBrush(linearGradient);
|
||||
}
|
||||
else
|
||||
hoverBrush = parseDTColor(option ? option->rect : QRect(), m_dtconfig->kComponentHover());
|
||||
clickBrush = parseDTColor(option ? option->rect : QRect(), m_dtconfig->kComponentClick());
|
||||
focusPen = QPen(QBrush(clickBrush), 2, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
|
||||
} else {
|
||||
switch (m_adjustColorRules) {
|
||||
case AdjustColorRules::DefaultRGB:{
|
||||
|
||||
if (buttonColorCfg.hoverType == Obj_Gradient_Type) {
|
||||
if (isDark) {
|
||||
startColor = configMixColor(highlight, QColor(Qt::white), 0.2);
|
||||
endColor = configMixColor(highlight, QColor(Qt::black), 0.05);
|
||||
} else {
|
||||
startColor = configMixColor(highlight, QColor(Qt::white), 0.05);
|
||||
endColor = configMixColor(highlight, QColor(Qt::black), 0.2);
|
||||
}
|
||||
linearGradient.setColorAt(0, startColor);
|
||||
linearGradient.setColorAt(1, endColor);
|
||||
hoverBrush = QBrush(linearGradient);
|
||||
clickBrush = QBrush(configMixColor(highlight, mix, 0.1));
|
||||
} else {
|
||||
if (isDark) {
|
||||
hoverBrush = QBrush(configMixColor(highlight, mix, 0.2));
|
||||
} else {
|
||||
hoverBrush = QBrush(configMixColor(highlight, mix, 0.05));
|
||||
}
|
||||
|
||||
if (isDark) {
|
||||
clickBrush = QBrush(configMixColor(highlight, mix, 0.05));
|
||||
} else {
|
||||
clickBrush = QBrush(configMixColor(highlight, mix, 0.2));
|
||||
}
|
||||
}
|
||||
checkHoverBrush = hoverBrush;
|
||||
checkClickBrush = clickBrush;
|
||||
|
||||
if (isWindowButton && useTransparentButtonList().contains(qAppName())) {//特殊三联应用
|
||||
if (isDark) {
|
||||
mix.setAlphaF(0.28);
|
||||
hoverBrush = QBrush(mix);
|
||||
mix.setAlphaF(0.15);
|
||||
clickBrush = QBrush(mix);
|
||||
} else {
|
||||
mix.setAlphaF(0.15);
|
||||
hoverBrush = QBrush(mix);
|
||||
mix.setAlphaF(0.28);
|
||||
clickBrush = QBrush(mix);
|
||||
}
|
||||
} else if (useButtonPalette || isWindowButton) {
|
||||
if(buttonColorCfg.hoverType == Obj_Gradient_Type){
|
||||
startColor = buttonColorCfg.hoverGradientList.value(0);
|
||||
endColor = buttonColorCfg.hoverGradientList.value(1);
|
||||
linearGradient.setColorAt(0, startColor);
|
||||
linearGradient.setColorAt(1, endColor);
|
||||
hoverBrush = QBrush(linearGradient);
|
||||
clickBrush = parseDTColor(option ? option->rect : QRect(), m_dtconfig->kComponentClick());
|
||||
} else {
|
||||
hoverBrush = parseDTColor(option ? option->rect : QRect(), m_dtconfig->kComponentHover());
|
||||
clickBrush = parseDTColor(option ? option->rect : QRect(), m_dtconfig->kComponentClick());
|
||||
}
|
||||
}
|
||||
|
||||
focusPen = QPen(QBrush(configMixColor(highlight, mix, 0.2)), 2, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
|
||||
|
||||
}break;
|
||||
case AdjustColorRules::HSL:{
|
||||
if (buttonColorCfg.focusPen != Qt::NoPen)
|
||||
focusPen = QPen(QBrush(buttonColorCfg.focusPen), (buttonColorCfg.focusPen == Qt::NoPen || buttonColorCfg.focusPen.alpha() == 0) ? 0 : 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
|
||||
|
||||
if (isWindowButton && useTransparentButtonList().contains(qAppName())) {//特殊窗口三联
|
||||
QColor p = QColor(255, 255, 255);
|
||||
p.setAlphaF(0.4);
|
||||
defaultPen = QPen(QColor(Qt::NoPen), 0, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
|
||||
hoverPen = QPen(p, 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
|
||||
p.setAlphaF(0.35);
|
||||
clickPen = QPen(p, 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
|
||||
disablePen = defaultPen;
|
||||
defaultBrush = QBrush(Qt::NoBrush);
|
||||
QColor bColor = QColor(0, 0, 0);
|
||||
bColor.setAlphaF(0.1);
|
||||
hoverBrush = QBrush(bColor);
|
||||
bColor.setAlphaF(0.2);
|
||||
clickBrush = QBrush(bColor);
|
||||
disableBrush = QBrush(Qt::NoBrush);
|
||||
focusPen = clickPen;
|
||||
}
|
||||
else if (!isWindowColoseButton) {
|
||||
normalButtonColor(isDark, palette, defaultPen, defaultBrush, hoverPen, hoverBrush,
|
||||
clickPen, clickBrush, disablePen, disableBrush);
|
||||
focusPen = QPen(palette.brush(QPalette::Inactive, QPalette::Highlight),
|
||||
(buttonColorCfg.focusPen == Qt::NoPen || buttonColorCfg.focusPen.alpha() == 0) ?
|
||||
0 : 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
|
||||
defaultPen = QPen(QBrush(buttonColorCfg.defaultPen), (buttonColorCfg.defaultPen == Qt::NoPen || buttonColorCfg.defaultPen.alpha() == 0)
|
||||
? 0 : 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
|
||||
disablePen = QPen(QBrush(buttonColorCfg.disablePen), (buttonColorCfg.disablePen == Qt::NoPen || buttonColorCfg.disablePen.alpha() == 0)
|
||||
? 0 : 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
|
||||
|
||||
checkHoverBrush = hoverBrush;
|
||||
checkClickBrush = clickBrush;
|
||||
|
||||
} else {
|
||||
hoverBrush = parseDTColor(option ? option->rect : QRect(), m_dtconfig->kComponentHover());
|
||||
clickBrush = parseDTColor(option ? option->rect : QRect(), m_dtconfig->kComponentClick());
|
||||
}
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
QPen focusPen = QPen(parseDTColor(option ? option->rect : QRect(), m_dtconfig->kBrandFocus()), 2, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
|
||||
|
||||
if (widget) {
|
||||
if (widget->property("isWindowButton").isValid()) {
|
||||
|
@ -891,17 +753,33 @@ void UKUIConfigStyleParameters::initConfigPushButtonBevelParameters(bool isDark,
|
|||
}
|
||||
}
|
||||
if (isWindowColoseButton){
|
||||
defaultBrush = parseDTColor(option ? option->rect : QRect(), m_dtconfig->buttonActive());
|
||||
defaultBrush = parseDTColor(option ? option->rect : QRect(), m_dtconfig->kGrayAlpha0());
|
||||
hoverBrush= parseDTColor(option ? option->rect : QRect(), m_dtconfig->kErrorHover());
|
||||
clickBrush= parseDTColor(option ? option->rect : QRect(), m_dtconfig->kErrorClick());
|
||||
disableBrush = parseDTColor(option ? option->rect : QRect(), m_dtconfig->kGrayAlpha0());
|
||||
defaultPen = QPen(parseDTColor(option ? option->rect : QRect(), m_dtconfig->kLineComponentNormal()), (parseDTColor(option ? option->rect : QRect(), m_dtconfig->kLineComponentNormal()).color() == Qt::NoPen || parseDTColor(option ? option->rect : QRect(), m_dtconfig->kLineComponentNormal()).color().alpha() == 0)
|
||||
? 0 : 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
|
||||
hoverPen = QPen(parseDTColor(option ? option->rect : QRect(), m_dtconfig->kLineComponentHover()), (parseDTColor(option ? option->rect : QRect(), m_dtconfig->kLineComponentHover()).color() == Qt::NoPen || parseDTColor(option ? option->rect : QRect(), m_dtconfig->kLineComponentHover()).color().alpha() == 0)
|
||||
? 0 : 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
|
||||
clickPen = QPen(parseDTColor(option ? option->rect : QRect(), m_dtconfig->kLineComponentClick()), (parseDTColor(option ? option->rect : QRect(), m_dtconfig->kLineComponentClick()).color() == Qt::NoPen || parseDTColor(option ? option->rect : QRect(), m_dtconfig->kLineComponentClick()).color().alpha() == 0)
|
||||
? 0 : 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
|
||||
disablePen = QPen(parseDTColor(option ? option->rect : QRect(), m_dtconfig->kLineComponentDisable()), (parseDTColor(option ? option->rect : QRect(), m_dtconfig->kLineComponentDisable()).color() == Qt::NoPen || parseDTColor(option ? option->rect : QRect(), m_dtconfig->kLineComponentDisable()).color().alpha() == 0)
|
||||
? 0 : 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
|
||||
}
|
||||
|
||||
if (isWindowButton){
|
||||
//没有相应颜色
|
||||
// defaultBrush = QBrush(testdt->buttonActive());
|
||||
// disableBrush = QBrush(testdt->kComponentAlphaDisable());
|
||||
// hoverBrush= QBrush(testdt->kComponentAlphaHover());
|
||||
// clickBrush= QBrush(testdt->kComponentAlphaClick());
|
||||
defaultBrush = parseDTColor(option ? option->rect : QRect(), m_dtconfig->kGrayAlpha0());
|
||||
hoverBrush= parseDTColor(option ? option->rect : QRect(), m_dtconfig->kComponentAlphaHover());
|
||||
clickBrush= parseDTColor(option ? option->rect : QRect(), m_dtconfig->kComponentAlphaClick());
|
||||
disableBrush = parseDTColor(option ? option->rect : QRect(), m_dtconfig->kGrayAlpha0());
|
||||
defaultPen = QPen(parseDTColor(option ? option->rect : QRect(), m_dtconfig->kLineComponentNormal()), (parseDTColor(option ? option->rect : QRect(), m_dtconfig->kLineComponentNormal()).color() == Qt::NoPen || parseDTColor(option ? option->rect : QRect(), m_dtconfig->kLineComponentNormal()).color().alpha() == 0)
|
||||
? 0 : 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
|
||||
hoverPen = QPen(parseDTColor(option ? option->rect : QRect(), m_dtconfig->kLineComponentHover()), (parseDTColor(option ? option->rect : QRect(), m_dtconfig->kLineComponentHover()).color() == Qt::NoPen || parseDTColor(option ? option->rect : QRect(), m_dtconfig->kLineComponentHover()).color().alpha() == 0)
|
||||
? 0 : 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
|
||||
clickPen = QPen(parseDTColor(option ? option->rect : QRect(), m_dtconfig->kLineComponentClick()), (parseDTColor(option ? option->rect : QRect(), m_dtconfig->kLineComponentClick()).color() == Qt::NoPen || parseDTColor(option ? option->rect : QRect(), m_dtconfig->kLineComponentClick()).color().alpha() == 0)
|
||||
? 0 : 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
|
||||
disablePen = QPen(parseDTColor(option ? option->rect : QRect(), m_dtconfig->kLineComponentDisable()), (parseDTColor(option ? option->rect : QRect(), m_dtconfig->kLineComponentDisable()).color() == Qt::NoPen || parseDTColor(option ? option->rect : QRect(), m_dtconfig->kLineComponentDisable()).color().alpha() == 0)
|
||||
? 0 : 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
|
||||
}
|
||||
|
||||
if (useButtonPalette || isWindowButton) {
|
||||
|
@ -910,25 +788,27 @@ void UKUIConfigStyleParameters::initConfigPushButtonBevelParameters(bool isDark,
|
|||
disableBrush = parseDTColor(option ? option->rect : QRect(), m_dtconfig->kComponentAlphaDisable());
|
||||
hoverBrush= parseDTColor(option ? option->rect : QRect(), m_dtconfig->kComponentAlphaHover());
|
||||
clickBrush= parseDTColor(option ? option->rect : QRect(), m_dtconfig->kComponentAlphaClick());
|
||||
defaultPen = QPen(parseDTColor(option ? option->rect : QRect(), m_dtconfig->kLineComponentNormal()), (parseDTColor(option ? option->rect : QRect(), m_dtconfig->kLineComponentNormal()).color() == Qt::NoPen || parseDTColor(option ? option->rect : QRect(), m_dtconfig->kLineComponentNormal()).color().alpha() == 0)
|
||||
? 0 : 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
|
||||
hoverPen = QPen(parseDTColor(option ? option->rect : QRect(), m_dtconfig->kLineComponentHover()), (parseDTColor(option ? option->rect : QRect(), m_dtconfig->kLineComponentHover()).color() == Qt::NoPen || parseDTColor(option ? option->rect : QRect(), m_dtconfig->kLineComponentHover()).color().alpha() == 0)
|
||||
? 0 : 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
|
||||
clickPen = QPen(parseDTColor(option ? option->rect : QRect(), m_dtconfig->kLineComponentClick()), (parseDTColor(option ? option->rect : QRect(), m_dtconfig->kLineComponentClick()).color() == Qt::NoPen || parseDTColor(option ? option->rect : QRect(), m_dtconfig->kLineComponentClick()).color().alpha() == 0)
|
||||
? 0 : 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
|
||||
disablePen = QPen(parseDTColor(option ? option->rect : QRect(), m_dtconfig->kLineComponentDisable()), (parseDTColor(option ? option->rect : QRect(), m_dtconfig->kLineComponentDisable()).color() == Qt::NoPen || parseDTColor(option ? option->rect : QRect(), m_dtconfig->kLineComponentDisable()).color().alpha() == 0)
|
||||
? 0 : 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
|
||||
} else {
|
||||
// defaultBrush = QBrush(testdt->buttonActive());
|
||||
// disableBrush = QBrush(testdt->kComponentAlphaDisable());
|
||||
// hoverBrush= QBrush(testdt->kComponentAlphaHover());
|
||||
// clickBrush= QBrush(testdt->kComponentAlphaClick());
|
||||
}
|
||||
}
|
||||
if (useButtonPalette || isWindowButton) {
|
||||
if (needTranslucent){
|
||||
defaultBrush = parseDTColor(option ? option->rect : QRect(), m_dtconfig->kComponentAlphaNormal());
|
||||
disableBrush = parseDTColor(option ? option->rect : QRect(), m_dtconfig->kComponentAlphaDisable());
|
||||
hoverBrush= parseDTColor(option ? option->rect : QRect(), m_dtconfig->kComponentAlphaHover());
|
||||
clickBrush= parseDTColor(option ? option->rect : QRect(), m_dtconfig->kComponentAlphaClick());
|
||||
} else {
|
||||
buttonColorCfg = readCfg()->buttonColorCfg(palette, C_Button_UseButtonPalette);
|
||||
// defaultBrush = QBrush(testdt->buttonActive());
|
||||
// disableBrush = QBrush(testdt->kComponentAlphaDisable());
|
||||
// hoverBrush= QBrush(testdt->kComponentAlphaHover());
|
||||
// clickBrush= QBrush(testdt->kComponentAlphaClick());
|
||||
defaultBrush = parseDTColor(option ? option->rect : QRect(), m_dtconfig->buttonActive());
|
||||
disableBrush = parseDTColor(option ? option->rect : QRect(), m_dtconfig->buttonDisable());
|
||||
clickBrush = parseDTColor(option ? option->rect : QRect(), m_dtconfig->kComponentClick());
|
||||
hoverBrush = parseDTColor(option ? option->rect : QRect(), m_dtconfig->kComponentHover());
|
||||
defaultPen = QPen(parseDTColor(option ? option->rect : QRect(), m_dtconfig->kLineComponentNormal()), (parseDTColor(option ? option->rect : QRect(), m_dtconfig->kLineComponentNormal()).color() == Qt::NoPen || parseDTColor(option ? option->rect : QRect(), m_dtconfig->kLineComponentNormal()).color().alpha() == 0)
|
||||
? 0 : 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
|
||||
hoverPen = QPen(parseDTColor(option ? option->rect : QRect(), m_dtconfig->kLineComponentHover()), (parseDTColor(option ? option->rect : QRect(), m_dtconfig->kLineComponentHover()).color() == Qt::NoPen || parseDTColor(option ? option->rect : QRect(), m_dtconfig->kLineComponentHover()).color().alpha() == 0)
|
||||
? 0 : 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
|
||||
clickPen = QPen(parseDTColor(option ? option->rect : QRect(), m_dtconfig->kLineComponentClick()), (parseDTColor(option ? option->rect : QRect(), m_dtconfig->kLineComponentClick()).color() == Qt::NoPen || parseDTColor(option ? option->rect : QRect(), m_dtconfig->kLineComponentClick()).color().alpha() == 0)
|
||||
? 0 : 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
|
||||
disablePen = QPen(parseDTColor(option ? option->rect : QRect(), m_dtconfig->kLineComponentDisable()), (parseDTColor(option ? option->rect : QRect(), m_dtconfig->kLineComponentDisable()).color() == Qt::NoPen || parseDTColor(option ? option->rect : QRect(), m_dtconfig->kLineComponentDisable()).color().alpha() == 0)
|
||||
? 0 : 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -937,11 +817,16 @@ void UKUIConfigStyleParameters::initConfigPushButtonBevelParameters(bool isDark,
|
|||
disableBrush = parseDTColor(option ? option->rect : QRect(), m_dtconfig->highLightDisable());
|
||||
hoverBrush = parseDTColor(option ? option->rect : QRect(), m_dtconfig->kBrandHover());
|
||||
clickBrush = parseDTColor(option ? option->rect : QRect(), m_dtconfig->kBrandClick());
|
||||
defaultPen = QPen(parseDTColor(option ? option->rect : QRect(), m_dtconfig->kLineBrandNormal()), (parseDTColor(option ? option->rect : QRect(), m_dtconfig->kLineBrandNormal()).color() == Qt::NoPen || parseDTColor(option ? option->rect : QRect(), m_dtconfig->kLineBrandNormal()).color().alpha() == 0)
|
||||
? 0 : 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
|
||||
hoverPen = QPen(parseDTColor(option ? option->rect : QRect(), m_dtconfig->kLineBrandHover()), (parseDTColor(option ? option->rect : QRect(), m_dtconfig->kLineBrandHover()).color() == Qt::NoPen || parseDTColor(option ? option->rect : QRect(), m_dtconfig->kLineBrandHover()).color().alpha() == 0)
|
||||
? 0 : 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
|
||||
clickPen = QPen(parseDTColor(option ? option->rect : QRect(), m_dtconfig->kLineBrandClick()), (parseDTColor(option ? option->rect : QRect(), m_dtconfig->kLineBrandClick()).color() == Qt::NoPen || parseDTColor(option ? option->rect : QRect(), m_dtconfig->kLineBrandClick()).color().alpha() == 0)
|
||||
? 0 : 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
|
||||
disablePen= QPen(parseDTColor(option ? option->rect : QRect(), m_dtconfig->kLineBrandDisable()), (parseDTColor(option ? option->rect : QRect(), m_dtconfig->kLineBrandDisable()).color() == Qt::NoPen || parseDTColor(option ? option->rect : QRect(), m_dtconfig->kLineBrandDisable()).color().alpha() == 0)
|
||||
? 0 : 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
|
||||
}
|
||||
|
||||
int radius = (widget && widget->property("normalRadius").isValid()) ?
|
||||
widget->property("normalRadius").toInt() : m_radiusStruct.normalRadius;
|
||||
|
||||
auto *w = const_cast<QWidget *>(widget);
|
||||
|
||||
if (w) {
|
||||
|
|
Loading…
Reference in New Issue