对外补充可获取主题框架里默认颜色相关接口

This commit is contained in:
tanjing 2023-10-26 09:47:11 +08:00 committed by xibowen
parent e500296d2d
commit 3937492844
1 changed files with 276 additions and 6 deletions

View File

@ -903,6 +903,28 @@ void UKUIConfigStyleParameters::initConfigPushButtonBevelParameters(bool isDark,
checkClickBrush = clickBrush; checkClickBrush = clickBrush;
checkDisableBrush = option->palette.brush(QPalette::Disabled, QPalette::NoRole); checkDisableBrush = option->palette.brush(QPalette::Disabled, QPalette::NoRole);
auto *w = const_cast<QWidget *>(widget);
if(w){
w->setProperty("ukui_radius", radius);
w->setProperty("ukui_defaultBrush", defaultBrush);
w->setProperty("ukui_clickBrush", clickBrush);
w->setProperty("ukui_hoverBrush", hoverBrush);
w->setProperty("ukui_disableBrush", disableBrush);
w->setProperty("ukui_checkBrush", checkBrush);
w->setProperty("ukui_checkHoverBrush", checkHoverBrush);
w->setProperty("ukui_checkClickBrush", checkClickBrush);
w->setProperty("ukui_checkDisableBrush", checkDisableBrush);
w->setProperty("ukui_defaultPen", defaultPen);
w->setProperty("ukui_clickPen", clickPen);
w->setProperty("ukui_hoverPen", hoverPen);
w->setProperty("ukui_disablePen", disablePen);
w->setProperty("ukui_checkPen", checkPen);
w->setProperty("ukui_checkHoverPen", checkHoverPen);
w->setProperty("ukui_checkClickPen", checkClickPen);
w->setProperty("ukui_checkDisablePen", checkDisablePen);
w->setProperty("ukui_focusPen", focusPen);
}
if (widget) { if (widget) {
if (widget->property("setRadius").isValid() && widget->property("setRadius").canConvert<int>()) { if (widget->property("setRadius").isValid() && widget->property("setRadius").canConvert<int>()) {
radius = widget->property("setRadius").value<int>(); radius = widget->property("setRadius").value<int>();
@ -1049,6 +1071,13 @@ void UKUIConfigStyleParameters::initConfigPushButtonLabelParameters(bool isDark,
textColor = buttonColorCfg.textHoverColor; textColor = buttonColorCfg.textHoverColor;
} }
auto *w = const_cast<QWidget *>(widget);
if(w){
w->setProperty("ukui_iconHighlight", iconHighlight);
w->setProperty("ukui_textHighlight", textHighlight);
w->setProperty("ukui_textColor", textColor);
}
if (widget) { if (widget) {
if(!widget->isEnabled()) if(!widget->isEnabled())
textColor = option->palette.color(QPalette::Disabled, QPalette::ButtonText); textColor = option->palette.color(QPalette::Disabled, QPalette::ButtonText);
@ -1307,6 +1336,28 @@ void UKUIConfigStyleParameters::initConfigToolButtonPanelParameters(bool isDark,
checkClickBrush = clickBrush; checkClickBrush = clickBrush;
checkDisableBrush = option->palette.brush(QPalette::Disabled, QPalette::NoRole); checkDisableBrush = option->palette.brush(QPalette::Disabled, QPalette::NoRole);
auto *w = const_cast<QWidget *>(widget);
if(w){
w->setProperty("ukui_radius", radius);
w->setProperty("ukui_defaultBrush", defaultBrush);
w->setProperty("ukui_clickBrush", clickBrush);
w->setProperty("ukui_hoverBrush", hoverBrush);
w->setProperty("ukui_disableBrush", disableBrush);
w->setProperty("ukui_checkBrush", checkBrush);
w->setProperty("ukui_checkHoverBrush", checkHoverBrush);
w->setProperty("ukui_checkClickBrush", checkClickBrush);
w->setProperty("ukui_checkDisableBrush", checkDisableBrush);
w->setProperty("ukui_defaultPen", defaultPen);
w->setProperty("ukui_clickPen", clickPen);
w->setProperty("ukui_hoverPen", hoverPen);
w->setProperty("ukui_disablePen", disablePen);
w->setProperty("ukui_checkPen", checkPen);
w->setProperty("ukui_checkHoverPen", checkHoverPen);
w->setProperty("ukui_checkClickPen", checkClickPen);
w->setProperty("ukui_checkDisablePen", checkDisablePen);
w->setProperty("ukui_focusPen", focusPen);
}
if (widget) { if (widget) {
if (widget->property("setRadius").isValid() && widget->property("setRadius").canConvert<int>()) { if (widget->property("setRadius").isValid() && widget->property("setRadius").canConvert<int>()) {
radius = widget->property("setRadius").value<int>(); radius = widget->property("setRadius").value<int>();
@ -1452,6 +1503,12 @@ void UKUIConfigStyleParameters::initConfigToolButtonLabelParameters(bool isDark,
textColor = buttonColorCfg.textHoverColor; textColor = buttonColorCfg.textHoverColor;
} }
auto *w = const_cast<QWidget *>(widget);
if(w){
w->setProperty("ukui_iconHighlight", iconHighlight);
w->setProperty("ukui_textHighlight", textHighlight);
w->setProperty("ukui_textColor", textColor);
}
if (widget) { if (widget) {
if(!widget->isEnabled()) if(!widget->isEnabled())
textColor = option->palette.color(QPalette::Disabled, QPalette::ButtonText); textColor = option->palette.color(QPalette::Disabled, QPalette::ButtonText);
@ -1560,6 +1617,19 @@ void UKUIConfigStyleParameters::initConfigLineEditParameters(bool isDark, const
break; break;
} }
auto *w = const_cast<QWidget *>(widget);
if(w){
w->setProperty("ukui_radius", radius);
w->setProperty("ukui_defaultBrush", defaultBrush);
w->setProperty("ukui_focusBrush", focusBrush);
w->setProperty("ukui_hoverBrush", hoverBrush);
w->setProperty("ukui_disableBrush", disableBrush);
w->setProperty("ukui_defaultPen", defaultPen);
w->setProperty("ukui_hoverPen", hoverPen);
w->setProperty("ukui_disablePen", disablePen);
w->setProperty("ukui_focusPen", focusPen);
}
if (widget) { if (widget) {
if (widget->property("setRadius").isValid() && widget->property("setRadius").canConvert<int>()) { if (widget->property("setRadius").isValid() && widget->property("setRadius").canConvert<int>()) {
radius = widget->property("setRadius").value<int>(); radius = widget->property("setRadius").value<int>();
@ -1907,6 +1977,36 @@ void UKUIConfigStyleParameters::initConfigSpinBoxParameters(bool isDark, const Q
break; break;
} }
auto *w = const_cast<QWidget *>(widget);
if(w){
w->setProperty("ukui_radius", radius);
w->setProperty("ukui_defaultBrush", defaultBrush);
w->setProperty("ukui_focusBrush", focusBrush);
w->setProperty("ukui_hoverBrush", hoverBrush);
w->setProperty("ukui_disableBrush", disableBrush);
w->setProperty("ukui_defaultPen", defaultPen);
w->setProperty("ukui_hoverPen", hoverPen);
w->setProperty("ukui_disablePen", disablePen);
w->setProperty("ukui_focusPen", focusPen);
w->setProperty("ukui_upDefaultBrush", upDefaultBrush);
w->setProperty("ukui_upFocusHoverBrush", upFocusHoverBrush);
w->setProperty("ukui_upClickBrush", upClickBrush);
w->setProperty("ukui_upHoverBrush", upHoverBrush);
w->setProperty("ukui_downDefaultBrush", downDefaultBrush);
w->setProperty("ukui_downHoverBrush", downHoverBrush);
w->setProperty("ukui_downFocusHoverBrush", downFocusHoverBrush);
w->setProperty("ukui_downClickBrush", downClickBrush);
w->setProperty("ukui_upDefaultPen", upDefaultPen);
w->setProperty("ukui_upHoverPen", upHoverPen);
w->setProperty("ukui_upFocusHoverPen", upFocusHoverPen);
w->setProperty("ukui_upClickPen", upClickPen);
w->setProperty("ukui_upDisablePen", upDisablePen);
w->setProperty("ukui_downDefaultPen", downDefaultPen);
w->setProperty("ukui_downHoverPen", downHoverPen);
w->setProperty("ukui_downFocusHoverPen", downFocusHoverPen);
w->setProperty("ukui_downClickPen", downClickPen);
w->setProperty("ukui_downDisablePen", downDisablePen);
}
if (widget) { if (widget) {
if (widget->property("setRadius").isValid() && widget->property("setRadius").canConvert<int>()) { if (widget->property("setRadius").isValid() && widget->property("setRadius").canConvert<int>()) {
radius = widget->property("setRadius").value<int>(); radius = widget->property("setRadius").value<int>();
@ -2067,6 +2167,21 @@ void UKUIConfigStyleParameters::initConfigComboBoxParameters(bool isDark, const
break; break;
} }
auto *w = const_cast<QWidget *>(widget);
if(w){
w->setProperty("ukui_radius", radius);
w->setProperty("ukui_defaultBrush", defaultBrush);
w->setProperty("ukui_onBrush", onBrush);
w->setProperty("ukui_hoverBrush", hoverBrush);
w->setProperty("ukui_disableBrush", disableBrush);
w->setProperty("ukui_editBrush", editBrush);
w->setProperty("ukui_defaultPen", defaultPen);
w->setProperty("ukui_hoverPen", hoverPen);
w->setProperty("ukui_disablePen", disablePen);
w->setProperty("ukui_onPen", onPen);
w->setProperty("ukui_editPen", editPen);
}
if (widget) { if (widget) {
if (widget->property("setRadius").isValid() && widget->property("setRadius").canConvert<int>()) { if (widget->property("setRadius").isValid() && widget->property("setRadius").canConvert<int>()) {
radius = widget->property("setRadius").value<int>(); radius = widget->property("setRadius").value<int>();
@ -2219,6 +2334,18 @@ void UKUIConfigStyleParameters::initConfigListParameters(bool isDark, const QSty
break; break;
} }
auto *w = const_cast<QWidget *>(widget);
if(w){
w->setProperty("ukui_radius", radius);
w->setProperty("ukui_defaultBrush", defaultBrush);
w->setProperty("ukui_hoverBrush", hoverBrush);
w->setProperty("ukui_disableBrush", disableBrush);
w->setProperty("ukui_selectBrush", selectBrush);
w->setProperty("ukui_textHoverPen", textHoverPen);
w->setProperty("ukui_textSelectPen", textSelectPen);
w->setProperty("ukui_hoverPen", hoverPen);
w->setProperty("ukui_selectPen", selectPen);
}
if (widget) { if (widget) {
if (widget->property("setRadius").isValid() && widget->property("setRadius").canConvert<int>()) { if (widget->property("setRadius").isValid() && widget->property("setRadius").canConvert<int>()) {
radius = widget->property("setRadius").value<int>(); radius = widget->property("setRadius").value<int>();
@ -2346,8 +2473,23 @@ void UKUIConfigStyleParameters::initConfigTreeParameters(bool isDark, const QSty
branchSelectBrush = selectBrush; branchSelectBrush = selectBrush;
branchDisableBrush = disableBrush; branchDisableBrush = disableBrush;
auto *w = const_cast<QWidget *>(widget);
if(w){
w->setProperty("ukui_radius", radius);
w->setProperty("ukui_defaultBrush", defaultBrush);
w->setProperty("ukui_hoverBrush", hoverBrush);
w->setProperty("ukui_disableBrush", disableBrush);
w->setProperty("ukui_selectBrush", selectBrush);
w->setProperty("ukui_branchDefaultBrush", branchDefaultBrush);
w->setProperty("ukui_branchHoverBrush", branchHoverBrush);
w->setProperty("ukui_branchSelectBrush", branchSelectBrush);
w->setProperty("ukui_branchDisableBrush", branchDisableBrush);
w->setProperty("ukui_textHoverPen", textHoverPen);
w->setProperty("ukui_textSelectPen", textSelectPen);
w->setProperty("ukui_hoverPen", hoverPen);
w->setProperty("ukui_selectPen", selectPen);
}
if (widget) { if (widget) {
if (widget->property("setRadius").isValid() && widget->property("setRadius").canConvert<int>()) { if (widget->property("setRadius").isValid() && widget->property("setRadius").canConvert<int>()) {
radius = widget->property("setRadius").value<int>(); radius = widget->property("setRadius").value<int>();
} }
@ -2478,6 +2620,19 @@ void UKUIConfigStyleParameters::initConfigTableParameters(bool isDark, const QSt
default: default:
break; break;
} }
auto *w = const_cast<QWidget *>(widget);
if(w){
w->setProperty("ukui_radius", radius);
w->setProperty("ukui_defaultBrush", defaultBrush);
w->setProperty("ukui_hoverBrush", hoverBrush);
w->setProperty("ukui_disableBrush", disableBrush);
w->setProperty("ukui_selectBrush", selectBrush);
w->setProperty("ukui_textHoverPen", textHoverPen);
w->setProperty("ukui_textSelectPen", textSelectPen);
w->setProperty("ukui_hoverPen", hoverPen);
w->setProperty("ukui_selectPen", selectPen);
}
if (widget) { if (widget) {
if (widget->property("setRadius").isValid() && widget->property("setRadius").canConvert<int>()) { if (widget->property("setRadius").isValid() && widget->property("setRadius").canConvert<int>()) {
radius = widget->property("setRadius").value<int>(); radius = widget->property("setRadius").value<int>();
@ -2715,6 +2870,29 @@ void UKUIConfigStyleParameters::initConfigCheckBoxParameters(bool isDark, const
break; break;
} }
auto *w = const_cast<QWidget *>(widget);
if(w){
w->setProperty("ukui_radius", radius);
w->setProperty("ukui_defaultBrush", defaultBrush);
w->setProperty("ukui_hoverBrush", hoverBrush);
w->setProperty("ukui_clickBrush", clickBrush);
w->setProperty("ukui_disableBrush", disableBrush);
w->setProperty("ukui_onDefaultBrush", onDefaultBrush);
w->setProperty("ukui_onHoverBrush", onHoverBrush);
w->setProperty("ukui_onClickBrush", onClickBrush);
w->setProperty("ukui_pathDisableBrush", pathDisableBrush);
w->setProperty("ukui_pathBrush", pathBrush);
w->setProperty("ukui_contentPen", contentPen);
w->setProperty("ukui_defaultPen", defaultPen);
w->setProperty("ukui_disablePen", disablePen);
w->setProperty("ukui_hoverPen", hoverPen);
w->setProperty("ukui_clickPen", clickPen);
w->setProperty("ukui_onDefaultPen", onDefaultPen);
w->setProperty("ukui_onHoverPen", onHoverPen);
w->setProperty("ukui_onClickPen", onClickPen);
w->setProperty("ukui_onHoverBrushIslinearGradient", onHoverBrushIslinearGradient);
}
if (widget) { if (widget) {
if (widget->property("setRadius").isValid() && widget->property("setRadius").canConvert<int>()) { if (widget->property("setRadius").isValid() && widget->property("setRadius").canConvert<int>()) {
radius = widget->property("setRadius").value<int>(); radius = widget->property("setRadius").value<int>();
@ -2919,6 +3097,29 @@ void UKUIConfigStyleParameters::initConfigRadioButtonParameters(bool isDark, con
break; break;
} }
auto *w = const_cast<QWidget *>(widget);
if(w){
w->setProperty("ukui_radius", radius);
w->setProperty("ukui_defaultBrush", defaultBrush);
w->setProperty("ukui_hoverBrush", hoverBrush);
w->setProperty("ukui_clickBrush", clickBrush);
w->setProperty("ukui_disableBrush", disableBrush);
w->setProperty("ukui_onDefaultBrush", onDefaultBrush);
w->setProperty("ukui_onHoverBrush", onHoverBrush);
w->setProperty("ukui_onClickBrush", onClickBrush);
w->setProperty("ukui_childrenOnDefaultBrush", childrenOnDefaultBrush);
w->setProperty("ukui_childrenOnHoverBrush", childrenOnHoverBrush);
w->setProperty("ukui_childrenOnClickBrush", childrenOnClickBrush);
w->setProperty("ukui_childrenOnDisableBrush", childrenOnDisableBrush);
w->setProperty("ukui_defaultPen", defaultPen);
w->setProperty("ukui_disablePen", disablePen);
w->setProperty("ukui_hoverPen", hoverPen);
w->setProperty("ukui_clickPen", clickPen);
w->setProperty("ukui_onDefaultPen", onDefaultPen);
w->setProperty("ukui_onHoverPen", onHoverPen);
w->setProperty("ukui_onClickPen", onClickPen);
}
//if set property //if set property
if (widget) { if (widget) {
if (widget->property("setDefaultPen").isValid() && widget->property("setDefaultPen").canConvert<QPen>()) { if (widget->property("setDefaultPen").isValid() && widget->property("setDefaultPen").canConvert<QPen>()) {
@ -3168,6 +3369,26 @@ void UKUIConfigStyleParameters::initConfigSliderParameters(bool isDark, const QS
break; break;
} }
auto *w = const_cast<QWidget *>(widget);
if(w){
w->setProperty("ukui_grooveRadius", grooveRadius);
w->setProperty("ukui_handleDefaultBrush", handleDefaultBrush);
w->setProperty("ukui_handleHoverBrush", handleHoverBrush);
w->setProperty("ukui_handleClickBrush", handleClickBrush);
w->setProperty("ukui_handleDisableBrush", handleDisableBrush);
w->setProperty("ukui_grooveValueDefaultBrush", grooveValueDefaultBrush);
w->setProperty("ukui_grooveValueHoverBrush", grooveValueHoverBrush);
w->setProperty("ukui_grooveValueDisableBrush", grooveValueDisableBrush);
w->setProperty("ukui_grooveUnvalueDefaultBrush", grooveUnvalueDefaultBrush);
w->setProperty("ukui_grooveUnvalueHoverBrush", grooveUnvalueHoverBrush);
w->setProperty("ukui_grooveUnvalueDisableBrush", grooveUnvalueDisableBrush);
w->setProperty("ukui_handleDefaultPen", handleDefaultPen);
w->setProperty("ukui_handleHoverPen", handleHoverPen);
w->setProperty("ukui_handleClickPen", handleClickPen);
w->setProperty("ukui_handleDisablePen", handleDisablePen);
w->setProperty("ukui_sliderGroovePen; ", sliderGroovePen);
}
if (widget) { if (widget) {
if (widget->property("setGrooveRadius").isValid() && widget->property("setGrooveRadius").canConvert<int>()) { if (widget->property("setGrooveRadius").isValid() && widget->property("setGrooveRadius").canConvert<int>()) {
grooveRadius = widget->property("setGrooveRadius").value<int>(); grooveRadius = widget->property("setGrooveRadius").value<int>();
@ -3327,6 +3548,19 @@ void UKUIConfigStyleParameters::initConfigProgressBarParameters(bool isDark, con
break; break;
} }
auto *w = const_cast<QWidget *>(widget);
if(w){
w->setProperty("ukui_radius", radius);
w->setProperty("ukui_contentPen", contentPen);
w->setProperty("ukui_grooveDefaultPen", grooveDefaultPen);
w->setProperty("ukui_grooveDisablePen", grooveDisablePen);
w->setProperty("ukui_contentBrush", contentBrush);
w->setProperty("ukui_grooveDefaultBrush", grooveDefaultBrush);
w->setProperty("ukui_grooveDisableBrush", grooveDisableBrush);
w->setProperty("ukui_endColor", endColor);
w->setProperty("ukui_= startColor", startColor);
}
if(widget){ if(widget){
if (widget->property("setRadius").isValid() && widget->property("setRadius").canConvert<int>()) { if (widget->property("setRadius").isValid() && widget->property("setRadius").canConvert<int>()) {
radius = widget->property("setRadius").value<int>(); radius = widget->property("setRadius").value<int>();
@ -3473,6 +3707,16 @@ void UKUIConfigStyleParameters::initConfigScrollBarParameters(bool isDark, const
break; break;
} }
auto *w = const_cast<QWidget *>(widget);
if(w){
w->setProperty("ukui_radius", sliderRadius);
w->setProperty("ukui_grooveDefaultBrush", grooveDefaultBrush);
w->setProperty("ukui_grooveInactiveBrush", grooveInactiveBrush);
w->setProperty("ukui_sliderDefaultBrush", sliderDefaultBrush);
w->setProperty("ukui_sliderHoverBrush", sliderHoverBrush);
w->setProperty("ukui_sliderClickBrush", sliderClickBrush);
w->setProperty("ukui_sliderDisableBrush", sliderDisableBrush);
}
if(widget){ if(widget){
if (widget->property("setRadius").isValid() && widget->property("setRadius").canConvert<int>()) { if (widget->property("setRadius").isValid() && widget->property("setRadius").canConvert<int>()) {
radius = widget->property("setRadius").value<int>(); radius = widget->property("setRadius").value<int>();
@ -3550,6 +3794,12 @@ void UKUIConfigStyleParameters::initConfigToolTipParameters(bool isDark, const Q
} }
} }
auto *w = const_cast<QWidget *>(widget);
if(w){
w->setProperty("ukui_radius", radius);
w->setProperty("ukui_backgroundBrush", backgroundBrush);
w->setProperty("ukui_backgroundPen", backgroundPen);
}
m_ToolTipParameters.radius = radius; m_ToolTipParameters.radius = radius;
m_ToolTipParameters.toolTipBackgroundBrush = backgroundBrush; m_ToolTipParameters.toolTipBackgroundBrush = backgroundBrush;
m_ToolTipParameters.toolTipBackgroundPen = backgroundPen; m_ToolTipParameters.toolTipBackgroundPen = backgroundPen;
@ -3635,6 +3885,17 @@ void UKUIConfigStyleParameters::initConfigTabWidgetParameters(bool isDark, const
break; break;
} }
auto *w = const_cast<QWidget *>(widget);
if(w){
w->setProperty("ukui_radius", tabradius);
w->setProperty("ukui_widgetBackgroundBrush", widgetBackgroundBrush);
w->setProperty("ukui_tabBarBackgroundBrush", tabBarBackgroundBrush);
w->setProperty("ukui_tabBarDefaultBrush", tabBarDefaultBrush);
w->setProperty("ukui_tabBarHoverBrush", tabBarHoverBrush);
w->setProperty("ukui_tabBarClickBrush", tabBarClickBrush);
w->setProperty("ukui_tabBarSelectBrush", tabBarSelectBrush);
w->setProperty("ukui_tabBarPen", tabBarPen);
}
if(widget){ if(widget){
if (widget->property("setRadius").isValid() && widget->property("setRadius").canConvert<int>()) { if (widget->property("setRadius").isValid() && widget->property("setRadius").canConvert<int>()) {
tabradius = widget->property("setRadius").value<int>(); tabradius = widget->property("setRadius").value<int>();
@ -3719,6 +3980,15 @@ void UKUIConfigStyleParameters::initConfigMenuParameters(bool isDark, const QSty
} }
QBrush menuBackgroundBrush = color; QBrush menuBackgroundBrush = color;
auto *w = const_cast<QWidget *>(widget);
if(w){
w->setProperty("ukui_frameradius", frameradius);
w->setProperty("ukui_itemradius", itemradius);
w->setProperty("ukui_menuBackgroundBrush", menuBackgroundBrush);
w->setProperty("ukui_menuBackgroundPen", menuBackgroundPen);
w->setProperty("ukui_itemSelectBrush", itemSelectBrush);
w->setProperty("ukui_menuHoverPen", menuHoverPen);
}
if(widget){ if(widget){
if (widget->property("setFrameRadius").isValid() && widget->property("setFrameRadius").canConvert<int>()) { if (widget->property("setFrameRadius").isValid() && widget->property("setFrameRadius").canConvert<int>()) {