DT is adapted to all widgets.

This commit is contained in:
李柯 2024-11-21 14:41:12 +08:00
parent 3ef263daf9
commit 2d2ba3dead
1 changed files with 107 additions and 85 deletions

View File

@ -1611,19 +1611,19 @@ void UKUIConfigStyleParameters::initConfigLineEditParameters(bool isDark, const
QBrush focusBrush = parseDTColor(option ? option->rect : QRect(), m_dtconfig->kComponentClick());
QBrush disableBrush = parseDTColor(option ? option->rect : QRect(), m_dtconfig->kComponentDisable());
QPen defaultPen = QPen(lineEditColorCfg.defaultPen, lineEditColorCfg.defaultPen.alpha() == 0 ? 0 : 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
QPen hoverPen = QPen(lineEditColorCfg.hoverPen, lineEditColorCfg.hoverPen.alpha() == 0 ? 0 : 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
QPen focusPen = QPen(lineEditColorCfg.focusPen, m_adjustColorRules == 0 ? 2 : 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
QPen disablePen = QPen(lineEditColorCfg.disablePen, lineEditColorCfg.disablePen.alpha() == 0 ? 0 : 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
QPen defaultPen = QPen(parseDTColor(option ? option->rect : QRect(), m_dtconfig->kLineComponentNormal()).color(), parseDTColor(option ? option->rect : QRect(), m_dtconfig->kLineComponentNormal()).color().alpha() == 0 ? 0 : 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
QPen hoverPen = QPen(parseDTColor(option ? option->rect : QRect(), m_dtconfig->kLineComponentHover()).color(), parseDTColor(option ? option->rect : QRect(), m_dtconfig->kLineComponentHover()).color().alpha() == 0 ? 0 : 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
QPen focusPen = QPen(parseDTColor(option ? option->rect : QRect(), m_dtconfig->kLineComponentClick()).color(), m_adjustColorRules == 0 ? 2 : 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
QPen disablePen = QPen(parseDTColor(option ? option->rect : QRect(), m_dtconfig->kLineComponentDisable()).color(), parseDTColor(option ? option->rect : QRect(), m_dtconfig->kLineComponentDisable()).color().alpha() == 0 ? 0 : 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
if(lineEditColorCfg.hoverType == Obj_Gradient_Type){
if(m_dtconfig->kComponentHover().colorType() == Qt::LinearGradientPattern){
QColor startColor;
QColor endColor;
QLinearGradient linearGradient;
linearGradient.setStart(option ? option->rect.topLeft() : QPoint(0, 0));
linearGradient.setFinalStop(option ? option->rect.bottomLeft() :QPoint(0, 0));
startColor = lineEditColorCfg.hoverGradientList.value(0);
endColor = lineEditColorCfg.hoverGradientList.value(1);
startColor = m_dtconfig->kComponentHover().mixStartColor();
endColor = m_dtconfig->kComponentHover().mixEndColor();
linearGradient.setColorAt(0, startColor);
linearGradient.setColorAt(1, endColor);
@ -1639,6 +1639,10 @@ void UKUIConfigStyleParameters::initConfigLineEditParameters(bool isDark, const
hoverBrush = parseDTColor(option ? option->rect : QRect(), m_dtconfig->kContainGeneralNormal());
focusBrush = parseDTColor(option ? option->rect : QRect(), m_dtconfig->kContainGeneralNormal());
disableBrush = parseDTColor(option ? option->rect : QRect(), m_dtconfig->kContainGeneralNormal());
defaultPen = QPen(parseDTColor(option ? option->rect : QRect(), m_dtconfig->highLightActive()).color(), parseDTColor(option ? option->rect : QRect(), m_dtconfig->highLightActive()).color().alpha() == 0 ? 0 : m_dtconfig->focusline(), Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
hoverPen = QPen(parseDTColor(option ? option->rect : QRect(), m_dtconfig->highLightActive()).color(), parseDTColor(option ? option->rect : QRect(), m_dtconfig->highLightActive()).color().alpha() == 0 ? 0 : m_dtconfig->focusline(), Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
focusPen = QPen(parseDTColor(option ? option->rect : QRect(), m_dtconfig->highLightActive()).color(), m_adjustColorRules == 0 ? 2 : 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
disablePen = QPen(parseDTColor(option ? option->rect : QRect(), m_dtconfig->highLightActive()).color(), parseDTColor(option ? option->rect : QRect(), m_dtconfig->highLightActive()).color().alpha() == 0 ? 0 : m_dtconfig->focusline(), Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
}
}
auto *w = const_cast<QWidget *>(widget);
@ -1777,14 +1781,14 @@ void UKUIConfigStyleParameters::initConfigSpinBoxParameters(bool isDark, const Q
if (isHorizonLayout)
hoverPen.setWidth(m_adjustColorRules == 0 ? 2 : 1);
if(spinBoxColorCfg.hoverType == Obj_Gradient_Type) {
if(m_dtconfig->kComponentHover().colorType() == Qt::LinearGradientPattern) {
QColor startColor;
QColor endColor;
QLinearGradient linearGradient;
linearGradient.setStart(!option ? QPoint(0, 0) : option->rect.topLeft());
linearGradient.setFinalStop(!option ? QPoint(0, 0) : option->rect.bottomLeft());
startColor = spinBoxColorCfg.hoverGradientList.value(0);
endColor = spinBoxColorCfg.hoverGradientList.value(1);
startColor = m_dtconfig->kComponentHover().mixStartColor();
endColor = m_dtconfig->kComponentHover().mixEndColor();
linearGradient.setColorAt(0, startColor);
linearGradient.setColorAt(1, endColor);
@ -1812,15 +1816,15 @@ void UKUIConfigStyleParameters::initConfigSpinBoxParameters(bool isDark, const Q
switch (m_adjustColorRules) {
case AdjustColorRules::DefaultRGB:{
//up hover
if (spinBoxColorCfg.upHoverBrushType == Obj_Gradient_Type) {
startColor = spinBoxColorCfg.upHoverBrushGradientList.value(0);
endColor = spinBoxColorCfg.upHoverBrushGradientList.value(1);
if (m_dtconfig->kComponentHover().colorType() == Qt::LinearGradientPattern) {
startColor = m_dtconfig->kComponentHover().mixStartColor();
endColor = m_dtconfig->kComponentHover().mixEndColor();
upLinearGradient.setColorAt(0, startColor);
upLinearGradient.setColorAt(1, endColor);
upHoverBrush = QBrush(upLinearGradient);
startColor = spinBoxColorCfg.downHoverBrushGradientList.value(0);
endColor = spinBoxColorCfg.downHoverBrushGradientList.value(1);
startColor = m_dtconfig->kComponentHover().mixStartColor();
endColor = m_dtconfig->kComponentHover().mixEndColor();
downLinearGradient.setColorAt(0, startColor);
downLinearGradient.setColorAt(1, endColor);
downHoverBrush = QBrush(downLinearGradient);
@ -1828,13 +1832,13 @@ void UKUIConfigStyleParameters::initConfigSpinBoxParameters(bool isDark, const Q
//up focus hover
if(!isHorizonLayout){
if (spinBoxColorCfg.upFocusHoverBrushType == Obj_Color_Type) {
if (m_dtconfig->kComponentClick().colorType() == Qt::SolidPattern) {
if (isDark) {
upFocusHoverBrush = QBrush(configMixColor(highlight, mix, 0.2));
} else {
upFocusHoverBrush = QBrush(configMixColor(highlight, mix, 0.05));
}
} else if (spinBoxColorCfg.upFocusHoverBrushType == Obj_Gradient_Type) {
} else if (m_dtconfig->kComponentClick().colorType() == Qt::LinearGradientPattern) {
if (isDark) {
startColor = configMixColor(highlight, QColor(Qt::white), 0.2);
@ -1843,20 +1847,21 @@ void UKUIConfigStyleParameters::initConfigSpinBoxParameters(bool isDark, const Q
startColor = configMixColor(highlight, QColor(Qt::black), 0.05);
endColor = configMixColor(highlight, QColor(Qt::black), 0.2);
}
startColor = m_dtconfig->kComponentClick().mixStartColor();
endColor = m_dtconfig->kComponentClick().mixEndColor();
upLinearGradient.setColorAt(0, startColor);
upLinearGradient.setColorAt(1, endColor);
upFocusHoverBrush = QBrush(upLinearGradient);
}
//down focus hover
if(spinBoxColorCfg.downFocusHoverBrushType == Obj_Color_Type) {
if(m_dtconfig->kComponentClick().colorType() == Qt::SolidPattern) {
if (isDark) {
downFocusHoverBrush = QBrush(configMixColor(highlight, mix, 0.2));
} else {
downFocusHoverBrush = QBrush(configMixColor(highlight, mix, 0.05));
}
} else if (spinBoxColorCfg.downFocusHoverBrushType == Obj_Gradient_Type) {
} else if (m_dtconfig->kComponentClick().colorType() == Qt::LinearGradientPattern) {
if (isDark) {
startColor = configMixColor(highlight, QColor(Qt::white), 0.2);
endColor = configMixColor(highlight, QColor(Qt::white), 0.05);
@ -1864,7 +1869,8 @@ void UKUIConfigStyleParameters::initConfigSpinBoxParameters(bool isDark, const Q
startColor = configMixColor(highlight, QColor(Qt::black), 0.05);
endColor = configMixColor(highlight, QColor(Qt::black), 0.2);
}
startColor = m_dtconfig->kComponentClick().mixStartColor();
endColor = m_dtconfig->kComponentClick().mixEndColor();
downLinearGradient.setColorAt(0, startColor);
downLinearGradient.setColorAt(1, endColor);
downFocusHoverBrush = QBrush(downLinearGradient);
@ -2295,15 +2301,15 @@ void UKUIConfigStyleParameters::initConfigListParameters(bool isDark, const QSty
switch (m_adjustColorRules) {
case AdjustColorRules::DefaultRGB:
//hover
if (listViewColorCfg.hoverType == Obj_Gradient_Type) {
if (m_dtconfig->kContainHover().colorType() == Qt::LinearGradientPattern) {
QColor startColor;
QColor endColor;
QLinearGradient linearGradient;
linearGradient.setStart(!option ? QPoint(0,0) : option->rect.topLeft());
linearGradient.setFinalStop(!option ? QPoint(0,0) : option->rect.bottomLeft());
startColor = listViewColorCfg.hoverGradientList.value(0);
endColor = listViewColorCfg.hoverGradientList.value(1);
startColor = m_dtconfig->kContainHover().mixStartColor();
endColor = m_dtconfig->kContainHover().mixEndColor();
linearGradient.setColorAt(0, startColor);
linearGradient.setColorAt(1, endColor);
hoverBrush = QBrush(linearGradient);
@ -2432,7 +2438,7 @@ void UKUIConfigStyleParameters::getHighlightModeConfigListParameters(ConfigListP
void UKUIConfigStyleParameters::initConfigTreeParameters(bool isDark, const QStyleOption *option, const QWidget *widget, bool highlight)
{
int radius = (widget && widget->property("normalRadius").isValid()) ?
widget->property("normalRadius").toInt() : m_radiusStruct.normalRadius;
widget->property("normalRadius").toInt() : m_dtconfig->kradiusNormal();
bool highlightMode = highlight;
if (widget && widget->property("highlightMode").isValid()) {
@ -2443,18 +2449,19 @@ void UKUIConfigStyleParameters::initConfigTreeParameters(bool isDark, const QSty
UKUIColorTheme::TreeViewColorCfg treeViewColorCfg = readCfg()->treeViewColorCfg(palette,
highlightMode ? C_TreeView_HighLight : C_TreeView_Default);
QBrush defaultBrush = treeViewColorCfg.defaultBrush;
QBrush hoverBrush = treeViewColorCfg.hoverBrush;
QBrush selectBrush = treeViewColorCfg.selectBrush;
QBrush disableBrush = treeViewColorCfg.disableBrush;
QPen textHoverPen = QPen(treeViewColorCfg.textHoverPen, 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
QPen textSelectPen = QPen(treeViewColorCfg.textSelectPen, 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
QPen textDisablePen = QPen(treeViewColorCfg.textDisablePen, 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
QPen hoverPen = QPen(treeViewColorCfg.hoverPen, (treeViewColorCfg.hoverPen == Qt::NoPen || treeViewColorCfg.hoverPen.alpha() == 0)
QBrush defaultBrush = parseDTColor(option ? option->rect : QRect(), m_dtconfig->baseActive());
QBrush hoverBrush = parseDTColor(option ? option->rect : QRect(), m_dtconfig->kContainHover());
QBrush selectBrush = parseDTColor(option ? option->rect : QRect(), m_dtconfig->kContainClick());
QBrush disableBrush = parseDTColor(option ? option->rect : QRect(), m_dtconfig->baseActive());
QPen textHoverPen = QPen(parseDTColor(option ? option->rect : QRect(), m_dtconfig->kFontPrimary()).color(), 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
QPen textSelectPen = QPen(parseDTColor(option ? option->rect : QRect(), m_dtconfig->kFontPrimary()).color(), 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
QPen textDisablePen = QPen(parseDTColor(option ? option->rect : QRect(),m_dtconfig->kFontSecondaryDisable()).color(), 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
QPen hoverPen = QPen(parseDTColor(option ? option->rect : QRect(),m_dtconfig->kContainHover()).color(), (parseDTColor(option ? option->rect : QRect(),m_dtconfig->kContainHover()).color() == Qt::NoPen || parseDTColor(option ? option->rect : QRect(),m_dtconfig->kContainHover()).color().alpha() == 0)
? 0 : 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
QPen selectPen = QPen(treeViewColorCfg.selectPen, (treeViewColorCfg.selectPen == Qt::NoPen || treeViewColorCfg.selectPen.alpha() == 0)
? 0 : 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
QPen focusPen = QPen(treeViewColorCfg.focusPen, (treeViewColorCfg.focusPen == Qt::NoPen || treeViewColorCfg.focusPen.alpha() == 0)
QPen focusPen = QPen(parseDTColor(option ? option->rect : QRect(),m_dtconfig->kLineBrandNormal()).color(), (parseDTColor(option ? option->rect : QRect(),m_dtconfig->kLineBrandNormal()).color() == Qt::NoPen || parseDTColor(option ? option->rect : QRect(),m_dtconfig->kLineBrandNormal()).color().alpha() == 0)
? 0 : 2, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
QBrush branchDefaultBrush = treeViewColorCfg.branchDefaultBrush;
@ -2466,14 +2473,14 @@ void UKUIConfigStyleParameters::initConfigTreeParameters(bool isDark, const QSty
switch (m_adjustColorRules) {
case AdjustColorRules::DefaultRGB:{
//hover
if (treeViewColorCfg.hoverType == Obj_Gradient_Type) {
if (m_dtconfig->kContainHover().colorType() == Qt::LinearGradientPattern) {
QLinearGradient linearGradient;
QColor startColor;
QColor endColor;
linearGradient.setStart(!option ? QPoint(0,0) : option->rect.topLeft());
linearGradient.setFinalStop(!option ? QPoint(0,0) : option->rect.bottomLeft());
startColor = treeViewColorCfg.hoverGradientList.value(0);
endColor = treeViewColorCfg.hoverGradientList.value(1);
startColor = m_dtconfig->kContainHover().mixStartColor();
endColor = m_dtconfig->kContainHover().mixEndColor();
linearGradient.setColorAt(0, startColor);
linearGradient.setColorAt(1, endColor);
hoverBrush = QBrush(linearGradient);
@ -2667,14 +2674,14 @@ void UKUIConfigStyleParameters::initConfigTableParameters(bool isDark, const QSt
switch (m_adjustColorRules) {
case AdjustColorRules::DefaultRGB:{
if(tableColorCfg.hoverType == Obj_Gradient_Type) {
if(m_dtconfig->kComponentHover().colorType() == Qt::LinearGradientPattern) {
QLinearGradient linearGradient;
linearGradient.setStart(!option ? QPoint(0,0) : option->rect.topLeft());
linearGradient.setFinalStop(!option ? QPoint(0,0) : option->rect.bottomLeft());
QColor startColor;
QColor endColor;
startColor = tableColorCfg.hoverGradientList.value(0);
endColor = tableColorCfg.hoverGradientList.value(1);
startColor = m_dtconfig->kComponentHover().mixStartColor();
endColor = m_dtconfig->kComponentHover().mixEndColor();
linearGradient.setColorAt(0, startColor);
linearGradient.setColorAt(1, endColor);
hoverBrush = QBrush(linearGradient);
@ -2818,7 +2825,7 @@ void UKUIConfigStyleParameters::initConfigCheckBoxParameters(bool isDark, const
QPen defaultPen = QPen(parseDTColor(option ? option->rect : QRect(), m_dtconfig->kLineNormal()), 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
QPen hoverPen = QPen(parseDTColor(option ? option->rect : QRect(), m_dtconfig->kLineNormal()), 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
QPen clickPen = QPen(parseDTColor(option ? option->rect : QRect(), m_dtconfig->kLineNormal()), 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
QPen disablePen = QPen(parseDTColor(option ? option->rect : QRect(), m_dtconfig->kLineNormal()), 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
QPen disablePen = QPen(parseDTColor(option ? option->rect : QRect(), m_dtconfig->kLineDisable()), 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
QPen onDefaultPen = QPen(parseDTColor(option ? option->rect : QRect(), m_dtconfig->kLineNormal()), 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
QPen onHoverPen = QPen(parseDTColor(option ? option->rect : QRect(), m_dtconfig->kLineNormal()), 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
QPen onClickPen = QPen(parseDTColor(option ? option->rect : QRect(), m_dtconfig->kLineNormal()), 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
@ -2840,23 +2847,23 @@ void UKUIConfigStyleParameters::initConfigCheckBoxParameters(bool isDark, const
switch (m_adjustColorRules) {
case AdjustColorRules::DefaultRGB:{
if (checkboxColorCfg.hoverType == Obj_Gradient_Type) {
if (m_dtconfig->kComponentHover().colorType() == Qt::LinearGradientPattern) {
QColor startColor;
QColor endColor;
QLinearGradient linearGradient;
linearGradient.setStart(!option ? QPoint(0,0) : option->rect.topLeft());
linearGradient.setFinalStop(!option ? QPoint(0,0) : option->rect.bottomLeft());
startColor = checkboxColorCfg.hoverGradientList.value(0);
endColor = checkboxColorCfg.hoverGradientList.value(1);
startColor = m_dtconfig->kComponentHover().mixStartColor();
endColor = m_dtconfig->kComponentHover().mixEndColor();
linearGradient.setColorAt(0, startColor);
linearGradient.setColorAt(1, endColor);
hoverBrush = QBrush(linearGradient);
}
if(checkboxColorCfg.onHoverType == Obj_Color_Type){
if(m_dtconfig->kBrandHover().colorType() == Qt::SolidPattern){
onHoverBrush = QBrush(configMixColor(onDefaultBrush.color(), mix, isDark? 0.2 : 0.05));
onClickBrush = QBrush(configMixColor(onDefaultBrush.color(), mix, isDark ? 0.05 : 0.2));
} else if (checkboxColorCfg.onHoverType == Obj_Gradient_Type) {
} else if (m_dtconfig->kBrandHover().colorType() == Qt::LinearGradientPattern) {
//on default
QColor DefaultPenColor = palette.color(QPalette::Active, QPalette::Highlight);
QColor onDefaultPenColor = configMixColor(DefaultPenColor, mix, 0.1);
@ -2873,6 +2880,7 @@ void UKUIConfigStyleParameters::initConfigCheckBoxParameters(bool isDark, const
onHoverPen = QPen(QBrush(onHoverPenColor), 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
QColor startColor;
QColor endColor;
QLinearGradient linearGradient;
linearGradient.setStart(!option ? QPoint(0,0) : option->rect.topLeft());
linearGradient.setFinalStop(!option ? QPoint(0,0) : option->rect.bottomLeft());
@ -2883,6 +2891,9 @@ void UKUIConfigStyleParameters::initConfigCheckBoxParameters(bool isDark, const
startColor = configMixColor(onDefaultBrush.color(), QColor(Qt::white), 0.05);
endColor = configMixColor(onDefaultBrush.color(), QColor(Qt::black), 0.2);
}
startColor = m_dtconfig->kBrandHover().mixStartColor();
endColor = m_dtconfig->kBrandHover().mixEndColor();
linearGradient.setColorAt(0, startColor);
linearGradient.setColorAt(1, endColor);
onHoverBrush = QBrush(linearGradient);
@ -2908,8 +2919,8 @@ void UKUIConfigStyleParameters::initConfigCheckBoxParameters(bool isDark, const
case AdjustColorRules::HSL:{
normalButtonColor(isDark, palette, defaultPen, defaultBrush, hoverPen, hoverBrush,
clickPen, clickBrush, disablePen, disableBrush);
defaultPen = QPen(checkboxColorCfg.defaultPen, 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
disablePen = QPen(checkboxColorCfg.disablePen, 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
defaultPen = QPen(parseDTColor(option ? option->rect : QRect(), m_dtconfig->kLineNormal()), 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
disablePen = QPen(parseDTColor(option ? option->rect : QRect(), m_dtconfig->kLineDisable()), 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
//on default
@ -3079,8 +3090,8 @@ void UKUIConfigStyleParameters::initConfigRadioButtonParameters(bool isDark, con
QPen onClickPen = QPen(parseDTColor(option ? option->rect : QRect(), m_dtconfig->kLineNormal()), 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
QBrush defaultBrush = parseDTColor(option ? option->rect : QRect(), m_dtconfig->buttonActive());
QBrush hoverBrush = parseDTColor(option ? option->rect : QRect(), m_dtconfig->kComponentClick());
QBrush clickBrush = parseDTColor(option ? option->rect : QRect(), m_dtconfig->kComponentHover());
QBrush hoverBrush = parseDTColor(option ? option->rect : QRect(), m_dtconfig->kComponentHover());
QBrush clickBrush = parseDTColor(option ? option->rect : QRect(), m_dtconfig->kComponentClick());
QBrush disableBrush = parseDTColor(option ? option->rect : QRect(), m_dtconfig->buttonDisable());
QBrush onDefaultBrush = parseDTColor(option ? option->rect : QRect(), m_dtconfig->highLightActive());
QBrush onClickBrush = parseDTColor(option ? option->rect : QRect(), m_dtconfig->kBrandClick());
@ -3090,12 +3101,12 @@ void UKUIConfigStyleParameters::initConfigRadioButtonParameters(bool isDark, con
QBrush childrenOnDisableBrush = QBrush(QColor(179, 179, 179));
QBrush onHoverBrush = parseDTColor(option ? option->rect : QRect(), m_dtconfig->kBrandHover());
if (radioButtonColorCfg.onHoverType == Obj_Gradient_Type) {
if (m_dtconfig->kBrandHover().colorType() == Qt::LinearGradientPattern) {
QLinearGradient linearGradient;
linearGradient.setStart(!option ? QPoint(0,0) : option->rect.topLeft());
linearGradient.setFinalStop(!option ? QPoint(0,0) : option->rect.bottomLeft());
linearGradient.setColorAt(0, radioButtonColorCfg.onHoverGradientList.value(0));
linearGradient.setColorAt(1, radioButtonColorCfg.onHoverGradientList.value(1));
linearGradient.setColorAt(0, m_dtconfig->kBrandHover().mixStartColor());
linearGradient.setColorAt(1, m_dtconfig->kBrandHover().mixEndColor());
onHoverBrush = QBrush(linearGradient);
}
@ -3124,7 +3135,7 @@ void UKUIConfigStyleParameters::initConfigRadioButtonParameters(bool isDark, con
// }
onHoverPen = onDefaultPen;
if (radioButtonColorCfg.onHoverType == Obj_Color_Type) {
if (m_dtconfig->kBrandHover().colorType() == Qt::SolidPattern) {
//on hover
if (isDark) {
onHoverBrush = QBrush(configMixColor(onDefaultBrush.color(), mix, 0.2));
@ -3133,7 +3144,7 @@ void UKUIConfigStyleParameters::initConfigRadioButtonParameters(bool isDark, con
}
//disable
// disablePen = defaultPen;
} else if (radioButtonColorCfg.onHoverType == Obj_Gradient_Type) {
} else if (m_dtconfig->kBrandHover().colorType() == Qt::LinearGradientPattern) {
QColor startColor;
QColor endColor;
QLinearGradient linearGradient;
@ -3146,6 +3157,8 @@ void UKUIConfigStyleParameters::initConfigRadioButtonParameters(bool isDark, con
startColor = configMixColor(onDefaultBrush.color(), QColor(Qt::white), 0.05);
endColor = configMixColor(onDefaultBrush.color(), QColor(Qt::black), 0.2);
}
startColor = m_dtconfig->kBrandHover().mixStartColor();
endColor = m_dtconfig->kBrandHover().mixEndColor();
linearGradient.setColorAt(0, startColor);
linearGradient.setColorAt(1, endColor);
onHoverBrush = QBrush(linearGradient);
@ -3338,18 +3351,18 @@ void UKUIConfigStyleParameters::initConfigSliderParameters(bool isDark, const QS
QBrush grooveUnvalueHoverBrush = parseDTColor(option ? option->rect : QRect(), m_dtconfig->midlightDisable());
QBrush grooveUnvalueDisableBrush = parseDTColor(option ? option->rect : QRect(), m_dtconfig->midlightDisable());
QPen handleDefaultPen = QPen(parseDTColor(option ? option->rect : QRect(), m_dtconfig->kLineBrandNormal()) , (sliderColorCfg.handleDefaultPen.alpha() == 0 ||
sliderColorCfg.handleDefaultPen == Qt::NoPen) ? 0 : 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
QPen handleHoverPen = QPen(parseDTColor(option ? option->rect : QRect(), m_dtconfig->kLineBrandNormal()) , (sliderColorCfg.handleHoverPen.alpha() == 0 ||
sliderColorCfg.handleHoverPen == Qt::NoPen) ? 0 : 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
QPen handleClickPen = QPen(parseDTColor(option ? option->rect : QRect(), m_dtconfig->kLineBrandNormal()) , (sliderColorCfg.handleClickPen.alpha() == 0 ||
sliderColorCfg.handleClickPen == Qt::NoPen) ? 0 : 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
QPen handleDisablePen = QPen(parseDTColor(option ? option->rect : QRect(), m_dtconfig->kLineBrandDisable()) , (sliderColorCfg.handleDisablePen.alpha() == 0 ||
sliderColorCfg.handleDisablePen == Qt::NoPen) ? 0 : 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
QPen sliderGroovePen = QPen(sliderColorCfg.sliderGroovePen , (sliderColorCfg.sliderGroovePen.alpha() == 0 ||
sliderColorCfg.sliderGroovePen == Qt::NoPen) ? 0 : 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
QPen focusPen = QPen(parseDTColor(option ? option->rect : QRect(), m_dtconfig->kLineBrandNormal()) , (sliderColorCfg.focusPen.alpha() == 0 ||
sliderColorCfg.focusPen == Qt::NoPen) ? 0 : 2, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
QPen handleDefaultPen = QPen(parseDTColor(option ? option->rect : QRect(), m_dtconfig->kLineBrandNormal()).color() , (parseDTColor(option ? option->rect : QRect(), m_dtconfig->kLineBrandNormal()).color().alpha() == 0 ||
parseDTColor(option ? option->rect : QRect(), m_dtconfig->kLineBrandNormal()).color() == Qt::NoPen) ? 0 : 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
QPen handleHoverPen = QPen(parseDTColor(option ? option->rect : QRect(), m_dtconfig->kLineBrandNormal()).color() , (parseDTColor(option ? option->rect : QRect(), m_dtconfig->kLineBrandNormal()).color().alpha() == 0 ||
parseDTColor(option ? option->rect : QRect(), m_dtconfig->kLineBrandNormal()).color() == Qt::NoPen) ? 0 : 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
QPen handleClickPen = QPen(parseDTColor(option ? option->rect : QRect(), m_dtconfig->kLineBrandNormal()).color() , (parseDTColor(option ? option->rect : QRect(), m_dtconfig->kLineBrandNormal()).color().alpha() == 0 ||
parseDTColor(option ? option->rect : QRect(), m_dtconfig->kLineBrandNormal()).color() == Qt::NoPen) ? 0 : 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
QPen handleDisablePen = QPen(parseDTColor(option ? option->rect : QRect(), m_dtconfig->kLineBrandDisable()).color() , (parseDTColor(option ? option->rect : QRect(), m_dtconfig->kLineBrandDisable()).color().alpha() == 0 ||
parseDTColor(option ? option->rect : QRect(), m_dtconfig->kLineBrandDisable()).color() == Qt::NoPen) ? 0 : 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
QPen sliderGroovePen = QPen(parseDTColor(option ? option->rect : QRect(), m_dtconfig->kLineComponentNormal()).color() , (parseDTColor(option ? option->rect : QRect(), m_dtconfig->kLineComponentNormal()).color().alpha() == 0 ||
parseDTColor(option ? option->rect : QRect(), m_dtconfig->kLineComponentNormal()).color() == Qt::NoPen) ? 0 : 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
QPen focusPen = QPen(parseDTColor(option ? option->rect : QRect(), m_dtconfig->kLineBrandNormal()).color() , (parseDTColor(option ? option->rect : QRect(), m_dtconfig->kLineBrandNormal()).color() .alpha() == 0 ||
parseDTColor(option ? option->rect : QRect(), m_dtconfig->kLineBrandNormal()).color() == Qt::NoPen) ? 0 : 2, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
QPainterPath handlePath;
int radius = (widget && widget->property("normalRadius").isValid()) ?
@ -3366,17 +3379,19 @@ void UKUIConfigStyleParameters::initConfigSliderParameters(bool isDark, const QS
QColor highlight = palette.color(QPalette::Active, QPalette::Highlight);
QColor mix = palette.color(QPalette::Active, QPalette::BrightText);
if (sliderColorCfg.handleHoverType == Obj_Color_Type) {
if (m_dtconfig->kBrandHover().colorType() == Qt::SolidPattern) {
//handle hover
if (isDark) {
handleHoverBrush = QBrush(configMixColor(highlight, mix, 0.2));
} else {
handleHoverBrush = QBrush(configMixColor(highlight, mix, 0.05));
}
} else if (sliderColorCfg.handleHoverType == Obj_Gradient_Type) {
} else if (m_dtconfig->kBrandHover().colorType() == Qt::LinearGradientPattern) {
//handle hover
QColor startColor;
QColor endColor;
startColor = m_dtconfig->kBrandHover().mixStartColor();
endColor = m_dtconfig->kBrandHover().mixEndColor();
QLinearGradient linearGradient;
if (!horizontal) {
linearGradient.setStart(!option ? QPoint(0,0) : option->rect.topRight());
@ -3717,10 +3732,17 @@ void UKUIConfigStyleParameters::initConfigProgressBarParameters(bool isDark, con
m_ProgressBarParameters.progressBarGrooveDisablePen = grooveDisablePen;
m_ProgressBarParameters.progressBarContentBrush = QBrush(QColor(0,200,0));
m_ProgressBarParameters.progressBarGrooveDefaultBrush = grooveDefaultBrush;
m_ProgressBarParameters.progressBarGrooveDisableBrush = grooveDisableBrush;
m_ProgressBarParameters.progressBarGrooveDefaultBrush = QBrush(QColor(255,200,0));
m_ProgressBarParameters.progressBarGrooveDisableBrush = QBrush(QColor(255,0,200));
m_ProgressBarParameters.progressBarContentHightColor = QColor(0,0,0);
m_ProgressBarParameters.progressBarContentMidLightColor = startColor;
m_ProgressBarParameters.progressBarContentBrush = contentBrush;
m_ProgressBarParameters.progressBarGrooveDefaultBrush = grooveDefaultBrush;
m_ProgressBarParameters.progressBarGrooveDisableBrush = grooveDisableBrush;
m_ProgressBarParameters.progressBarContentHightColor = endColor;
m_ProgressBarParameters.progressBarContentMidLightColor = startColor;
}
void UKUIConfigStyleParameters::getDefaultProgressBarParameters(ConfigProgressBarParameters *p, bool isDark)
@ -3750,7 +3772,7 @@ void UKUIConfigStyleParameters::initConfigScrollBarParameters(bool isDark, const
needTranslucent ? C_ScrollBar_Translucent : C_ScrollBar_Default);
QBrush grooveDefaultBrush = parseDTColor(option ? option->rect : QRect(), m_dtconfig->kContainGeneralNormal());
QBrush grooveInactiveBrush = scrollBarColorCfg.grooveInactiveBrush;
QBrush grooveInactiveBrush = parseDTColor(option ? option->rect : QRect(), m_dtconfig->kContainGeneralNormal());
QBrush sliderDefaultBrush = parseDTColor(option ? option->rect : QRect(), m_dtconfig->kGray6());
QBrush sliderHoverBrush = parseDTColor(option ? option->rect : QRect(), m_dtconfig->kContainHover());
QBrush sliderClickBrush = parseDTColor(option ? option->rect : QRect(), m_dtconfig->kContainClick());
@ -3789,7 +3811,7 @@ void UKUIConfigStyleParameters::initConfigScrollBarParameters(bool isDark, const
switch (m_adjustColorRules) {
case AdjustColorRules::DefaultRGB:
if (!needTranslucent) {
if (scrollBarColorCfg.sliderHoverType == Obj_Gradient_Type) {
if (m_dtconfig->kContainHover().colorType() == Qt::LinearGradientPattern) {
if (bar && bar->orientation == Qt::Horizontal) {
linearGradient.setStart(!option ? QPoint(0,0) : option->rect.topLeft());
linearGradient.setFinalStop(!option ? QPoint(0,0) : option->rect.bottomLeft());
@ -3797,9 +3819,8 @@ void UKUIConfigStyleParameters::initConfigScrollBarParameters(bool isDark, const
linearGradient.setStart(!option ? QPoint(0,0) : option->rect.topRight());
linearGradient.setFinalStop(!option ? QPoint(0,0) : option->rect.topLeft());
}
startColor = scrollBarColorCfg.sliderHoverGradientList.value(0);
endColor = scrollBarColorCfg.sliderHoverGradientList.value(1);
startColor = m_dtconfig->kContainHover().mixStartColor();
endColor = m_dtconfig->kContainHover().mixEndColor();
linearGradient.setColorAt(0, startColor);
linearGradient.setColorAt(1, endColor);
sliderHoverBrush = QBrush(linearGradient);
@ -3946,7 +3967,7 @@ void UKUIConfigStyleParameters::initConfigTabWidgetParameters(bool isDark, const
UKUIColorTheme::TabWidgetColorCfg tabWidgetColorCfg = readCfg()->tabWidgetColorCfg(palette, C_TabWidget_Default);
QBrush widgetBackgroundBrush = parseDTColor(option ? option->rect : QRect(), m_dtconfig->baseActive());
QBrush tabBarBackgroundBrush = tabWidgetColorCfg.tabBarBackgroundBrush;
QBrush tabBarBackgroundBrush = parseDTColor(option ? option->rect : QRect(), m_dtconfig->kContainGeneralNormal());
QBrush tabBarDefaultBrush = parseDTColor(option ? option->rect : QRect(), m_dtconfig->kContainGeneralNormal());
QBrush tabBarHoverBrush = parseDTColor(option ? option->rect : QRect(), m_dtconfig->kContainHover());
QBrush tabBarSelectBrush = parseDTColor(option ? option->rect : QRect(), m_dtconfig->kContainGeneralNormal());
@ -3967,15 +3988,15 @@ void UKUIConfigStyleParameters::initConfigTabWidgetParameters(bool isDark, const
switch (m_adjustColorRules) {
case AdjustColorRules::DefaultRGB:
if (tabWidgetColorCfg.tabBarHoverType == Obj_Gradient_Type) {
if (m_dtconfig->kContainHover().colorType() == Qt::LinearGradientPattern) {
//tabbar hover
QColor startColor;
QColor endColor;
QLinearGradient linearGradient;
linearGradient.setStart(!option ? QPoint(0,0) : option->rect.topLeft());
linearGradient.setFinalStop(!option ? QPoint(0,0) : option->rect.bottomLeft());
startColor = tabWidgetColorCfg.tabBarHoverGradientList.value(0);
endColor = tabWidgetColorCfg.tabBarHoverGradientList.value(1);
startColor = m_dtconfig->kContainHover().mixStartColor();
endColor = m_dtconfig->kContainHover().mixEndColor();
linearGradient.setColorAt(0, startColor);
linearGradient.setColorAt(1, endColor);
tabBarHoverBrush = QBrush(linearGradient);
@ -4070,7 +4091,7 @@ void UKUIConfigStyleParameters::initConfigTabWidgetParameters(bool isDark, const
m_TabWidgetParameters.radius = tabradius;
m_TabWidgetParameters.tabWidgetBackgroundBrush = widgetBackgroundBrush;
m_TabWidgetParameters.tabBarBackgroundBrush = tabBarBackgroundBrush;
m_TabWidgetParameters.tabBarBackgroundBrush = QBrush(QColor(255,0,0));
m_TabWidgetParameters.tabBarDefaultBrush = tabBarDefaultBrush;
m_TabWidgetParameters.tabBarHoverBrush = tabBarHoverBrush;
m_TabWidgetParameters.tabBarClickBrush = tabBarClickBrush;
@ -4116,10 +4137,11 @@ void UKUIConfigStyleParameters::initConfigMenuParameters(bool isDark, const QSty
QPen menuBackgroundPen = QPen(parseDTColor(option ? option->rect : QRect(), m_dtconfig->kLineWindowAcitive()), (parseDTColor(option ? option->rect : QRect(), m_dtconfig->kLineWindowAcitive()).color().alpha() == 0 ||
parseDTColor(option ? option->rect : QRect(), m_dtconfig->kLineWindowAcitive()).color() == Qt::NoPen ) ? 0 : 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
QBrush itemSelectBrush = parseDTColor(option ? option->rect : QRect(), m_dtconfig->kComponentHover());
QPen menuHoverPen = menuColorCfg.menuTextHoverPen;
QPen menuItemFocusPen = QPen(parseDTColor(option ? option->rect : QRect(), m_dtconfig->kLineComponentHover()), (parseDTColor(option ? option->rect : QRect(), m_dtconfig->kLineComponentHover()).color().alpha() == 0 ||
parseDTColor(option ? option->rect : QRect(), m_dtconfig->kLineComponentHover()).color() == Qt::NoPen ) ? 0 : 2, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
QBrush itemSelectBrush = parseDTColor(option ? option->rect : QRect(), m_dtconfig->kComponentClick());
QPen menuHoverPen = QPen(parseDTColor(option ? option->rect : QRect(), m_dtconfig->kFontPrimary()), (parseDTColor(option ? option->rect : QRect(), m_dtconfig->kFontPrimary()).color().alpha() == 0 ||
parseDTColor(option ? option->rect : QRect(), m_dtconfig->kFontPrimary()).color() == Qt::NoPen ) ? 0 : 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
QPen menuItemFocusPen = QPen(parseDTColor(option ? option->rect : QRect(), m_dtconfig->kLineComponentClick()), (parseDTColor(option ? option->rect : QRect(), m_dtconfig->kLineComponentClick()).color().alpha() == 0 ||
parseDTColor(option ? option->rect : QRect(), m_dtconfig->kLineComponentClick()).color() == Qt::NoPen ) ? 0 : 2, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
//item select brush
switch (m_adjustColorRules) {