From b370c10b36968968f5b6bc9f221aafdba1d5d701 Mon Sep 17 00:00:00 2001 From: tanjing Date: Thu, 29 Feb 2024 15:28:10 +0800 Subject: [PATCH] =?UTF-8?q?=E5=9C=A8app=E7=BA=A7=E5=88=AB=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E5=B8=B8=E7=94=A8=E6=8E=A7=E4=BB=B6=E7=9A=84=E9=BB=98?= =?UTF-8?q?=E8=AE=A4=E7=8A=B6=E6=80=81=E7=9A=84=E4=B8=80=E4=BA=9B=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ukui-config-style-parameters.cpp | 838 +++++++++++++----- .../ukui-config-style-parameters.h | 33 +- .../ukui-config-style.cpp | 352 +++++++- .../qt5-config-style-ukui/ukui-config-style.h | 7 +- .../config-checkbox-parameters.h | 5 +- .../config-combobox-parameters.h | 5 +- .../config-lineedit-parameters.h | 5 +- .../config-list-parameters.h | 5 +- .../config-menu-parameters.h | 5 +- .../config-progressbar-parameters.h | 5 +- .../config-pushbutton-parameters.h | 5 +- .../config-radiobutton-parameters.h | 5 +- .../config-scrollbar-parameters.h | 5 +- .../config-slider-parameters.h | 5 +- .../config-spinbox-parameters.h | 5 +- .../config-table-parameters.h | 4 +- .../config-tabwidget-parameters.h | 5 +- .../config-toolbutton-parameters.h | 5 +- .../config-tooltip-parameters.h | 4 +- .../config-tree-parameters.h | 4 +- .../widget-parameters/control-parameters.cpp | 34 + .../widget-parameters/control-parameters.h | 42 + ukui-styles/ukui-style-plugin.cpp | 1 + 23 files changed, 1146 insertions(+), 238 deletions(-) create mode 100644 ukui-styles/qt5-config-style-ukui/widget-parameters/control-parameters.cpp create mode 100644 ukui-styles/qt5-config-style-ukui/widget-parameters/control-parameters.h diff --git a/ukui-styles/qt5-config-style-ukui/ukui-config-style-parameters.cpp b/ukui-styles/qt5-config-style-ukui/ukui-config-style-parameters.cpp index e0b3777..80c9a62 100644 --- a/ukui-styles/qt5-config-style-ukui/ukui-config-style-parameters.cpp +++ b/ukui-styles/qt5-config-style-ukui/ukui-config-style-parameters.cpp @@ -378,9 +378,10 @@ void UKUIConfigStyleParameters::setTabBarIndicatorLayout(TabBarIndicatorLayout l m_tabBarIndicatorLayout = layout; } -void UKUIConfigStyleParameters::setUKUIThemeColor(QString themeColor) +void UKUIConfigStyleParameters::setUKUIThemeColor(QPalette p,QString themeColor) { m_themeColor = themeColor; + m_stylePalette = p; } QString UKUIConfigStyleParameters::themeColor() @@ -666,8 +667,9 @@ void UKUIConfigStyleParameters::initConfigPushButtonBevelParameters(bool isDark, bool useButtonPalette = false; bool needTranslucent = false; + QPalette palette = option ? option->palette : m_stylePalette; - UKUIColorTheme::ButtonColorCfg buttonColorCfg = readCfg()->buttonColorCfg(option->palette); + UKUIColorTheme::ButtonColorCfg buttonColorCfg = readCfg()->buttonColorCfg(palette); if (widget) { if (widget->property("isWindowButton").isValid()) { @@ -691,17 +693,17 @@ void UKUIConfigStyleParameters::initConfigPushButtonBevelParameters(bool isDark, } } if (isWindowColoseButton) - buttonColorCfg = readCfg()->buttonColorCfg(option->palette, C_Button_WindowCloseButton); + buttonColorCfg = readCfg()->buttonColorCfg(palette, C_Button_WindowCloseButton); if (isWindowButton) - buttonColorCfg = readCfg()->buttonColorCfg(option->palette, C_Button_WindowButton); + buttonColorCfg = readCfg()->buttonColorCfg(palette, C_Button_WindowButton); if (useButtonPalette || isWindowButton) { if (needTranslucent) - buttonColorCfg = readCfg()->buttonColorCfg(option->palette, C_Button_TranslucentButton); + buttonColorCfg = readCfg()->buttonColorCfg(palette, C_Button_TranslucentButton); else - buttonColorCfg = readCfg()->buttonColorCfg(option->palette, C_Button_UseButtonPalette); + buttonColorCfg = readCfg()->buttonColorCfg(palette, C_Button_UseButtonPalette); } if (isImportant) - buttonColorCfg = readCfg()->buttonColorCfg(option->palette, C_Button_ImportButton); + buttonColorCfg = readCfg()->buttonColorCfg(palette, C_Button_ImportButton); int radius = (widget && widget->property("normalRadius").isValid()) ? widget->property("normalRadius").toInt() : m_radiusStruct.normalRadius; @@ -713,11 +715,11 @@ void UKUIConfigStyleParameters::initConfigPushButtonBevelParameters(bool isDark, QColor startColor; QColor endColor; QLinearGradient linearGradient; - linearGradient.setStart(option->rect.topLeft()); - linearGradient.setFinalStop(option->rect.bottomLeft()); + linearGradient.setStart(option ? option->rect.topLeft() : QPoint(0, 0)); + linearGradient.setFinalStop(option ? option->rect.bottomLeft() :QPoint(0, 0)); - QColor highlight = option->palette.color(QPalette::Active, QPalette::Highlight); - QColor mix = option->palette.color(QPalette::Active, QPalette::BrightText); + QColor highlight = palette.color(QPalette::Active, QPalette::Highlight); + QColor mix = palette.color(QPalette::Active, QPalette::BrightText); QPen defaultPen ; QPen hoverPen ; @@ -743,7 +745,7 @@ void UKUIConfigStyleParameters::initConfigPushButtonBevelParameters(bool isDark, disablePen = QPen(QBrush(buttonColorCfg.disablePen), (buttonColorCfg.disablePen == Qt::NoPen || buttonColorCfg.disablePen.alpha() == 0) ? 0 : 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin); - auto checkableColorCfg = readCfg()->buttonColorCfg(option->palette, C_Button_ImportButton); + 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); @@ -754,10 +756,10 @@ void UKUIConfigStyleParameters::initConfigPushButtonBevelParameters(bool isDark, checkDisablePen = QPen(QBrush(checkableColorCfg.disablePen), (checkableColorCfg.disablePen == Qt::NoPen || checkableColorCfg.disablePen.alpha() == 0) ? 0 : 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin); - checkBrush = option->palette.color(QPalette::Active, QPalette::Highlight); + checkBrush = palette.color(QPalette::Active, QPalette::Highlight); checkHoverBrush = checkableColorCfg.hoverBrush; checkClickBrush = checkableColorCfg.clickBrush; - checkDisableBrush = option->palette.brush(QPalette::Disabled, QPalette::NoRole); + checkDisableBrush = palette.brush(QPalette::Disabled, QPalette::NoRole); } if (isWindowColoseButton) { @@ -853,9 +855,9 @@ void UKUIConfigStyleParameters::initConfigPushButtonBevelParameters(bool isDark, focusPen = clickPen; } else if (!isWindowColoseButton) { - normalButtonColor(isDark, option->palette, defaultPen, defaultBrush, hoverPen, hoverBrush, + normalButtonColor(isDark, palette, defaultPen, defaultBrush, hoverPen, hoverBrush, clickPen, clickBrush, disablePen, disableBrush); - focusPen = QPen(option->palette.brush(QPalette::Inactive, QPalette::Highlight), + 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) @@ -974,6 +976,31 @@ void UKUIConfigStyleParameters::initConfigPushButtonBevelParameters(bool isDark, m_PushButtonParameters.pushButtonCheckClickPen = checkClickPen; m_PushButtonParameters.pushButtonCheckDisablePen = checkDisablePen; m_PushButtonParameters.pushButtonFocusPen = focusPen; + +} + +void UKUIConfigStyleParameters::getDefaultConfigPushButtonBevelParameters(ConfigPushButtonParameters *p, bool isDark) +{ + initConfigPushButtonBevelParameters(isDark, nullptr, nullptr); + p->radius = m_PushButtonParameters.radius; + p->pushButtonDefaultBrush = m_PushButtonParameters.pushButtonDefaultBrush ; + p->pushButtonClickBrush = m_PushButtonParameters.pushButtonClickBrush ; + p->pushButtonHoverBrush = m_PushButtonParameters.pushButtonHoverBrush ; + p->pushButtonDisableBrush = m_PushButtonParameters.pushButtonDisableBrush ; + p->pushButtonCheckBrush = m_PushButtonParameters.pushButtonCheckBrush ; + p->pushButtonCheckHoverBrush = m_PushButtonParameters.pushButtonCheckHoverBrush ; + p->pushButtonCheckClickBrush = m_PushButtonParameters.pushButtonCheckClickBrush ; + p->pushButtonCheckDisableBrush = m_PushButtonParameters.pushButtonCheckDisableBrush; + p->pushButtonDefaultPen = m_PushButtonParameters.pushButtonDefaultPen ; + p->pushButtonClickPen = m_PushButtonParameters.pushButtonClickPen ; + p->pushButtonHoverPen = m_PushButtonParameters.pushButtonHoverPen ; + p->pushButtonDisablePen = m_PushButtonParameters.pushButtonDisablePen ; + p->pushButtonCheckPen = m_PushButtonParameters.pushButtonCheckPen ; + p->pushButtonCheckHoverPen = m_PushButtonParameters.pushButtonCheckHoverPen ; + p->pushButtonCheckClickPen = m_PushButtonParameters.pushButtonCheckClickPen ; + p->pushButtonCheckDisablePen = m_PushButtonParameters.pushButtonCheckDisablePen ; + p->pushButtonFocusPen = m_PushButtonParameters.pushButtonFocusPen ; + } void UKUIConfigStyleParameters::initConfigPushButtonLabelParameters(bool isDark, const QStyleOption *option, const QWidget *widget) @@ -981,14 +1008,15 @@ void UKUIConfigStyleParameters::initConfigPushButtonLabelParameters(bool isDark, bool iconHighlight = false; bool textHighlight = false; - const QStyleOptionButton *button = qstyleoption_cast(option); + QPalette palette = option ? option->palette : m_stylePalette; + const QStyleOptionButton *button = option ? qstyleoption_cast(option) : nullptr; bool isWindowButton = false; bool useButtonPalette = false; bool isImportant = false; bool isWindowColoseButton = false; bool needTranslucent = false; - UKUIColorTheme::ButtonColorCfg buttonColorCfg = readCfg()->buttonColorCfg(option->palette); + UKUIColorTheme::ButtonColorCfg buttonColorCfg = readCfg()->buttonColorCfg(palette); if (widget) { if (widget->property("isWindowButton").isValid()) { @@ -1012,20 +1040,20 @@ void UKUIConfigStyleParameters::initConfigPushButtonLabelParameters(bool isDark, } } if (isWindowColoseButton) - buttonColorCfg = readCfg()->buttonColorCfg(option->palette, C_Button_WindowCloseButton); + buttonColorCfg = readCfg()->buttonColorCfg(palette, C_Button_WindowCloseButton); if (isWindowButton) - buttonColorCfg = readCfg()->buttonColorCfg(option->palette, C_Button_WindowButton); + buttonColorCfg = readCfg()->buttonColorCfg(palette, C_Button_WindowButton); if (useButtonPalette || isWindowButton) { if (needTranslucent) - buttonColorCfg = readCfg()->buttonColorCfg(option->palette, C_Button_TranslucentButton); + buttonColorCfg = readCfg()->buttonColorCfg(palette, C_Button_TranslucentButton); else - buttonColorCfg = readCfg()->buttonColorCfg(option->palette, C_Button_UseButtonPalette); + buttonColorCfg = readCfg()->buttonColorCfg(palette, C_Button_UseButtonPalette); } if (isImportant) - buttonColorCfg = readCfg()->buttonColorCfg(option->palette, C_Button_ImportButton); + buttonColorCfg = readCfg()->buttonColorCfg(palette, C_Button_ImportButton); - if(option->state & QStyle::State_On && option->state & QStyle::State_Enabled){ - buttonColorCfg = readCfg()->buttonColorCfg(option->palette, C_Button_ImportButton); + if(option && option->state & QStyle::State_On && option->state & QStyle::State_Enabled){ + buttonColorCfg = readCfg()->buttonColorCfg(palette, C_Button_ImportButton); } QColor textDefaultColor = buttonColorCfg.textDefaultColor; @@ -1033,7 +1061,7 @@ void UKUIConfigStyleParameters::initConfigPushButtonLabelParameters(bool isDark, QColor textDisableColor = buttonColorCfg.textDisableColor; //icon - if ((isWindowButton || useButtonPalette) && !(button->state & QStyle::State_On)) { + if (button && (isWindowButton || useButtonPalette) && !(button->state & QStyle::State_On)) { iconHighlight = false; } else { iconHighlight = true; @@ -1054,7 +1082,7 @@ void UKUIConfigStyleParameters::initConfigPushButtonLabelParameters(bool isDark, if (widget) { // if(!widget->isEnabled()) -// textColor = option->palette.color(QPalette::Disabled, QPalette::ButtonText); +// textColor = palette.color(QPalette::Disabled, QPalette::ButtonText); if (widget->property("setIconHoverClickHighlight").isValid() && widget->property("setIconHoverClickHighlight").canConvert()) { iconHighlight = widget->property("setIconHoverClickHighlight").value(); @@ -1080,6 +1108,16 @@ void UKUIConfigStyleParameters::initConfigPushButtonLabelParameters(bool isDark, m_PushButtonParameters.textDisableColor = textDisableColor; } +void UKUIConfigStyleParameters::getDefaultConfigPushButtonLabelParameters(ConfigPushButtonParameters *p, bool isDark) +{ + initConfigPushButtonLabelParameters(isDark, nullptr, nullptr); + p->iconHoverClickHighlight = m_PushButtonParameters.iconHoverClickHighlight; + p->textHoverClickHighlight = m_PushButtonParameters.textHoverClickHighlight; + p->textDefaultColor = m_PushButtonParameters.textDefaultColor ; + p->textHoverColor = m_PushButtonParameters.textHoverColor ; + p->textDisableColor = m_PushButtonParameters.textDisableColor ; +} + void UKUIConfigStyleParameters::initConfigToolButtonPanelParameters(bool isDark, const QStyleOption *option, const QWidget *widget) { bool isWindowButton = false; @@ -1087,7 +1125,9 @@ void UKUIConfigStyleParameters::initConfigToolButtonPanelParameters(bool isDark, bool isImportant = false; bool useButtonPalette = false; bool needTranslucent = false; - UKUIColorTheme::ToolButtonColorCfg buttonColorCfg = readCfg()->toolButtonColorCfg(option->palette); + QPalette palette = option ? option->palette : m_stylePalette; + + UKUIColorTheme::ToolButtonColorCfg buttonColorCfg = readCfg()->toolButtonColorCfg(palette); if (widget) { if (widget->property("isWindowButton").isValid()) { @@ -1111,17 +1151,17 @@ void UKUIConfigStyleParameters::initConfigToolButtonPanelParameters(bool isDark, } } if (isWindowColoseButton) - buttonColorCfg = readCfg()->toolButtonColorCfg(option->palette, C_Button_WindowCloseButton); + buttonColorCfg = readCfg()->toolButtonColorCfg(palette, C_Button_WindowCloseButton); if (isWindowButton) - buttonColorCfg = readCfg()->toolButtonColorCfg(option->palette, C_Button_WindowButton); + buttonColorCfg = readCfg()->toolButtonColorCfg(palette, C_Button_WindowButton); if (useButtonPalette || isWindowButton) { if (needTranslucent) - buttonColorCfg = readCfg()->toolButtonColorCfg(option->palette, C_Button_TranslucentButton); + buttonColorCfg = readCfg()->toolButtonColorCfg(palette, C_Button_TranslucentButton); else - buttonColorCfg = readCfg()->toolButtonColorCfg(option->palette, C_Button_UseButtonPalette); + buttonColorCfg = readCfg()->toolButtonColorCfg(palette, C_Button_UseButtonPalette); } if (isImportant) - buttonColorCfg = readCfg()->toolButtonColorCfg(option->palette, C_Button_ImportButton); + buttonColorCfg = readCfg()->toolButtonColorCfg(palette, C_Button_ImportButton); int radius = (widget && widget->property("normalRadius").isValid()) ? widget->property("normalRadius").toInt() : m_radiusStruct.normalRadius; @@ -1133,11 +1173,11 @@ void UKUIConfigStyleParameters::initConfigToolButtonPanelParameters(bool isDark, QColor startColor; QColor endColor; QLinearGradient linearGradient; - linearGradient.setStart(option->rect.topLeft()); - linearGradient.setFinalStop(option->rect.bottomLeft()); + linearGradient.setStart(option ? option->rect.topLeft() : QPoint(0, 0)); + linearGradient.setFinalStop(option ? option->rect.bottomLeft() : QPoint(0, 0)); - QColor highlight = option->palette.color(QPalette::Active, QPalette::Highlight); - QColor mix = option->palette.color(QPalette::Active, QPalette::BrightText); + QColor highlight = palette.color(QPalette::Active, QPalette::Highlight); + QColor mix = palette.color(QPalette::Active, QPalette::BrightText); QPen defaultPen ; QPen hoverPen ; @@ -1162,7 +1202,7 @@ void UKUIConfigStyleParameters::initConfigToolButtonPanelParameters(bool isDark, disablePen = QPen(QBrush(buttonColorCfg.disablePen), (buttonColorCfg.disablePen == Qt::NoPen) ? 0 : 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin); - auto checkableColorCfg = readCfg()->toolButtonColorCfg(option->palette, C_Button_ImportButton); + auto checkableColorCfg = readCfg()->toolButtonColorCfg(palette, C_Button_ImportButton); { checkPen = QPen(QBrush(checkableColorCfg.defaultPen), (checkableColorCfg.defaultPen == Qt::NoPen || checkableColorCfg.defaultPen.alpha() == 0) @@ -1174,10 +1214,10 @@ void UKUIConfigStyleParameters::initConfigToolButtonPanelParameters(bool isDark, checkDisablePen = QPen(QBrush(checkableColorCfg.disablePen), (checkableColorCfg.disablePen == Qt::NoPen || checkableColorCfg.disablePen.alpha() == 0) ? 0 : 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin); - checkBrush = option->palette.color(QPalette::Active, QPalette::Highlight); + checkBrush = palette.color(QPalette::Active, QPalette::Highlight); checkHoverBrush = checkableColorCfg.hoverBrush; checkClickBrush = checkableColorCfg.clickBrush; - checkDisableBrush = option->palette.brush(QPalette::Disabled, QPalette::NoRole); + checkDisableBrush = palette.brush(QPalette::Disabled, QPalette::NoRole); } if (isWindowColoseButton){ if (buttonColorCfg.hoverType == Obj_Gradient_Type) { @@ -1273,9 +1313,9 @@ void UKUIConfigStyleParameters::initConfigToolButtonPanelParameters(bool isDark, focusPen = clickPen; } else if (!isWindowColoseButton) { - normalButtonColor(isDark, option->palette, defaultPen, defaultBrush, hoverPen, hoverBrush, + normalButtonColor(isDark, palette, defaultPen, defaultBrush, hoverPen, hoverBrush, clickPen, clickBrush, disablePen, disableBrush); - focusPen = QPen(option->palette.brush(QPalette::Inactive, QPalette::Highlight), + 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) @@ -1395,6 +1435,30 @@ void UKUIConfigStyleParameters::initConfigToolButtonPanelParameters(bool isDark, m_ToolButtonParameters.toolButtonFocusPen = focusPen; } +void UKUIConfigStyleParameters::getDefaultConfigToolButtonPanelParameters(ConfigToolButtonParameters *p, bool isDark) +{ + initConfigToolButtonPanelParameters(isDark, nullptr, nullptr); + p->radius = m_ToolButtonParameters.radius; + p->toolButtonDefaultBrush = m_ToolButtonParameters.toolButtonDefaultBrush ; + p->toolButtonClickBrush = m_ToolButtonParameters.toolButtonClickBrush ; + p->toolButtonHoverBrush = m_ToolButtonParameters.toolButtonHoverBrush ; + p->toolButtonDisableBrush = m_ToolButtonParameters.toolButtonDisableBrush ; + p->toolButtonCheckBrush = m_ToolButtonParameters.toolButtonCheckBrush ; + p->toolButtonCheckHoverBrush = m_ToolButtonParameters.toolButtonCheckHoverBrush ; + p->toolButtonCheckClickBrush = m_ToolButtonParameters.toolButtonCheckClickBrush ; + p->toolButtonCheckDisableBrush = m_ToolButtonParameters.toolButtonCheckDisableBrush; + p->toolButtonDefaultPen = m_ToolButtonParameters.toolButtonDefaultPen ; + p->toolButtonClickPen = m_ToolButtonParameters.toolButtonClickPen ; + p->toolButtonHoverPen = m_ToolButtonParameters.toolButtonHoverPen ; + p->toolButtonDisablePen = m_ToolButtonParameters.toolButtonDisablePen ; + p->toolButtonCheckPen = m_ToolButtonParameters.toolButtonCheckPen ; + p->toolButtonCheckHoverPen = m_ToolButtonParameters.toolButtonCheckHoverPen ; + p->toolButtonCheckClickPen = m_ToolButtonParameters.toolButtonCheckClickPen ; + p->toolButtonCheckDisablePen = m_ToolButtonParameters.toolButtonCheckDisablePen ; + p->toolButtonFocusPen = m_ToolButtonParameters.toolButtonFocusPen ; + +} + void UKUIConfigStyleParameters::initConfigToolButtonLabelParameters(bool isDark, const QStyleOption *option, const QWidget *widget) { bool iconHighlight = false; @@ -1407,7 +1471,9 @@ void UKUIConfigStyleParameters::initConfigToolButtonLabelParameters(bool isDark, bool isWindowColoseButton = false; bool needTranslucent = false; - UKUIColorTheme::ToolButtonColorCfg buttonColorCfg = readCfg()->toolButtonColorCfg(option->palette); + QPalette palette = option ? option->palette : m_stylePalette; + + UKUIColorTheme::ToolButtonColorCfg buttonColorCfg = readCfg()->toolButtonColorCfg(palette); if (widget) { if (widget->property("isWindowButton").isValid()) { @@ -1431,20 +1497,20 @@ void UKUIConfigStyleParameters::initConfigToolButtonLabelParameters(bool isDark, } } if (isWindowColoseButton) - buttonColorCfg = readCfg()->toolButtonColorCfg(option->palette, C_Button_WindowCloseButton); + buttonColorCfg = readCfg()->toolButtonColorCfg(palette, C_Button_WindowCloseButton); if (isWindowButton) - buttonColorCfg = readCfg()->toolButtonColorCfg(option->palette, C_Button_WindowButton); + buttonColorCfg = readCfg()->toolButtonColorCfg(palette, C_Button_WindowButton); if (useButtonPalette || isWindowButton) { if (needTranslucent) - buttonColorCfg = readCfg()->toolButtonColorCfg(option->palette, C_Button_TranslucentButton); + buttonColorCfg = readCfg()->toolButtonColorCfg(palette, C_Button_TranslucentButton); else - buttonColorCfg = readCfg()->toolButtonColorCfg(option->palette, C_Button_UseButtonPalette); + buttonColorCfg = readCfg()->toolButtonColorCfg(palette, C_Button_UseButtonPalette); } if (isImportant) - buttonColorCfg = readCfg()->toolButtonColorCfg(option->palette, C_Button_ImportButton); + buttonColorCfg = readCfg()->toolButtonColorCfg(palette, C_Button_ImportButton); - if(option->state & QStyle::State_On && option->state & QStyle::State_Enabled){ - buttonColorCfg = readCfg()->toolButtonColorCfg(option->palette, C_Button_ImportButton); + if(option && option->state & QStyle::State_On && option->state & QStyle::State_Enabled){ + buttonColorCfg = readCfg()->toolButtonColorCfg(palette, C_Button_ImportButton); } QColor textDefaultColor = buttonColorCfg.textDefaultColor; @@ -1471,7 +1537,7 @@ void UKUIConfigStyleParameters::initConfigToolButtonLabelParameters(bool isDark, } if (widget) { // if(!widget->isEnabled()) -// textColor = option->palette.color(QPalette::Disabled, QPalette::ButtonText); +// textColor = palette.color(QPalette::Disabled, QPalette::ButtonText); if (widget->property("setIconHoverClickHighlight").isValid() && widget->property("setIconHoverClickHighlight").canConvert()) { iconHighlight = widget->property("setIconHoverClickHighlight").value(); @@ -1497,6 +1563,16 @@ void UKUIConfigStyleParameters::initConfigToolButtonLabelParameters(bool isDark, m_ToolButtonParameters.textDisableColor = textDisableColor; } +void UKUIConfigStyleParameters::getDefaultConfigToolButtonLabelParameters(ConfigToolButtonParameters *p, bool isDark) +{ + initConfigToolButtonLabelParameters(isDark, nullptr, nullptr); + p->iconHoverClickHighlight = m_ToolButtonParameters.iconHoverClickHighlight; + p->textHoverClickHighlight = m_ToolButtonParameters.textHoverClickHighlight; + p->textDefaultColor = m_ToolButtonParameters.textDefaultColor ; + p->textHoverColor = m_ToolButtonParameters.textHoverColor ; + p->textDisableColor = m_ToolButtonParameters.textDisableColor ; +} + void UKUIConfigStyleParameters::initConfigLineEditParameters(bool isDark, const QStyleOption *option, const QWidget *widget) { int radius = (widget && widget->property("normalRadius").isValid()) ? @@ -1506,7 +1582,9 @@ void UKUIConfigStyleParameters::initConfigLineEditParameters(bool isDark, const needTranslucent = widget->property("needTranslucent").toBool(); } - UKUIColorTheme::LineEditColorCfg lineEditColorCfg = readCfg()->lineEditColorCfg(option->palette, needTranslucent ? C_LineEdit_Translucent : C_LineEdit_Default); + QPalette palette = option ? option->palette : m_stylePalette; + + UKUIColorTheme::LineEditColorCfg lineEditColorCfg = readCfg()->lineEditColorCfg(palette, needTranslucent ? C_LineEdit_Translucent : C_LineEdit_Default); QBrush defaultBrush = lineEditColorCfg.defaultBrush; QBrush hoverBrush = lineEditColorCfg.hoverBrush; @@ -1522,8 +1600,8 @@ void UKUIConfigStyleParameters::initConfigLineEditParameters(bool isDark, const QColor startColor; QColor endColor; QLinearGradient linearGradient; - linearGradient.setStart(option->rect.topLeft()); - linearGradient.setFinalStop(option->rect.bottomLeft()); + 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); @@ -1575,23 +1653,39 @@ void UKUIConfigStyleParameters::initConfigLineEditParameters(bool isDark, const } } - m_LineEditParameters.radius = radius; + m_LineEditParameters.radius = radius; m_LineEditParameters.lineEditDefaultBrush = defaultBrush; - m_LineEditParameters.lineEditHoverBrush = hoverBrush; - m_LineEditParameters.lineEditFocusBrush = focusBrush; + m_LineEditParameters.lineEditHoverBrush = hoverBrush; + m_LineEditParameters.lineEditFocusBrush = focusBrush; m_LineEditParameters.lineEditDisableBrush = disableBrush; - m_LineEditParameters.lineEditDefaultPen = defaultPen; - m_LineEditParameters.lineEditHoverPen = hoverPen; - m_LineEditParameters.lineEditFocusPen = focusPen; - m_LineEditParameters.lineEditDisablePen = disablePen; + m_LineEditParameters.lineEditDefaultPen = defaultPen; + m_LineEditParameters.lineEditHoverPen = hoverPen; + m_LineEditParameters.lineEditFocusPen = focusPen; + m_LineEditParameters.lineEditDisablePen = disablePen; +} + +void UKUIConfigStyleParameters::getDefaultConfigLineEditParameters(ConfigLineEditParameters *p, bool isDark) +{ + initConfigLineEditParameters(isDark, nullptr, nullptr); + p->radius = m_LineEditParameters.radius ; + p->lineEditDefaultBrush = m_LineEditParameters.lineEditDefaultBrush; + p->lineEditHoverBrush = m_LineEditParameters.lineEditHoverBrush ; + p->lineEditFocusBrush = m_LineEditParameters.lineEditFocusBrush ; + p->lineEditDisableBrush = m_LineEditParameters.lineEditDisableBrush; + p->lineEditDefaultPen = m_LineEditParameters.lineEditDefaultPen ; + p->lineEditHoverPen = m_LineEditParameters.lineEditHoverPen ; + p->lineEditFocusPen = m_LineEditParameters.lineEditFocusPen ; + p->lineEditDisablePen = m_LineEditParameters.lineEditDisablePen ; } void UKUIConfigStyleParameters::initConfigSpinBoxParameters(bool isDark, const QStyleOption *option, const QWidget *widget, bool isHorizonLayout) { int radius = (widget && widget->property("normalRadius").isValid()) ? widget->property("normalRadius").toInt() : m_radiusStruct.normalRadius; + QPalette palette = option ? option->palette : m_stylePalette; + UKUIColorTheme::SpinBoxColorCfg spinBoxColorCfg = - readCfg()->spinBoxColorCfg(option->palette, C_SpinBox_Default, isHorizonLayout ? C_SpinBox_HorizonLayout : C_SpinBox_DefaultLayout); + readCfg()->spinBoxColorCfg(palette, C_SpinBox_Default, isHorizonLayout ? C_SpinBox_HorizonLayout : C_SpinBox_DefaultLayout); QBrush defaultBrush = spinBoxColorCfg.defaultBrush; QBrush hoverBrush = spinBoxColorCfg.hoverBrush; @@ -1646,8 +1740,8 @@ void UKUIConfigStyleParameters::initConfigSpinBoxParameters(bool isDark, const Q QColor startColor; QColor endColor; QLinearGradient linearGradient; - linearGradient.setStart(option->rect.topLeft()); - linearGradient.setFinalStop(option->rect.bottomLeft()); + 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); @@ -1661,18 +1755,18 @@ void UKUIConfigStyleParameters::initConfigSpinBoxParameters(bool isDark, const Q break; } - QColor highlight = option->palette.color(QPalette::Active, QPalette::Highlight); - QColor button = option->palette.color(QPalette::Active, QPalette::Button); - QColor mix = option->palette.color(QPalette::Active, QPalette::BrightText); + QColor highlight = palette.color(QPalette::Active, QPalette::Highlight); + QColor button = palette.color(QPalette::Active, QPalette::Button); + QColor mix = palette.color(QPalette::Active, QPalette::BrightText); QColor startColor; QColor endColor; QLinearGradient upLinearGradient; - upLinearGradient.setStart(option->rect.left(), option->rect.top()); - upLinearGradient.setFinalStop(option->rect.left(), option->rect.center().y()); + upLinearGradient.setStart(!option ? QPoint(0, 0) : QPoint(option->rect.left(), option->rect.top())); + upLinearGradient.setFinalStop(!option ? QPoint(0, 0) : QPoint(option->rect.left(), option->rect.center().y())); QLinearGradient downLinearGradient; - downLinearGradient.setStart(option->rect.left(), option->rect.center().y()); - downLinearGradient.setFinalStop(option->rect.left(), option->rect.bottom()); + downLinearGradient.setStart(!option ? QPoint(0, 0) : QPoint(option->rect.left(), option->rect.center().y())); + downLinearGradient.setFinalStop(!option ? QPoint(0, 0) : QPoint(option->rect.left(), option->rect.bottom())); switch (m_adjustColorRules) { case AdjustColorRules::DefaultRGB:{ @@ -1750,13 +1844,13 @@ void UKUIConfigStyleParameters::initConfigSpinBoxParameters(bool isDark, const Q case AdjustColorRules::HSL:{ //up hover if (isDark) { - upHoverPen = QPen(QBrush(adjustColor(option->palette.color(QPalette::Active, QPalette::Highlight), 0, -5, -15)), + upHoverPen = QPen(QBrush(adjustColor(palette.color(QPalette::Active, QPalette::Highlight), 0, -5, -15)), 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin); } else { - upHoverPen = QPen(QBrush(adjustColor(option->palette.color(QPalette::Active, QPalette::Highlight), 4, -14, 15)), + upHoverPen = QPen(QBrush(adjustColor(palette.color(QPalette::Active, QPalette::Highlight), 4, -14, 15)), 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin); } - upHoverBrush = QBrush(highlightHover(isDark, option->palette)); + upHoverBrush = QBrush(highlightHover(isDark, palette)); //up focus hover upFocusHoverBrush = upHoverBrush; @@ -1764,13 +1858,13 @@ void UKUIConfigStyleParameters::initConfigSpinBoxParameters(bool isDark, const Q //up click if (isDark) { - upClickPen = QPen(option->palette.brush(QPalette::Active, QPalette::Highlight), + upClickPen = QPen(palette.brush(QPalette::Active, QPalette::Highlight), 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin); } else { - upClickPen = QPen(QBrush(adjustColor(option->palette.color(QPalette::Active, QPalette::Highlight), 5, -21, 3)), + upClickPen = QPen(QBrush(adjustColor(palette.color(QPalette::Active, QPalette::Highlight), 5, -21, 3)), 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin); } - upClickBrush = QBrush(highlightClick(isDark, option->palette)); + upClickBrush = QBrush(highlightClick(isDark, palette)); //up disable upDisablePen = disablePen; @@ -1948,13 +2042,54 @@ void UKUIConfigStyleParameters::initConfigSpinBoxParameters(bool isDark, const Q m_SpinBoxParameters.spinBoxDownIconHightPixMap = (m_adjustColorRules == 0 ? true : false); } +void UKUIConfigStyleParameters::getDefaultConfigSpinBoxParameters(ConfigSpinBoxParameters *p, bool isDark) +{ + initConfigSpinBoxParameters(isDark, nullptr, nullptr); + p->radius = m_SpinBoxParameters.radius ; + p->spinBoxDefaultBrush = m_SpinBoxParameters.spinBoxDefaultBrush ; + p->spinBoxHoverBrush = m_SpinBoxParameters.spinBoxHoverBrush ; + p->spinBoxFocusBrush = m_SpinBoxParameters.spinBoxFocusBrush ; + p->spinBoxDisableBrush = m_SpinBoxParameters.spinBoxDisableBrush ; + + p->spinBoxDefaultPen = m_SpinBoxParameters.spinBoxDefaultPen ; + p->spinBoxHoverPen = m_SpinBoxParameters.spinBoxHoverPen ; + p->spinBoxFocusPen = m_SpinBoxParameters.spinBoxFocusPen ; + p->spinBoxDisablePen = m_SpinBoxParameters.spinBoxDisablePen ; + + p->spinBoxUpDefaultBrush = m_SpinBoxParameters.spinBoxUpDefaultBrush ; + p->spinBoxUpHoverBrush = m_SpinBoxParameters.spinBoxUpHoverBrush ; + p->spinBoxUpFocusHoverBrush = m_SpinBoxParameters.spinBoxUpFocusHoverBrush ; + p->spinBoxUpClickBrush = m_SpinBoxParameters.spinBoxUpClickBrush ; + p->spinBoxDownHoverBrush = m_SpinBoxParameters.spinBoxDownHoverBrush ; + p->spinBoxDownFocusHoverBrush = m_SpinBoxParameters.spinBoxDownFocusHoverBrush ; + p->spinBoxDownClickBrush = m_SpinBoxParameters.spinBoxDownClickBrush ; + p->spinBoxDownDefaultBrush = m_SpinBoxParameters.spinBoxDownDefaultBrush ; + + p->spinBoxUpDefaultPen = m_SpinBoxParameters.spinBoxUpDefaultPen ; + p->spinBoxUpHoverPen = m_SpinBoxParameters.spinBoxUpHoverPen ; + p->spinBoxUpFocusHoverPen = m_SpinBoxParameters.spinBoxUpFocusHoverPen ; + p->spinBoxUpClickPen = m_SpinBoxParameters.spinBoxUpClickPen ; + p->spinBoxUpDisablePen = m_SpinBoxParameters.spinBoxUpDisablePen ; + + p->spinBoxDownDefaultPen = m_SpinBoxParameters.spinBoxDownDefaultPen ; + p->spinBoxDownHoverPen = m_SpinBoxParameters.spinBoxDownHoverPen ; + p->spinBoxDownFocusHoverPen = m_SpinBoxParameters.spinBoxDownFocusHoverPen ; + p->spinBoxDownClickPen = m_SpinBoxParameters.spinBoxDownClickPen ; + p->spinBoxDownDisablePen = m_SpinBoxParameters.spinBoxDownDisablePen ; + + p->spinBoxUpIconHightPixMap = m_SpinBoxParameters.spinBoxUpIconHightPixMap ; + p->spinBoxDownIconHightPixMap = m_SpinBoxParameters.spinBoxDownIconHightPixMap ; + +} + void UKUIConfigStyleParameters::initConfigComboBoxParameters(bool isDark, const QStyleOption *option, const QWidget *widget) { int radius = (widget && widget->property("normalRadius").isValid()) ? widget->property("normalRadius").toInt() : m_radiusStruct.normalRadius; + QPalette palette = option ? option->palette : m_stylePalette; - UKUIColorTheme::ComboBoxColorCfg comboBoxColorCfg = readCfg()->comboBoxColorCfg(option->palette, C_ComboBox_Default); + UKUIColorTheme::ComboBoxColorCfg comboBoxColorCfg = readCfg()->comboBoxColorCfg(palette, C_ComboBox_Default); QBrush defaultBrush = comboBoxColorCfg.defaultBrush; QBrush hoverBrush = comboBoxColorCfg.hoverBrush; @@ -1977,7 +2112,7 @@ void UKUIConfigStyleParameters::initConfigComboBoxParameters(bool isDark, const switch (m_adjustColorRules) { case AdjustColorRules::HSL: - normalButtonColor(isDark, option->palette, defaultPen, defaultBrush, hoverPen, hoverBrush, + normalButtonColor(isDark, palette, defaultPen, defaultBrush, hoverPen, hoverBrush, onPen, onBrush, disablePen, disableBrush); defaultPen = QPen(QBrush(comboBoxColorCfg.defaultPen), (comboBoxColorCfg.defaultPen == Qt::NoPen || comboBoxColorCfg.defaultPen.alpha() == 0) ? 0 : 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin); @@ -2046,30 +2181,48 @@ void UKUIConfigStyleParameters::initConfigComboBoxParameters(bool isDark, const } } - m_ComboBoxParameters.radius = radius; + m_ComboBoxParameters.radius = radius; m_ComboBoxParameters.comboBoxDefaultBrush = defaultBrush; - m_ComboBoxParameters.comboBoxHoverBrush = hoverBrush; - m_ComboBoxParameters.comboBoxOnBrush = onBrush; - m_ComboBoxParameters.comboBoxEditBrush = editBrush; + m_ComboBoxParameters.comboBoxHoverBrush = hoverBrush; + m_ComboBoxParameters.comboBoxOnBrush = onBrush; + m_ComboBoxParameters.comboBoxEditBrush = editBrush; m_ComboBoxParameters.comboBoxDisableBrush = disableBrush; - m_ComboBoxParameters.comboBoxDefaultPen = defaultPen; - m_ComboBoxParameters.comboBoxHoverPen = hoverPen; - m_ComboBoxParameters.comboBoxOnPen = onPen; - m_ComboBoxParameters.comboBoxEditPen = editPen; - m_ComboBoxParameters.comboBoxDisablePen = disablePen; - m_ComboBoxParameters.comboBoxFocusPen = focusPen; + m_ComboBoxParameters.comboBoxDefaultPen = defaultPen; + m_ComboBoxParameters.comboBoxHoverPen = hoverPen; + m_ComboBoxParameters.comboBoxOnPen = onPen; + m_ComboBoxParameters.comboBoxEditPen = editPen; + m_ComboBoxParameters.comboBoxDisablePen = disablePen; + m_ComboBoxParameters.comboBoxFocusPen = focusPen; } -void UKUIConfigStyleParameters::initConfigListParameters(bool isDark, const QStyleOption *option, const QWidget *widget) +void UKUIConfigStyleParameters::getDefaultConfigComboBoxParameters(ConfigComboBoxParameters *p, bool isDark) +{ + initConfigComboBoxParameters(isDark, nullptr, nullptr); + p->radius = m_ComboBoxParameters.radius ; + p->comboBoxDefaultBrush = m_ComboBoxParameters.comboBoxDefaultBrush; + p->comboBoxHoverBrush = m_ComboBoxParameters.comboBoxHoverBrush ; + p->comboBoxOnBrush = m_ComboBoxParameters.comboBoxOnBrush ; + p->comboBoxEditBrush = m_ComboBoxParameters.comboBoxEditBrush ; + p->comboBoxDisableBrush = m_ComboBoxParameters.comboBoxDisableBrush; + p->comboBoxDefaultPen = m_ComboBoxParameters.comboBoxDefaultPen ; + p->comboBoxHoverPen = m_ComboBoxParameters.comboBoxHoverPen ; + p->comboBoxOnPen = m_ComboBoxParameters.comboBoxOnPen ; + p->comboBoxEditPen = m_ComboBoxParameters.comboBoxEditPen ; + p->comboBoxDisablePen = m_ComboBoxParameters.comboBoxDisablePen ; + p->comboBoxFocusPen = m_ComboBoxParameters.comboBoxFocusPen ; +} + +void UKUIConfigStyleParameters::initConfigListParameters(bool isDark, const QStyleOption *option, const QWidget *widget, bool highlight) { int radius = (widget && widget->property("normalRadius").isValid()) ? widget->property("normalRadius").toInt() : m_radiusStruct.normalRadius; + QPalette palette = option ? option->palette : m_stylePalette; bool needTranslucent = false; - bool highlightMode = false; + bool highlightMode = highlight; if (widget && widget->property("highlightMode").isValid()) { highlightMode = widget->property("highlightMode").toBool(); } @@ -2077,7 +2230,7 @@ void UKUIConfigStyleParameters::initConfigListParameters(bool isDark, const QSty needTranslucent = widget->property("needTranslucent").toBool(); } - UKUIColorTheme::ListViewColorCfg listViewColorCfg = readCfg()->listViewColorCfg(option->palette, highlightMode ? + UKUIColorTheme::ListViewColorCfg listViewColorCfg = readCfg()->listViewColorCfg(palette, highlightMode ? C_ListView_Highlight : (needTranslucent ? C_ListView_Translucent : C_ListView_Default)); QBrush defaultBrush = listViewColorCfg.defaultBrush; @@ -2102,8 +2255,8 @@ void UKUIConfigStyleParameters::initConfigListParameters(bool isDark, const QSty QColor startColor; QColor endColor; QLinearGradient linearGradient; - linearGradient.setStart(option->rect.topLeft()); - linearGradient.setFinalStop(option->rect.bottomLeft()); + 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); @@ -2113,21 +2266,21 @@ void UKUIConfigStyleParameters::initConfigListParameters(bool isDark, const QSty } break; case AdjustColorRules::HSL: - hoverBrush = QBrush(highlightHover(isDark, option->palette)); - selectBrush = QBrush(highlightClick(isDark, option->palette)); + hoverBrush = QBrush(highlightHover(isDark, palette)); + selectBrush = QBrush(highlightClick(isDark, palette)); if(isDark) { - hoverPen = QPen(QBrush(adjustColor(option->palette.color(QPalette::Active, QPalette::Highlight), 0, -5, -15)), + hoverPen = QPen(QBrush(adjustColor(palette.color(QPalette::Active, QPalette::Highlight), 0, -5, -15)), 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin); } else { - hoverPen = QPen(QBrush(adjustColor(option->palette.color(QPalette::Active, QPalette::Highlight), 4, -14, 15)), + hoverPen = QPen(QBrush(adjustColor(palette.color(QPalette::Active, QPalette::Highlight), 4, -14, 15)), 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin); } if(isDark) { - selectPen = QPen(QBrush(option->palette.color(QPalette::Active, QPalette::Highlight)), + selectPen = QPen(QBrush(palette.color(QPalette::Active, QPalette::Highlight)), 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin); } else { - selectPen = QPen(QBrush(adjustColor(option->palette.color(QPalette::Active, QPalette::Highlight), 5, -21, 3)), + selectPen = QPen(QBrush(adjustColor(palette.color(QPalette::Active, QPalette::Highlight), 5, -21, 3)), 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin); } break; @@ -2198,16 +2351,52 @@ void UKUIConfigStyleParameters::initConfigListParameters(bool isDark, const QSty m_ListParameters.listFocusPen = focusPen; } -void UKUIConfigStyleParameters::initConfigTreeParameters(bool isDark, const QStyleOption *option, const QWidget *widget) +void UKUIConfigStyleParameters::getDefaultConfigListParameters(ConfigListParameters *p, bool isDark) +{ + initConfigListParameters(isDark, nullptr, nullptr); + + p->radius = m_ListParameters.radius ; + p->listDefaultBrush = m_ListParameters.listDefaultBrush ; + p->listHoverBrush = m_ListParameters.listHoverBrush ; + p->listSelectBrush = m_ListParameters.listSelectBrush ; + p->listDisableBrush = m_ListParameters.listDisableBrush ; + p->listTextHoverPen = m_ListParameters.listTextHoverPen ; + p->listTextSelectPen = m_ListParameters.listTextSelectPen ; + p->listTextDisablePen = m_ListParameters.listTextDisablePen ; + p->listHoverPen = m_ListParameters.listHoverPen ; + p->listSelectPen = m_ListParameters.listSelectPen ; + p->listFocusPen = m_ListParameters.listFocusPen ; +} + +void UKUIConfigStyleParameters::getHighlightModeConfigListParameters(ConfigListParameters *p, bool isDark) +{ + initConfigListParameters(isDark, nullptr, nullptr, true); + + p->radius = m_ListParameters.radius ; + p->listDefaultBrush = m_ListParameters.listDefaultBrush ; + p->listHoverBrush = m_ListParameters.listHoverBrush ; + p->listSelectBrush = m_ListParameters.listSelectBrush ; + p->listDisableBrush = m_ListParameters.listDisableBrush ; + p->listTextHoverPen = m_ListParameters.listTextHoverPen ; + p->listTextSelectPen = m_ListParameters.listTextSelectPen ; + p->listTextDisablePen = m_ListParameters.listTextDisablePen ; + p->listHoverPen = m_ListParameters.listHoverPen ; + p->listSelectPen = m_ListParameters.listSelectPen ; + p->listFocusPen = m_ListParameters.listFocusPen ; +} + +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; - bool highlightMode = false; + bool highlightMode = highlight; if (widget && widget->property("highlightMode").isValid()) { highlightMode = widget->property("highlightMode").toBool(); } - UKUIColorTheme::TreeViewColorCfg treeViewColorCfg = readCfg()->treeViewColorCfg(option->palette, + QPalette palette = option ? option->palette : m_stylePalette; + + UKUIColorTheme::TreeViewColorCfg treeViewColorCfg = readCfg()->treeViewColorCfg(palette, highlightMode ? C_TreeView_HighLight : C_TreeView_Default); QBrush defaultBrush = treeViewColorCfg.defaultBrush; @@ -2248,23 +2437,23 @@ void UKUIConfigStyleParameters::initConfigTreeParameters(bool isDark, const QSty } }break; case AdjustColorRules::HSL:{ - hoverBrush = QBrush(highlightHover(isDark, option->palette)); + hoverBrush = QBrush(highlightHover(isDark, palette)); branchHoverBrush = hoverBrush; - selectBrush = QBrush(highlightClick(isDark, option->palette)); + selectBrush = QBrush(highlightClick(isDark, palette)); if(isDark) { - hoverPen = QPen(QBrush(adjustColor(option->palette.color(QPalette::Active, QPalette::Highlight), 0, -5, -15)), + hoverPen = QPen(QBrush(adjustColor(palette.color(QPalette::Active, QPalette::Highlight), 0, -5, -15)), 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin); } else { - hoverPen = QPen(QBrush(adjustColor(option->palette.color(QPalette::Active, QPalette::Highlight), 4, -14, 15)), + hoverPen = QPen(QBrush(adjustColor(palette.color(QPalette::Active, QPalette::Highlight), 4, -14, 15)), 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin); } if(isDark) { - selectPen = QPen(QBrush(option->palette.color(QPalette::Active, QPalette::Highlight)), + selectPen = QPen(QBrush(palette.color(QPalette::Active, QPalette::Highlight)), 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin); } else { - selectPen = QPen(QBrush(adjustColor(option->palette.color(QPalette::Active, QPalette::Highlight), 5, -21, 3)), + selectPen = QPen(QBrush(adjustColor(palette.color(QPalette::Active, QPalette::Highlight), 5, -21, 3)), 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin); } }break; @@ -2342,7 +2531,7 @@ void UKUIConfigStyleParameters::initConfigTreeParameters(bool isDark, const QSty } } - m_TreeParameters.radius = radius; + m_TreeParameters.radius = radius; m_TreeParameters.treeDefaultBrush = defaultBrush; m_TreeParameters.treeHoverBrush = hoverBrush; m_TreeParameters.treeSelectBrush = selectBrush; @@ -2353,25 +2542,69 @@ void UKUIConfigStyleParameters::initConfigTreeParameters(bool isDark, const QSty m_TreeParameters.treeBranchSelectBrush = branchSelectBrush; m_TreeParameters.treeBranchDisableBrush = branchDisableBrush; - m_TreeParameters.treeHoverPen = hoverPen; - m_TreeParameters.treeSelectPen = selectPen; - m_TreeParameters.treeFocusPen = focusPen; - m_TreeParameters.treeTextHoverPen = textHoverPen; - m_TreeParameters.treeTextSelectPen = textSelectPen; + m_TreeParameters.treeHoverPen = hoverPen; + m_TreeParameters.treeSelectPen = selectPen; + m_TreeParameters.treeFocusPen = focusPen; + m_TreeParameters.treeTextHoverPen = textHoverPen; + m_TreeParameters.treeTextSelectPen = textSelectPen; m_TreeParameters.treeTextDisablePen = textDisablePen; } -void UKUIConfigStyleParameters::initConfigTableParameters(bool isDark, const QStyleOption *option, const QWidget *widget) +void UKUIConfigStyleParameters::getDefaultConfigTreeParameters(ConfigTreeParameters *p, bool isDark) +{ + initConfigTreeParameters(isDark, nullptr, nullptr); + + p->radius = m_TreeParameters.radius ; + p->treeDefaultBrush = m_TreeParameters.treeDefaultBrush ; + p->treeHoverBrush = m_TreeParameters.treeHoverBrush ; + p->treeSelectBrush = m_TreeParameters.treeSelectBrush ; + p->treeDisableBrush = m_TreeParameters.treeDisableBrush ; + p->treeBranchDefaultBrush = m_TreeParameters.treeBranchDefaultBrush; + p->treeBranchHoverBrush = m_TreeParameters.treeBranchHoverBrush ; + p->treeBranchSelectBrush = m_TreeParameters.treeBranchSelectBrush ; + p->treeBranchDisableBrush = m_TreeParameters.treeBranchDisableBrush; + p->treeHoverPen = m_TreeParameters.treeHoverPen ; + p->treeSelectPen = m_TreeParameters.treeSelectPen ; + p->treeFocusPen = m_TreeParameters.treeFocusPen ; + p->treeTextHoverPen = m_TreeParameters.treeTextHoverPen ; + p->treeTextSelectPen = m_TreeParameters.treeTextSelectPen ; + p->treeTextDisablePen = m_TreeParameters.treeTextDisablePen ; +} + +void UKUIConfigStyleParameters::getHighlightModeConfigTreeParameters(ConfigTreeParameters *p, bool isDark) +{ + initConfigTreeParameters(isDark, nullptr, nullptr, true); + + p->radius = m_TreeParameters.radius ; + p->treeDefaultBrush = m_TreeParameters.treeDefaultBrush ; + p->treeHoverBrush = m_TreeParameters.treeHoverBrush ; + p->treeSelectBrush = m_TreeParameters.treeSelectBrush ; + p->treeDisableBrush = m_TreeParameters.treeDisableBrush ; + p->treeBranchDefaultBrush = m_TreeParameters.treeBranchDefaultBrush; + p->treeBranchHoverBrush = m_TreeParameters.treeBranchHoverBrush ; + p->treeBranchSelectBrush = m_TreeParameters.treeBranchSelectBrush ; + p->treeBranchDisableBrush = m_TreeParameters.treeBranchDisableBrush; + p->treeHoverPen = m_TreeParameters.treeHoverPen ; + p->treeSelectPen = m_TreeParameters.treeSelectPen ; + p->treeFocusPen = m_TreeParameters.treeFocusPen ; + p->treeTextHoverPen = m_TreeParameters.treeTextHoverPen ; + p->treeTextSelectPen = m_TreeParameters.treeTextSelectPen ; + p->treeTextDisablePen = m_TreeParameters.treeTextDisablePen ; +} + +void UKUIConfigStyleParameters::initConfigTableParameters(bool isDark, const QStyleOption *option, const QWidget *widget, bool highlight) { int radius = (widget && widget->property("normalRadius").isValid()) ? widget->property("normalRadius").toInt() : m_radiusStruct.normalRadius; - bool highlightMode = false; + bool highlightMode = highlight; if (widget && widget->property("highlightMode").isValid()) { highlightMode = widget->property("highlightMode").toBool(); } - UKUIColorTheme::TableColorCfg tableColorCfg = readCfg()->tableColorCfg(option->palette, + QPalette palette = option ? option->palette : m_stylePalette; + + UKUIColorTheme::TableColorCfg tableColorCfg = readCfg()->tableColorCfg(palette, highlightMode ? C_Table_Highlight : C_Table_Default); QBrush defaultBrush = tableColorCfg.defaultBrush; @@ -2392,8 +2625,8 @@ void UKUIConfigStyleParameters::initConfigTableParameters(bool isDark, const QSt case AdjustColorRules::DefaultRGB:{ if(tableColorCfg.hoverType == Obj_Gradient_Type) { QLinearGradient linearGradient; - linearGradient.setStart(option->rect.topLeft()); - linearGradient.setFinalStop(option->rect.bottomLeft()); + 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); @@ -2404,22 +2637,22 @@ void UKUIConfigStyleParameters::initConfigTableParameters(bool isDark, const QSt } } break; case AdjustColorRules::HSL:{ - hoverBrush = QBrush(highlightHover(isDark, option->palette)); - selectBrush = QBrush(highlightClick(isDark, option->palette)); + hoverBrush = QBrush(highlightHover(isDark, palette)); + selectBrush = QBrush(highlightClick(isDark, palette)); if(isDark) { - hoverPen = QPen(QBrush(adjustColor(option->palette.color(QPalette::Active, QPalette::Highlight), 0, -5, -15)), + hoverPen = QPen(QBrush(adjustColor(palette.color(QPalette::Active, QPalette::Highlight), 0, -5, -15)), 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin); } else { - hoverPen = QPen(QBrush(adjustColor(option->palette.color(QPalette::Active, QPalette::Highlight), 4, -14, 15)), + hoverPen = QPen(QBrush(adjustColor(palette.color(QPalette::Active, QPalette::Highlight), 4, -14, 15)), 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin); } if (isDark) { - selectPen = QPen(QBrush(option->palette.color(QPalette::Active, QPalette::Highlight)), + selectPen = QPen(QBrush(palette.color(QPalette::Active, QPalette::Highlight)), 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin); } else { - selectPen = QPen(QBrush(adjustColor(option->palette.color(QPalette::Active, QPalette::Highlight), 5, -21, 3)), + selectPen = QPen(QBrush(adjustColor(palette.color(QPalette::Active, QPalette::Highlight), 5, -21, 3)), 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin); } } break; @@ -2477,28 +2710,62 @@ void UKUIConfigStyleParameters::initConfigTableParameters(bool isDark, const QSt } } - m_TableParameters.radius = radius; - m_TableParameters.tableDefaultBrush = defaultBrush; - m_TableParameters.tableHoverBrush = hoverBrush; - m_TableParameters.tableSelectBrush = selectBrush; - m_TableParameters.tableDisableBrush = disableBrush; - m_TableParameters.tableHoverPen = hoverPen; - m_TableParameters.tableSelectPen = selectPen; - m_TableParameters.tableFocusPen = focusPen; - - m_TableParameters.tableTextHoverPen = textHoverPen; - m_TableParameters.tableTextSelectPen = textSelectPen; + m_TableParameters.radius = radius; + m_TableParameters.tableDefaultBrush = defaultBrush; + m_TableParameters.tableHoverBrush = hoverBrush; + m_TableParameters.tableSelectBrush = selectBrush; + m_TableParameters.tableDisableBrush = disableBrush; + m_TableParameters.tableHoverPen = hoverPen; + m_TableParameters.tableSelectPen = selectPen; + m_TableParameters.tableFocusPen = focusPen; + m_TableParameters.tableTextHoverPen = textHoverPen; + m_TableParameters.tableTextSelectPen = textSelectPen; m_TableParameters.tableTextDisablePen = textDisablePen; } +void UKUIConfigStyleParameters::getDefaultConfigTableParameters(ConfigTableParameters *p, bool isDark) +{ + initConfigTableParameters(isDark, nullptr, nullptr); + + p->radius = m_TableParameters.radius ; + p->tableDefaultBrush = m_TableParameters.tableDefaultBrush ; + p->tableHoverBrush = m_TableParameters.tableHoverBrush ; + p->tableSelectBrush = m_TableParameters.tableSelectBrush ; + p->tableDisableBrush = m_TableParameters.tableDisableBrush ; + p->tableHoverPen = m_TableParameters.tableHoverPen ; + p->tableSelectPen = m_TableParameters.tableSelectPen ; + p->tableFocusPen = m_TableParameters.tableFocusPen ; + p->tableTextHoverPen = m_TableParameters.tableTextHoverPen ; + p->tableTextSelectPen = m_TableParameters.tableTextSelectPen ; + p->tableTextDisablePen = m_TableParameters.tableTextDisablePen; +} + +void UKUIConfigStyleParameters::getHighlightModeConfigTableParameters(ConfigTableParameters *p, bool isDark) +{ + initConfigTableParameters(isDark, nullptr, nullptr, true); + + p->radius = m_TableParameters.radius ; + p->tableDefaultBrush = m_TableParameters.tableDefaultBrush ; + p->tableHoverBrush = m_TableParameters.tableHoverBrush ; + p->tableSelectBrush = m_TableParameters.tableSelectBrush ; + p->tableDisableBrush = m_TableParameters.tableDisableBrush ; + p->tableHoverPen = m_TableParameters.tableHoverPen ; + p->tableSelectPen = m_TableParameters.tableSelectPen ; + p->tableFocusPen = m_TableParameters.tableFocusPen ; + p->tableTextHoverPen = m_TableParameters.tableTextHoverPen ; + p->tableTextSelectPen = m_TableParameters.tableTextSelectPen ; + p->tableTextDisablePen = m_TableParameters.tableTextDisablePen; +} + void UKUIConfigStyleParameters::initConfigCheckBoxParameters(bool isDark, const QStyleOption *option, const QWidget *widget) { bool needTranslucent = false; if (widget && widget->property("needTranslucent").isValid()) { needTranslucent = widget->property("needTranslucent").toBool(); } + QPalette palette = option ? option->palette : m_stylePalette; - UKUIColorTheme::CheckBoxColorCfg checkboxColorCfg = readCfg()->checkBoxColorCfg(option->palette, + UKUIColorTheme::CheckBoxColorCfg checkboxColorCfg = readCfg()->checkBoxColorCfg(palette, needTranslucent ? C_CheckBox_Translucent : C_CheckBox_Default); int radius = (widget && widget->property("minRadius").isValid()) ? @@ -2525,7 +2792,7 @@ void UKUIConfigStyleParameters::initConfigCheckBoxParameters(bool isDark, const bool onHoverBrushIslinearGradient = false; - QColor mix = option->palette.color(QPalette::Active, QPalette::BrightText); + QColor mix = palette.color(QPalette::Active, QPalette::BrightText); switch (m_adjustColorRules) { case AdjustColorRules::DefaultRGB:{ @@ -2533,8 +2800,8 @@ void UKUIConfigStyleParameters::initConfigCheckBoxParameters(bool isDark, const QColor startColor; QColor endColor; QLinearGradient linearGradient; - linearGradient.setStart(option->rect.topLeft()); - linearGradient.setFinalStop(option->rect.bottomLeft()); + 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); linearGradient.setColorAt(0, startColor); @@ -2547,12 +2814,12 @@ void UKUIConfigStyleParameters::initConfigCheckBoxParameters(bool isDark, const onClickBrush = QBrush(configMixColor(onDefaultBrush.color(), mix, isDark ? 0.05 : 0.2)); } else if (checkboxColorCfg.onHoverType == Obj_Gradient_Type) { //on default - QColor DefaultPenColor = option->palette.color(QPalette::Active, QPalette::Highlight); + QColor DefaultPenColor = palette.color(QPalette::Active, QPalette::Highlight); QColor onDefaultPenColor = configMixColor(DefaultPenColor, mix, 0.1); onDefaultPen = QPen(QBrush(onDefaultPenColor), 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin); - onDefaultBrush = option->palette.brush(QPalette::Active, QPalette::Highlight); + onDefaultBrush = palette.brush(QPalette::Active, QPalette::Highlight); if(needTranslucent) { - QColor onDefaultPenColor = option->palette.color(QPalette::Active, QPalette::BrightText); + QColor onDefaultPenColor = palette.color(QPalette::Active, QPalette::BrightText); onDefaultPenColor.setAlphaF(0.1); onDefaultPen = QPen(QBrush(onDefaultPenColor), 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin); } @@ -2563,8 +2830,8 @@ void UKUIConfigStyleParameters::initConfigCheckBoxParameters(bool isDark, const QColor startColor; QColor endColor; QLinearGradient linearGradient; - linearGradient.setStart(option->rect.topLeft()); - linearGradient.setFinalStop(option->rect.bottomLeft()); + linearGradient.setStart(!option ? QPoint(0,0) : option->rect.topLeft()); + linearGradient.setFinalStop(!option ? QPoint(0,0) : option->rect.bottomLeft()); if (isDark) { startColor = configMixColor(onDefaultBrush.color(), QColor(Qt::white), 0.2); endColor = configMixColor(onDefaultBrush.color(), QColor(Qt::black), 0.05); @@ -2576,7 +2843,7 @@ void UKUIConfigStyleParameters::initConfigCheckBoxParameters(bool isDark, const linearGradient.setColorAt(1, endColor); onHoverBrush = QBrush(linearGradient); if(needTranslucent) { - QColor onHoverPenColor = option->palette.color(QPalette::Active, QPalette::BrightText); + QColor onHoverPenColor = palette.color(QPalette::Active, QPalette::BrightText); onHoverPenColor.setAlphaF(0.2); onHoverPen = QPen(QBrush(onHoverPenColor), 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin); } @@ -2586,7 +2853,7 @@ void UKUIConfigStyleParameters::initConfigCheckBoxParameters(bool isDark, const onClickPen = QPen(QBrush(onClickPenColor), 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin); onClickBrush = QBrush(configMixColor(onDefaultBrush.color(), mix, 0.1)); if(needTranslucent) { - QColor onClickPenColor = option->palette.color(QPalette::Active, QPalette::BrightText); + QColor onClickPenColor = palette.color(QPalette::Active, QPalette::BrightText); onClickPenColor.setAlphaF(0.2); onClickPen = QPen(QBrush(onClickPenColor), 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin); } @@ -2595,7 +2862,7 @@ void UKUIConfigStyleParameters::initConfigCheckBoxParameters(bool isDark, const disablePen = defaultPen; } break; case AdjustColorRules::HSL:{ - normalButtonColor(isDark, option->palette, defaultPen, defaultBrush, hoverPen, hoverBrush, + 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); @@ -2727,12 +2994,38 @@ void UKUIConfigStyleParameters::initConfigCheckBoxParameters(bool isDark, const m_CheckBoxParameters.onHoverBrushIslinearGradient = onHoverBrushIslinearGradient; } +void UKUIConfigStyleParameters::getDefaultConfigCheckBoxParameters(ConfigCheckBoxParameters *p, bool isDark) +{ + initConfigCheckBoxParameters(isDark, nullptr, nullptr); + + p->radius = m_CheckBoxParameters.radius ; + p->checkBoxDefaultPen = m_CheckBoxParameters.checkBoxDefaultPen ; + p->checkBoxHoverPen = m_CheckBoxParameters.checkBoxHoverPen ; + p->checkBoxClickPen = m_CheckBoxParameters.checkBoxClickPen ; + p->checkBoxDisablePen = m_CheckBoxParameters.checkBoxDisablePen ; + p->checkBoxOnDefaultPen = m_CheckBoxParameters.checkBoxOnDefaultPen ; + p->checkBoxOnHoverPen = m_CheckBoxParameters.checkBoxOnHoverPen ; + p->checkBoxOnClickPen = m_CheckBoxParameters.checkBoxOnClickPen ; + p->checkBoxContentPen = m_CheckBoxParameters.checkBoxContentPen ; + p->checkBoxDefaultBrush = m_CheckBoxParameters.checkBoxDefaultBrush ; + p->checkBoxHoverBrush = m_CheckBoxParameters.checkBoxHoverBrush ; + p->checkBoxClickBrush = m_CheckBoxParameters.checkBoxClickBrush ; + p->checkBoxDisableBrush = m_CheckBoxParameters.checkBoxDisableBrush ; + p->checkBoxOnDefaultBrush = m_CheckBoxParameters.checkBoxOnDefaultBrush ; + p->checkBoxOnHoverBrush = m_CheckBoxParameters.checkBoxOnHoverBrush ; + p->checkBoxOnClickBrush = m_CheckBoxParameters.checkBoxOnClickBrush ; + p->checkBoxPathBrush = m_CheckBoxParameters.checkBoxPathBrush ; + p->checkBoxPathDisableBrush = m_CheckBoxParameters.checkBoxPathDisableBrush ; + p->onHoverBrushIslinearGradient = m_CheckBoxParameters.onHoverBrushIslinearGradient; +} + void UKUIConfigStyleParameters::initConfigRadioButtonParameters(bool isDark, const QStyleOption *option, const QWidget *widget) { m_RadioButtonParameters.radius = (widget && widget->property("normalRadius").isValid()) ? widget->property("normalRadius").toInt() : m_radiusStruct.normalRadius; + QPalette palette = option ? option->palette : m_stylePalette; - UKUIColorTheme::RadioButtonColorCfg radioButtonColorCfg = readCfg()->radioButtonColorCfg(option->palette, C_RadioButton_Default); + UKUIColorTheme::RadioButtonColorCfg radioButtonColorCfg = readCfg()->radioButtonColorCfg(palette, C_RadioButton_Default); QPen defaultPen = QPen(radioButtonColorCfg.defaultPen, 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin); QPen hoverPen = QPen(radioButtonColorCfg.hoverPen, 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin); QPen clickPen = QPen(radioButtonColorCfg.clickPen, 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin); @@ -2755,8 +3048,8 @@ void UKUIConfigStyleParameters::initConfigRadioButtonParameters(bool isDark, con if (radioButtonColorCfg.onHoverType == Obj_Gradient_Type) { QLinearGradient linearGradient; - linearGradient.setStart(option->rect.topLeft()); - linearGradient.setFinalStop(option->rect.bottomLeft()); + 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)); onHoverBrush = QBrush(linearGradient); @@ -2764,8 +3057,9 @@ void UKUIConfigStyleParameters::initConfigRadioButtonParameters(bool isDark, con switch (m_adjustColorRules) { case AdjustColorRules::DefaultRGB:{ - QColor mix = option->palette.color(QPalette::Active, QPalette::BrightText); + QColor mix = palette.color(QPalette::Active, QPalette::BrightText); + if(option) m_RadioButtonParameters.childrenRadius = (qstyleoption_cast(option)->rect.adjusted(1, 1, -1, -1).width()) / 2 - 2; @@ -2799,8 +3093,8 @@ void UKUIConfigStyleParameters::initConfigRadioButtonParameters(bool isDark, con QColor startColor; QColor endColor; QLinearGradient linearGradient; - linearGradient.setStart(option->rect.topLeft()); - linearGradient.setFinalStop(option->rect.bottomLeft()); + linearGradient.setStart(!option ? QPoint(0,0) : option->rect.topLeft()); + linearGradient.setFinalStop(!option ? QPoint(0,0) : option->rect.bottomLeft()); if (isDark) { startColor = configMixColor(onDefaultBrush.color(), QColor(Qt::white), 0.2); endColor = configMixColor(onDefaultBrush.color(), QColor(Qt::black), 0.05); @@ -2823,7 +3117,7 @@ void UKUIConfigStyleParameters::initConfigRadioButtonParameters(bool isDark, con break; } case AdjustColorRules::HSL:{ - normalButtonColor(isDark, option->palette, defaultPen, defaultBrush, hoverPen, hoverBrush, + normalButtonColor(isDark, palette, defaultPen, defaultBrush, hoverPen, hoverBrush, clickPen, clickBrush, disablePen, disableBrush); defaultPen = QPen(radioButtonColorCfg.defaultPen, 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin); @@ -2841,6 +3135,7 @@ void UKUIConfigStyleParameters::initConfigRadioButtonParameters(bool isDark, con onClickPen = clickPen; onClickBrush = clickBrush; + if(option) m_RadioButtonParameters.childrenRadius = (qstyleoption_cast(option)->rect.width()) / 2; break; } @@ -2951,15 +3246,40 @@ void UKUIConfigStyleParameters::initConfigRadioButtonParameters(bool isDark, con m_RadioButtonParameters.radioButtonChildrenOnDisableBrush = childrenOnDisableBrush; } +void UKUIConfigStyleParameters::getDefaultConfigRadioButtonParameters(ConfigRadioButtonParameters *p, bool isDark) +{ + initConfigRadioButtonParameters(isDark, nullptr, nullptr); + p->radioButtonDefaultPen = m_RadioButtonParameters.radioButtonDefaultPen ; + p->radioButtonHoverPen = m_RadioButtonParameters.radioButtonHoverPen ; + p->radioButtonClickPen = m_RadioButtonParameters.radioButtonClickPen ; + p->radioButtonDisablePen = m_RadioButtonParameters.radioButtonDisablePen ; + p->radioButtonOnDefaultPen = m_RadioButtonParameters.radioButtonOnDefaultPen ; + p->radioButtonOnHoverPen = m_RadioButtonParameters.radioButtonOnHoverPen ; + p->radioButtonOnClickPen = m_RadioButtonParameters.radioButtonOnClickPen ; + p->radioButtonDefaultBrush = m_RadioButtonParameters.radioButtonDefaultBrush ; + p->radioButtonHoverBrush = m_RadioButtonParameters.radioButtonHoverBrush ; + p->radioButtonClickBrush = m_RadioButtonParameters.radioButtonClickBrush ; + p->radioButtonDisableBrush = m_RadioButtonParameters.radioButtonDisableBrush ; + p->radioButtonOnDefaultBrush = m_RadioButtonParameters.radioButtonOnDefaultBrush ; + p->radioButtonOnHoverBrush = m_RadioButtonParameters.radioButtonOnHoverBrush ; + p->radioButtonOnClickBrush = m_RadioButtonParameters.radioButtonOnClickBrush ; + p->radioButtonChildrenOnDefaultBrush = m_RadioButtonParameters.radioButtonChildrenOnDefaultBrush; + p->radioButtonChildrenOnHoverBrush = m_RadioButtonParameters.radioButtonChildrenOnHoverBrush ; + p->radioButtonChildrenOnClickBrush = m_RadioButtonParameters.radioButtonChildrenOnClickBrush ; + p->radioButtonChildrenOnDisableBrush = m_RadioButtonParameters.radioButtonChildrenOnDisableBrush; +} + void UKUIConfigStyleParameters::initConfigSliderParameters(bool isDark, const QStyleOption *option, const QWidget *widget) { + QPalette palette = option ? option->palette : m_stylePalette; + int grooveRadius = Slider_GrooveLength/2; bool needTranslucent = false; if (widget && widget->property("needTranslucent").isValid()) { needTranslucent = widget->property("needTranslucent").toBool(); } - UKUIColorTheme::SliderBarColorCfg sliderColorCfg = readCfg()->sliderBarColorCfg(option->palette, + UKUIColorTheme::SliderBarColorCfg sliderColorCfg = readCfg()->sliderBarColorCfg(palette, needTranslucent ? C_SliderBar_Translucent : C_SliderBar_Default); QBrush handleDefaultBrush = sliderColorCfg.handleDefaultBrush; @@ -2992,15 +3312,15 @@ void UKUIConfigStyleParameters::initConfigSliderParameters(bool isDark, const QS widget->property("normalRadius").toInt() : m_radiusStruct.normalRadius; const QStyleOptionSlider *slider = qstyleoption_cast(option); - const bool horizontal = slider->orientation == Qt::Horizontal; + const bool horizontal = slider ? slider->orientation == Qt::Horizontal : false; switch (m_adjustColorRules) { case AdjustColorRules::DefaultRGB:{ - QRect handleRect = option->rect; + QRect handleRect = option ? option->rect : QRect(0,0,0,0); handlePath.addEllipse(handleRect); - QColor highlight = option->palette.color(QPalette::Active, QPalette::Highlight); - QColor mix = option->palette.color(QPalette::Active, QPalette::BrightText); + QColor highlight = palette.color(QPalette::Active, QPalette::Highlight); + QColor mix = palette.color(QPalette::Active, QPalette::BrightText); if (sliderColorCfg.handleHoverType == Obj_Color_Type) { //handle hover @@ -3014,12 +3334,12 @@ void UKUIConfigStyleParameters::initConfigSliderParameters(bool isDark, const QS QColor startColor; QColor endColor; QLinearGradient linearGradient; - if (slider->orientation == Qt::Vertical) { - linearGradient.setStart(option->rect.topRight()); - linearGradient.setFinalStop(option->rect.topLeft()); + if (!horizontal) { + linearGradient.setStart(!option ? QPoint(0,0) : option->rect.topRight()); + linearGradient.setFinalStop(!option ? QPoint(0,0) : option->rect.topLeft()); } else { - linearGradient.setStart(option->rect.topLeft()); - linearGradient.setFinalStop(option->rect.bottomLeft()); + linearGradient.setStart(!option ? QPoint(0,0) : option->rect.topLeft()); + linearGradient.setFinalStop(!option ? QPoint(0,0) : option->rect.bottomLeft()); } if (isDark) { @@ -3054,29 +3374,29 @@ void UKUIConfigStyleParameters::initConfigSliderParameters(bool isDark, const QS } break; case AdjustColorRules::HSL:{ if (isDark) { - handleDefaultPen = adjustColor(option->palette.color(QPalette::Active, QPalette::Highlight), 0, -5, -15); + handleDefaultPen = adjustColor(palette.color(QPalette::Active, QPalette::Highlight), 0, -5, -15); } else { - handleDefaultPen = adjustColor(option->palette.color(QPalette::Active, QPalette::Highlight), 5, -21, 3); + handleDefaultPen = adjustColor(palette.color(QPalette::Active, QPalette::Highlight), 5, -21, 3); } handleDefaultPen.setWidth(1); handleHoverPen = handleDefaultPen; handleHoverPen.setWidth(1); - handleHoverBrush = highlightHover(isDark, option->palette); + handleHoverBrush = highlightHover(isDark, palette); //handle click handleClickPen = handleDefaultPen; handleHoverPen.setWidth(1); - handleClickBrush = highlightClick(isDark, option->palette); + handleClickBrush = highlightClick(isDark, palette); if (isDark) { - grooveValueDefaultBrush = adjustColor(option->palette.color(QPalette::Active, QPalette::Highlight), 0, -5, -15); + grooveValueDefaultBrush = adjustColor(palette.color(QPalette::Active, QPalette::Highlight), 0, -5, -15); } else { - grooveValueDefaultBrush = option->palette.color(QPalette::Active, QPalette::Highlight); + grooveValueDefaultBrush = palette.color(QPalette::Active, QPalette::Highlight); } //groove value hover grooveValueHoverBrush = grooveValueDefaultBrush; - QRect handleRect = option->rect; + QRect handleRect = !option ? QRect(0,0,0,0) : option->rect; if (horizontal) { handlePath.moveTo(handleRect.left(), handleRect.top()); handlePath.lineTo(handleRect.left(), handleRect.top() + (2 * (handleRect.height())/3)); @@ -3207,8 +3527,33 @@ void UKUIConfigStyleParameters::initConfigSliderParameters(bool isDark, const QS m_SliderParameters.sliderHandlePath = handlePath; } +void UKUIConfigStyleParameters::getDefaultSliderParameters(ConfigSliderParameters *p, bool isDark) +{ + initConfigSliderParameters(isDark, nullptr, nullptr); + p->radius = m_SliderParameters.radius ; + p->sliderGrooveRadius = m_SliderParameters.sliderGrooveRadius ; + p->sliderHandleDefaultBrush = m_SliderParameters.sliderHandleDefaultBrush ; + p->sliderHandleHoverBrush = m_SliderParameters.sliderHandleHoverBrush ; + p->sliderHandleClickBrush = m_SliderParameters.sliderHandleClickBrush ; + p->sliderHandleDisableBrush = m_SliderParameters.sliderHandleDisableBrush ; + p->sliderGrooveValueDefaultBrush = m_SliderParameters.sliderGrooveValueDefaultBrush ; + p->sliderGrooveValueHoverBrush = m_SliderParameters.sliderGrooveValueHoverBrush ; + p->sliderGrooveValueDisableBrush = m_SliderParameters.sliderGrooveValueDisableBrush ; + p->sliderGrooveUnvalueDefaultBrush = m_SliderParameters.sliderGrooveUnvalueDefaultBrush; + p->sliderGrooveUnvalueHoverBrush = m_SliderParameters.sliderGrooveUnvalueHoverBrush ; + p->sliderGrooveUnvalueDisableBrush = m_SliderParameters.sliderGrooveUnvalueDisableBrush; + p->sliderHandleDefaultPen = m_SliderParameters.sliderHandleDefaultPen ; + p->sliderHandleHoverPen = m_SliderParameters.sliderHandleHoverPen ; + p->sliderHandleClickPen = m_SliderParameters.sliderHandleClickPen ; + p->sliderHandleDisablePen = m_SliderParameters.sliderHandleDisablePen ; + p->sliderGroovePen = m_SliderParameters.sliderGroovePen ; + p->focusPen = m_SliderParameters.focusPen ; +} + void UKUIConfigStyleParameters::initConfigProgressBarParameters(bool isDark, const QStyleOption *option, const QWidget *widget) { + QPalette palette = option ? option->palette : m_stylePalette; + int normalRadius = (widget && widget->property("normalRadius").isValid()) ? widget->property("normalRadius").toInt() : m_radiusStruct.normalRadius; int radius = widget ? (widget->height() / 2 > normalRadius ? normalRadius : widget->height() / 2) : normalRadius; @@ -3217,7 +3562,7 @@ void UKUIConfigStyleParameters::initConfigProgressBarParameters(bool isDark, con if (widget && widget->property("needTranslucent").isValid()) { needTranslucent = widget->property("needTranslucent").toBool(); } - UKUIColorTheme::ProgressBarColorCfg progressColorCfg = readCfg()->progressBarColorCfg(option->palette, + UKUIColorTheme::ProgressBarColorCfg progressColorCfg = readCfg()->progressBarColorCfg(palette, needTranslucent ? C_ProgressBar_Translucent : C_ProgressBar_Default); QBrush contentBrush = progressColorCfg.contentBrush; @@ -3232,10 +3577,10 @@ void UKUIConfigStyleParameters::initConfigProgressBarParameters(bool isDark, con progressColorCfg.grooveDisablePen == Qt::NoPen) ? 0 : 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin); const QStyleOptionProgressBar *pb = qstyleoption_cast(option); - const bool vertical = pb->orientation == Qt::Vertical; - const bool inverted = pb->invertedAppearance; + const bool vertical = pb ? pb->orientation == Qt::Vertical : false; + const bool inverted = pb ? pb->invertedAppearance : false; - bool reverse = (!vertical && (pb->direction == Qt::RightToLeft)) || vertical; + bool reverse = (!vertical && pb && (pb->direction == Qt::RightToLeft)) || vertical; if (inverted) reverse = !reverse; QColor startColor = progressColorCfg.contentStartColor; @@ -3251,19 +3596,19 @@ void UKUIConfigStyleParameters::initConfigProgressBarParameters(bool isDark, con linearGradient.setColorAt(1, endColor); if (vertical) { if (reverse) { - linearGradient.setStart(pb->rect.bottomLeft()); - linearGradient.setFinalStop(pb->rect.topLeft()); + linearGradient.setStart(!pb ? QPoint(0, 0) : pb->rect.bottomLeft()); + linearGradient.setFinalStop(!pb ? QPoint(0, 0) : pb->rect.topLeft()); } else { - linearGradient.setStart(pb->rect.topLeft()); - linearGradient.setFinalStop(pb->rect.bottomLeft()); + linearGradient.setStart(!pb ? QPoint(0, 0) : pb->rect.topLeft()); + linearGradient.setFinalStop(!pb ? QPoint(0, 0) : pb->rect.bottomLeft()); } } else { if (reverse) { - linearGradient.setStart(pb->rect.topRight()); + linearGradient.setStart(!pb ? QPoint(0, 0) : pb->rect.topRight()); linearGradient.setFinalStop(pb->rect.topLeft()); } else { - linearGradient.setStart(pb->rect.topLeft()); - linearGradient.setFinalStop(pb->rect.topRight()); + linearGradient.setStart(!pb ? QPoint(0, 0) : pb->rect.topLeft()); + linearGradient.setFinalStop(!pb ? QPoint(0, 0) : pb->rect.topRight()); } } contentBrush = QBrush(linearGradient); @@ -3271,7 +3616,7 @@ void UKUIConfigStyleParameters::initConfigProgressBarParameters(bool isDark, con case AdjustColorRules::HSL: //content if(isDark) - contentBrush = QBrush(adjustColor(option->palette.color(QPalette::Active, QPalette::Highlight), -1, 15, -14)); + contentBrush = QBrush(adjustColor(palette.color(QPalette::Active, QPalette::Highlight), -1, 15, -14)); endColor = contentBrush.color(); startColor = contentBrush.color(); @@ -3334,14 +3679,30 @@ void UKUIConfigStyleParameters::initConfigProgressBarParameters(bool isDark, con m_ProgressBarParameters.progressBarContentMidLightColor = startColor; } +void UKUIConfigStyleParameters::getDefaultProgressBarParameters(ConfigProgressBarParameters *p, bool isDark) +{ + initConfigProgressBarParameters(isDark, nullptr, nullptr); + p->radius = m_ProgressBarParameters.radius ; + p->progressBarContentPen = m_ProgressBarParameters.progressBarContentPen ; + p->progressBarGrooveDefaultPen = m_ProgressBarParameters.progressBarGrooveDefaultPen ; + p->progressBarGrooveDisablePen = m_ProgressBarParameters.progressBarGrooveDisablePen ; + p->progressBarContentBrush = m_ProgressBarParameters.progressBarContentBrush ; + p->progressBarGrooveDefaultBrush = m_ProgressBarParameters.progressBarGrooveDefaultBrush ; + p->progressBarGrooveDisableBrush = m_ProgressBarParameters.progressBarGrooveDisableBrush ; + p->progressBarContentHightColor = m_ProgressBarParameters.progressBarContentHightColor ; + p->progressBarContentMidLightColor = m_ProgressBarParameters.progressBarContentMidLightColor; +} + void UKUIConfigStyleParameters::initConfigScrollBarParameters(bool isDark, const QStyleOption *option, const QWidget *widget) { + QPalette palette = option ? option->palette : m_stylePalette; + int sliderRadius; bool needTranslucent = false; if (widget && widget->property("needTranslucent").isValid()) { needTranslucent = widget->property("needTranslucent").toBool(); } - UKUIColorTheme::ScrollBarColorCfg scrollBarColorCfg = readCfg()->scrollBarColorCfg(option->palette, + UKUIColorTheme::ScrollBarColorCfg scrollBarColorCfg = readCfg()->scrollBarColorCfg(palette, needTranslucent ? C_ScrollBar_Translucent : C_ScrollBar_Default); QBrush grooveDefaultBrush = scrollBarColorCfg.grooveDefaultBrush; @@ -3351,14 +3712,14 @@ void UKUIConfigStyleParameters::initConfigScrollBarParameters(bool isDark, const QBrush sliderClickBrush = scrollBarColorCfg.sliderClickBrush; QBrush sliderDisableBrush = scrollBarColorCfg.sliderDisableBrush; - QColor mix = option->palette.color(QPalette::Active, QPalette::BrightText); + QColor mix = palette.color(QPalette::Active, QPalette::BrightText); const QStyleOptionSlider *bar = qstyleoption_cast(option); //radius int normalRadius = (widget && widget->property("normalRadius").isValid()) ? widget->property("normalRadius").toInt() : m_radiusStruct.normalRadius; - if (normalRadius != 0) { + if (bar && normalRadius != 0) { if (bar->orientation == Qt::Horizontal) { sliderRadius = (bar->rect.height()) / 4; } else { @@ -3385,12 +3746,12 @@ void UKUIConfigStyleParameters::initConfigScrollBarParameters(bool isDark, const case AdjustColorRules::DefaultRGB: if (!needTranslucent) { if (scrollBarColorCfg.sliderHoverType == Obj_Gradient_Type) { - if (bar->orientation == Qt::Horizontal) { - linearGradient.setStart(option->rect.topLeft()); - linearGradient.setFinalStop(option->rect.bottomLeft()); + if (bar && bar->orientation == Qt::Horizontal) { + linearGradient.setStart(!option ? QPoint(0,0) : option->rect.topLeft()); + linearGradient.setFinalStop(!option ? QPoint(0,0) : option->rect.bottomLeft()); } else { - linearGradient.setStart(option->rect.topRight()); - linearGradient.setFinalStop(option->rect.topLeft()); + 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); @@ -3449,9 +3810,23 @@ void UKUIConfigStyleParameters::initConfigScrollBarParameters(bool isDark, const m_ScrollBarParameters.scrollBarSliderDisableBrush = sliderDisableBrush; } +void UKUIConfigStyleParameters::getDefaultScrollBarParameters(ConfigScrollBarParameters *p, bool isDark) +{ + initConfigScrollBarParameters(isDark, nullptr, nullptr); + p->radius = m_ScrollBarParameters.radius ; + p->scrollBarGrooveDefaultBrush = m_ScrollBarParameters.scrollBarGrooveDefaultBrush ; + p->scrollBarGrooveInactiveBrush = m_ScrollBarParameters.scrollBarGrooveInactiveBrush; + p->scrollBarSliderDefaultBrush = m_ScrollBarParameters.scrollBarSliderDefaultBrush ; + p->scrollBarSliderHoverBrush = m_ScrollBarParameters.scrollBarSliderHoverBrush ; + p->scrollBarSliderClickBrush = m_ScrollBarParameters.scrollBarSliderClickBrush ; + p->scrollBarSliderDisableBrush = m_ScrollBarParameters.scrollBarSliderDisableBrush ; +} + void UKUIConfigStyleParameters::initConfigToolTipParameters(bool isDark, const QStyleOption *option, const QWidget *widget) { - UKUIColorTheme::ToolTipColorCfg tooltipColorCfg = readCfg()->toolTipColorCfg(option->palette, C_ToolTip_Default); + QPalette palette = option ? option->palette : m_stylePalette; + + UKUIColorTheme::ToolTipColorCfg tooltipColorCfg = readCfg()->toolTipColorCfg(palette, C_ToolTip_Default); QPen backgroundPen = QPen(tooltipColorCfg.backgroundPen, (tooltipColorCfg.backgroundPen.alpha() == 0 || tooltipColorCfg.backgroundPen == Qt::NoPen ) ? 0 : 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin); @@ -3509,11 +3884,21 @@ void UKUIConfigStyleParameters::initConfigToolTipParameters(bool isDark, const Q m_ToolTipParameters.toolTipBackgroundPen = backgroundPen; } +void UKUIConfigStyleParameters::getDefaultToolTipParameters(ConfigToolTipParameters *p, bool isDark) +{ + initConfigToolTipParameters(isDark, nullptr, nullptr); + p->radius = m_ToolTipParameters.radius ; + p->toolTipBackgroundBrush = m_ToolTipParameters.toolTipBackgroundBrush; + p->toolTipBackgroundPen = m_ToolTipParameters.toolTipBackgroundPen ; +} + void UKUIConfigStyleParameters::initConfigTabWidgetParameters(bool isDark, const QStyleOption *option, const QWidget *widget) { + QPalette palette = option ? option->palette : m_stylePalette; + int tabradius = (widget && widget->property("normalRadius").isValid()) ? widget->property("normalRadius").toInt() : m_radiusStruct.normalRadius; - UKUIColorTheme::TabWidgetColorCfg tabWidgetColorCfg = readCfg()->tabWidgetColorCfg(option->palette, C_TabWidget_Default); + UKUIColorTheme::TabWidgetColorCfg tabWidgetColorCfg = readCfg()->tabWidgetColorCfg(palette, C_TabWidget_Default); QBrush widgetBackgroundBrush = tabWidgetColorCfg.widgetBackgroundBrush; QBrush tabBarBackgroundBrush = tabWidgetColorCfg.tabBarBackgroundBrush; @@ -3535,8 +3920,8 @@ void UKUIConfigStyleParameters::initConfigTabWidgetParameters(bool isDark, const QColor startColor; QColor endColor; QLinearGradient linearGradient; - linearGradient.setStart(option->rect.topLeft()); - linearGradient.setFinalStop(option->rect.bottomLeft()); + 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); linearGradient.setColorAt(0, startColor); @@ -3545,30 +3930,30 @@ void UKUIConfigStyleParameters::initConfigTabWidgetParameters(bool isDark, const } break; case AdjustColorRules::HSL:{ - bool selected = option->state & QStyle::State_Selected; - bool hover = option->state & QStyle::State_MouseOver; - bool click = option->state & (QStyle::State_On | QStyle::State_Sunken); + bool selected = !option ? QStyle::State_None : (option->state & QStyle::State_Selected); + bool hover = !option ? QStyle::State_None : (option->state & QStyle::State_MouseOver); + bool click = !option ? QStyle::State_None : (option->state & (QStyle::State_On | QStyle::State_Sunken)); if (isDark) { - tabBarHoverBrush = highlightHover(isDark, option->palette); - tabBarClickBrush = highlightClick(isDark, option->palette); + tabBarHoverBrush = highlightHover(isDark, palette); + tabBarClickBrush = highlightClick(isDark, palette); if (click) { - tabBarClickPen = QPen(QBrush(option->palette.color(QPalette::Active, QPalette::Highlight)), + tabBarClickPen = QPen(QBrush(palette.color(QPalette::Active, QPalette::Highlight)), 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin); } else if(hover && !selected) { - tabBarHoverPen = QPen(QBrush(adjustColor(option->palette.color(QPalette::Active, QPalette::Highlight), 0, -5, -15)), + tabBarHoverPen = QPen(QBrush(adjustColor(palette.color(QPalette::Active, QPalette::Highlight), 0, -5, -15)), 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin); } } else { - tabBarHoverBrush = highlightHover(isDark, option->palette); - tabBarClickBrush = highlightClick(isDark, option->palette); + tabBarHoverBrush = highlightHover(isDark, palette); + tabBarClickBrush = highlightClick(isDark, palette); if(click){ - tabBarClickPen = QPen(QBrush(adjustColor(option->palette.color(QPalette::Active, QPalette::Highlight), 1, -21, 3)), + tabBarClickPen = QPen(QBrush(adjustColor(palette.color(QPalette::Active, QPalette::Highlight), 1, -21, 3)), 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin); } else if(hover && !selected){ - tabBarHoverPen = QPen(QBrush(adjustColor(option->palette.color(QPalette::Active, QPalette::Highlight), 4, -14, 15)), + tabBarHoverPen = QPen(QBrush(adjustColor(palette.color(QPalette::Active, QPalette::Highlight), 4, -14, 15)), 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin); } } @@ -3644,8 +4029,27 @@ void UKUIConfigStyleParameters::initConfigTabWidgetParameters(bool isDark, const m_TabWidgetParameters.tabBarFocusPen = tabBarFocusPen; } +void UKUIConfigStyleParameters::getDefaultTabWidgetParameters(ConfigTabWidgetParameters *p, bool isDark) +{ + initConfigTabWidgetParameters(isDark, nullptr, nullptr); + + p->radius = m_TabWidgetParameters.radius ; + p->tabWidgetBackgroundBrush = m_TabWidgetParameters.tabWidgetBackgroundBrush; + p->tabBarBackgroundBrush = m_TabWidgetParameters.tabBarBackgroundBrush ; + p->tabBarDefaultBrush = m_TabWidgetParameters.tabBarDefaultBrush ; + p->tabBarHoverBrush = m_TabWidgetParameters.tabBarHoverBrush ; + p->tabBarClickBrush = m_TabWidgetParameters.tabBarClickBrush ; + p->tabBarSelectBrush = m_TabWidgetParameters.tabBarSelectBrush ; + p->tabBarDefaultPen = m_TabWidgetParameters.tabBarDefaultPen ; + p->tabBarHoverPen = m_TabWidgetParameters.tabBarHoverPen ; + p->tabBarClickPen = m_TabWidgetParameters.tabBarClickPen ; + p->tabBarFocusPen = m_TabWidgetParameters.tabBarFocusPen ; +} + void UKUIConfigStyleParameters::initConfigMenuParameters(bool isDark, const QStyleOption *option, const QWidget *widget) { + QPalette palette = option ? option->palette : m_stylePalette; + int frameradius = (widget && widget->property("maxRadius").isValid()) ? widget->property("maxRadius").toInt() : m_radiusStruct.maxRadius; @@ -3656,7 +4060,7 @@ void UKUIConfigStyleParameters::initConfigMenuParameters(bool isDark, const QSty int itemradius = (widget && widget->property("normalRadius").isValid()) ? widget->property("normalRadius").toInt() : m_radiusStruct.normalRadius; // QPixmap framePixmap(option->rect.size()); - UKUIColorTheme::MenuColorCfg menuColorCfg = readCfg()->menuColorCfg(option->palette, C_Menu_Default); + UKUIColorTheme::MenuColorCfg menuColorCfg = readCfg()->menuColorCfg(palette, C_Menu_Default); QPen menuBackgroundPen = QPen(menuColorCfg.menuBackgroundPen, (menuColorCfg.menuBackgroundPen.alpha() == 0 || menuColorCfg.menuBackgroundPen == Qt::NoPen ) ? 0 : 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin); @@ -3669,9 +4073,9 @@ void UKUIConfigStyleParameters::initConfigMenuParameters(bool isDark, const QSty switch (m_adjustColorRules) { case HSL: if(isDark) { - itemSelectBrush = adjustColor(option->palette.color(QPalette::Active, QPalette::Highlight), 3, 23, -11); + itemSelectBrush = adjustColor(palette.color(QPalette::Active, QPalette::Highlight), 3, 23, -11); } else { - itemSelectBrush = adjustColor(option->palette.color(QPalette::Active, QPalette::Highlight), 4, -17, -6); + itemSelectBrush = adjustColor(palette.color(QPalette::Active, QPalette::Highlight), 4, -17, -6); } break; default: @@ -3747,3 +4151,15 @@ void UKUIConfigStyleParameters::initConfigMenuParameters(bool isDark, const QSty m_MenuParameters.menuItemFocusPen = menuItemFocusPen; m_MenuParameters.menuTextHoverPen = menuHoverPen; } + +void UKUIConfigStyleParameters::getDefaultMenuParameters(ConfigMenuParameters *p, bool isDark) +{ + initConfigTabWidgetParameters(isDark, nullptr, nullptr); + p->frameRadius = m_MenuParameters.frameRadius ; + p->itemRadius = m_MenuParameters.itemRadius ; + p->menuBackgroundBrush = m_MenuParameters.menuBackgroundBrush; + p->menuBackgroundPen = m_MenuParameters.menuBackgroundPen ; + p->menuItemSelectBrush = m_MenuParameters.menuItemSelectBrush; + p->menuItemFocusPen = m_MenuParameters.menuItemFocusPen ; + p->menuTextHoverPen = m_MenuParameters.menuTextHoverPen ; +} diff --git a/ukui-styles/qt5-config-style-ukui/ukui-config-style-parameters.h b/ukui-styles/qt5-config-style-ukui/ukui-config-style-parameters.h index 4fa3b67..44e81de 100644 --- a/ukui-styles/qt5-config-style-ukui/ukui-config-style-parameters.h +++ b/ukui-styles/qt5-config-style-ukui/ukui-config-style-parameters.h @@ -81,7 +81,7 @@ public: int getTabBarIndicatorLayout(); void setTabBarIndicatorLayout(TabBarIndicatorLayout layout); - void setUKUIThemeColor(QString themeColor); + void setUKUIThemeColor(QPalette p, QString themeColor); QString themeColor(); bool isDefaultThemeColor(); @@ -92,39 +92,62 @@ public: //pushbutton virtual void initConfigPushButtonBevelParameters(bool isDark, const QStyleOption *option, const QWidget *widget); + virtual void getDefaultConfigPushButtonBevelParameters(ConfigPushButtonParameters *p, bool isDark); + virtual void initConfigPushButtonLabelParameters(bool isDark, const QStyleOption *option, const QWidget *widget); + virtual void getDefaultConfigPushButtonLabelParameters(ConfigPushButtonParameters *p, bool isDark); //toolbutton virtual void initConfigToolButtonPanelParameters(bool isDark, const QStyleOption *option, const QWidget *widget); + virtual void getDefaultConfigToolButtonPanelParameters(ConfigToolButtonParameters *p, bool isDark); + virtual void initConfigToolButtonLabelParameters(bool isDark, const QStyleOption *option, const QWidget *widget); + virtual void getDefaultConfigToolButtonLabelParameters(ConfigToolButtonParameters *p, bool isDark); virtual void initConfigLineEditParameters(bool isDark, const QStyleOption *option, const QWidget *widget); + virtual void getDefaultConfigLineEditParameters(ConfigLineEditParameters *p, bool isDark); virtual void initConfigSpinBoxParameters(bool isDark, const QStyleOption *option, const QWidget *widget, bool isHorizonLayout = false); + virtual void getDefaultConfigSpinBoxParameters(ConfigSpinBoxParameters *p, bool isDark); virtual void initConfigComboBoxParameters(bool isDark, const QStyleOption *option, const QWidget *widget); + virtual void getDefaultConfigComboBoxParameters(ConfigComboBoxParameters *p, bool isDark); - virtual void initConfigListParameters(bool isDark, const QStyleOption *option, const QWidget *widget); + virtual void initConfigListParameters(bool isDark, const QStyleOption *option, const QWidget *widget, bool highlightmode = false); + virtual void getDefaultConfigListParameters(ConfigListParameters *p, bool isDark); + virtual void getHighlightModeConfigListParameters(ConfigListParameters *p, bool isDark); - virtual void initConfigTreeParameters(bool isDark, const QStyleOption *option, const QWidget *widget); + virtual void initConfigTreeParameters(bool isDark, const QStyleOption *option, const QWidget *widget, bool highlightmode = false); + virtual void getDefaultConfigTreeParameters(ConfigTreeParameters *p, bool isDark); + virtual void getHighlightModeConfigTreeParameters(ConfigTreeParameters *p, bool isDark); - virtual void initConfigTableParameters(bool isDark, const QStyleOption *option, const QWidget *widget); + virtual void initConfigTableParameters(bool isDark, const QStyleOption *option, const QWidget *widget, bool highlightmode = false); + virtual void getDefaultConfigTableParameters(ConfigTableParameters *p, bool isDark); + virtual void getHighlightModeConfigTableParameters(ConfigTableParameters *p, bool isDark); virtual void initConfigCheckBoxParameters(bool isDark, const QStyleOption *option, const QWidget *widget); + virtual void getDefaultConfigCheckBoxParameters(ConfigCheckBoxParameters *p, bool isDark); virtual void initConfigRadioButtonParameters(bool isDark, const QStyleOption *option, const QWidget *widget); + virtual void getDefaultConfigRadioButtonParameters(ConfigRadioButtonParameters *p, bool isDark); virtual void initConfigSliderParameters(bool isDark, const QStyleOption *option, const QWidget *widget); + virtual void getDefaultSliderParameters(ConfigSliderParameters *p, bool isDark); virtual void initConfigProgressBarParameters(bool isDark, const QStyleOption *option, const QWidget *widget); + virtual void getDefaultProgressBarParameters(ConfigProgressBarParameters *p, bool isDark); virtual void initConfigScrollBarParameters(bool isDark, const QStyleOption *option, const QWidget *widget); + virtual void getDefaultScrollBarParameters(ConfigScrollBarParameters *p, bool isDark); virtual void initConfigToolTipParameters(bool isDark, const QStyleOption *option, const QWidget *widget); + virtual void getDefaultToolTipParameters(ConfigToolTipParameters *p, bool isDark); virtual void initConfigTabWidgetParameters(bool isDark, const QStyleOption *option, const QWidget *widget); + virtual void getDefaultTabWidgetParameters(ConfigTabWidgetParameters *p, bool isDark); virtual void initConfigMenuParameters(bool isDark, const QStyleOption *option, const QWidget *widget); + virtual void getDefaultMenuParameters(ConfigMenuParameters *p, bool isDark); virtual QColor lanhuHSLToQtHsl(int h, int s, int l, int a = 255); virtual QColor adjustColor(const QColor c, int hRange = 0, int sRange = 0, int lRange = 0, int aRange = 0); @@ -326,6 +349,8 @@ private: ReadThemeConfig *m_readCfg = nullptr; QString m_themeColor = "default"; UKUIRadiusInformation::UKUIRadiusStruct m_radiusStruct; + QPalette m_stylePalette; + }; } diff --git a/ukui-styles/qt5-config-style-ukui/ukui-config-style.cpp b/ukui-styles/qt5-config-style-ukui/ukui-config-style.cpp index 110e65c..51b4b77 100644 --- a/ukui-styles/qt5-config-style-ukui/ukui-config-style.cpp +++ b/ukui-styles/qt5-config-style-ukui/ukui-config-style.cpp @@ -1,4 +1,4 @@ -/* +/* * Qt5-UKUI's Library * * Copyright (C) 2023, KylinSoft Co., Ltd. @@ -27,6 +27,7 @@ #include "settings/ukui-style-settings.h" #include "animations/tabwidget/ukui-tabwidget-default-slide-animator.h" +#include #include #include #include @@ -94,6 +95,7 @@ #include #include #include +#include #include @@ -777,7 +779,7 @@ QPalette UKUIConfigStyle::standardPalette() const } setThemeColor(color, palette); - sp->setUKUIThemeColor(themeColor); + sp->setUKUIThemeColor(palette, themeColor); } return palette; @@ -1287,6 +1289,14 @@ void UKUIConfigStyle::unpolish(QWidget *widget) Style::unpolish(widget); } +void UKUIConfigStyle::polish(QApplication *app) +{ +// QtConcurrent::run(this, &UKUIConfigStyle::getDefaultControlParameters, app); + getDefaultControlParameters(app); + + Style::polish(app); +} + QIcon UKUIConfigStyle::standardIcon(StandardPixmap standardIcon, const QStyleOption *option, const QWidget *widget) const { if (QApplication::desktopSettingsAware() && !QIcon::themeName().isEmpty()) { @@ -5934,8 +5944,8 @@ void UKUIConfigStyle::drawControl(QStyle::ControlElement element, const QStyleOp QColor penColor = sp->m_ProgressBarParameters.progressBarContentPen.color(); int width = (penColor.alpha() == 0 || penColor == Qt::NoPen) ? 0 : sp->m_ProgressBarParameters.progressBarContentPen.width(); painter->setPen(width > 0 ? sp->m_ProgressBarParameters.progressBarContentPen : Qt::NoPen); -// if(width == 1 && sp->m_ProgressBarParameters.radius != 0) -// painter->translate(0.5, 0.5); + // if(width == 1 && sp->m_ProgressBarParameters.radius != 0) + // painter->translate(0.5, 0.5); painter->setBrush(brush); width = (sp->m_ProgressBarParameters.progressBarGrooveDefaultPen.color().alpha() == 0 || sp->m_ProgressBarParameters.progressBarGrooveDefaultPen.color() == Qt::NoPen) ? @@ -7866,3 +7876,337 @@ void UKUIConfigStyle::realSetMenuTypeToMenu(const QWidget *widget) const QRect UKUIConfigStyle::centerRect(const QRect &rect, int width, int height) const { return QRect(rect.left() + (rect.width() - width)/2, rect.top() + (rect.height() - height)/2, width, height); } +void UKUIConfigStyle::getDefaultControlParameters(QApplication *app) +{ + //pushbutton + QSharedPointer pb(new ConfigPushButtonParameters); + sp->getDefaultConfigPushButtonBevelParameters(pb.data(), isUseDarkPalette()); + app->setProperty("PushButton_DefaultParameters_radius", pb.data()->radius); + app->setProperty("PushButton_DefaultParameters_DefaultBrush", pb.data()->pushButtonDefaultBrush ); + app->setProperty("PushButton_DefaultParameters_ClickBrush", pb.data()->pushButtonClickBrush ); + app->setProperty("PushButton_DefaultParameters_HoverBrush", pb.data()->pushButtonHoverBrush ); + app->setProperty("PushButton_DefaultParameters_DisableBrush", pb.data()->pushButtonDisableBrush ); + app->setProperty("PushButton_DefaultParameters_CheckBrush", pb.data()->pushButtonCheckBrush ); + app->setProperty("PushButton_DefaultParameters_CheckHoverBrush", pb.data()->pushButtonCheckHoverBrush ); + app->setProperty("PushButton_DefaultParameters_CheckClickBrush", pb.data()->pushButtonCheckClickBrush ); + app->setProperty("PushButton_DefaultParameters_CheckDisableBrush", pb.data()->pushButtonCheckDisableBrush); + app->setProperty("PushButton_DefaultParameters_DefaultPen", pb.data()->pushButtonDefaultPen ); + app->setProperty("PushButton_DefaultParameters_ClickPen", pb.data()->pushButtonClickPen ); + app->setProperty("PushButton_DefaultParameters_HoverPen", pb.data()->pushButtonHoverPen ); + app->setProperty("PushButton_DefaultParameters_DisablePen", pb.data()->pushButtonDisablePen ); + app->setProperty("PushButton_DefaultParameters_CheckPen", pb.data()->pushButtonCheckPen ); + app->setProperty("PushButton_DefaultParameters_CheckHoverPen", pb.data()->pushButtonCheckHoverPen ); + app->setProperty("PushButton_DefaultParameters_CheckClickPen", pb.data()->pushButtonCheckClickPen ); + app->setProperty("PushButton_DefaultParameters_CheckDisablePen", pb.data()->pushButtonCheckDisablePen ); + app->setProperty("PushButton_DefaultParameters_FocusPen", pb.data()->pushButtonFocusPen ); + + sp->getDefaultConfigPushButtonLabelParameters(pb.data(), isUseDarkPalette()); + + app->setProperty("PushButton_DefaultParameters_TextDefaultColor", pb.data()->textDefaultColor ); + app->setProperty("PushButton_DefaultParameters_TextHoverColor", pb.data()->textHoverColor ); + + //ToolButton + QSharedPointer tb(new ConfigToolButtonParameters); + sp->getDefaultConfigToolButtonPanelParameters(tb.data(), isUseDarkPalette()); + app->setProperty("ToolButton_DefaultParameters_radius", tb.data()->radius); + app->setProperty("ToolButton_DefaultParameters_DefaultBrush", tb.data()->toolButtonDefaultBrush ); + app->setProperty("ToolButton_DefaultParameters_ClickBrush", tb.data()->toolButtonClickBrush ); + app->setProperty("ToolButton_DefaultParameters_HoverBrush", tb.data()->toolButtonHoverBrush ); + app->setProperty("ToolButton_DefaultParameters_DisableBrush", tb.data()->toolButtonDisableBrush ); + app->setProperty("ToolButton_DefaultParameters_CheckBrush", tb.data()->toolButtonCheckBrush ); + app->setProperty("ToolButton_DefaultParameters_CheckHoverBrush", tb.data()->toolButtonCheckHoverBrush ); + app->setProperty("ToolButton_DefaultParameters_CheckClickBrush", tb.data()->toolButtonCheckClickBrush ); + app->setProperty("ToolButton_DefaultParameters_CheckDisableBrush", tb.data()->toolButtonCheckDisableBrush); + app->setProperty("ToolButton_DefaultParameters_DefaultPen", tb.data()->toolButtonDefaultPen ); + app->setProperty("ToolButton_DefaultParameters_ClickPen", tb.data()->toolButtonClickPen ); + app->setProperty("ToolButton_DefaultParameters_HoverPen", tb.data()->toolButtonHoverPen ); + app->setProperty("ToolButton_DefaultParameters_DisablePen", tb.data()->toolButtonDisablePen ); + app->setProperty("ToolButton_DefaultParameters_CheckPen", tb.data()->toolButtonCheckPen ); + app->setProperty("ToolButton_DefaultParameters_CheckHoverPen", tb.data()->toolButtonCheckHoverPen ); + app->setProperty("ToolButton_DefaultParameters_CheckClickPen", tb.data()->toolButtonCheckClickPen ); + app->setProperty("ToolButton_DefaultParameters_CheckDisablePen", tb.data()->toolButtonCheckDisablePen ); + app->setProperty("ToolButton_DefaultParameters_FocusPen", tb.data()->toolButtonFocusPen ); + + sp->getDefaultConfigToolButtonLabelParameters(tb.data(), isUseDarkPalette()); + app->setProperty("ToolButton_DefaultParameters_TextDefaultColor", tb.data()->textDefaultColor ); + app->setProperty("ToolButton_DefaultParameters_TextHoverColor", tb.data()->textHoverColor ); + + //lineedit + QSharedPointer lineedit(new ConfigLineEditParameters); + sp->getDefaultConfigLineEditParameters(lineedit.data(), isUseDarkPalette()); + app->setProperty("Lineedit_DefaultParameters_radius", lineedit.data()->radius ); + app->setProperty("Lineedit_DefaultParameters_DefaultBrush", lineedit.data()->lineEditDefaultBrush); + app->setProperty("Lineedit_DefaultParameters_HoverBrush", lineedit.data()->lineEditHoverBrush ); + app->setProperty("Lineedit_DefaultParameters_FocusBrush", lineedit.data()->lineEditFocusBrush ); + app->setProperty("Lineedit_DefaultParameters_DisableBrush", lineedit.data()->lineEditDisableBrush); + app->setProperty("Lineedit_DefaultParameters_DefaultPen", lineedit.data()->lineEditDefaultPen ); + app->setProperty("Lineedit_DefaultParameters_HoverPen", lineedit.data()->lineEditHoverPen ); + app->setProperty("Lineedit_DefaultParameters_FocusPen", lineedit.data()->lineEditFocusPen ); + app->setProperty("Lineedit_DefaultParameters_DisablePen", lineedit.data()->lineEditDisablePen ); + + //spinbox + QSharedPointer spinbox(new ConfigSpinBoxParameters); + sp->getDefaultConfigSpinBoxParameters(spinbox.data(), isUseDarkPalette()); + app->setProperty("SpinBox_DefaultParameters_radius", spinbox.data()->radius ); + app->setProperty("SpinBox_DefaultParameters_DefaultBrush", spinbox.data()->spinBoxDefaultBrush ); + app->setProperty("SpinBox_DefaultParameters_HoverBrush", spinbox.data()->spinBoxHoverBrush ); + app->setProperty("SpinBox_DefaultParameters_FocusBrush", spinbox.data()->spinBoxFocusBrush ); + app->setProperty("SpinBox_DefaultParameters_DisableBrush", spinbox.data()->spinBoxDisableBrush ); + app->setProperty("SpinBox_DefaultParameters_DefaultPen", spinbox.data()->spinBoxDefaultPen ); + app->setProperty("SpinBox_DefaultParameters_HoverPen", spinbox.data()->spinBoxHoverPen ); + app->setProperty("SpinBox_DefaultParameters_FocusPen", spinbox.data()->spinBoxFocusPen ); + app->setProperty("SpinBox_DefaultParameters_DisablePen", spinbox.data()->spinBoxDisablePen ); + app->setProperty("SpinBox_DefaultParameters_UpDefaultBrush", spinbox.data()->spinBoxUpDefaultBrush ); + app->setProperty("SpinBox_DefaultParameters_UpHoverBrush", spinbox.data()->spinBoxUpHoverBrush ); + app->setProperty("SpinBox_DefaultParameters_UpFocusHoverBrush", spinbox.data()->spinBoxUpFocusHoverBrush ); + app->setProperty("SpinBox_DefaultParameters_UpClickBrush", spinbox.data()->spinBoxUpClickBrush ); + app->setProperty("SpinBox_DefaultParameters_DownHoverBrush", spinbox.data()->spinBoxDownHoverBrush ); + app->setProperty("SpinBox_DefaultParameters_DownFocusHoverBrush", spinbox.data()->spinBoxDownFocusHoverBrush); + app->setProperty("SpinBox_DefaultParameters_DownClickBrush", spinbox.data()->spinBoxDownClickBrush ); + app->setProperty("SpinBox_DefaultParameters_DownDefaultBrush", spinbox.data()->spinBoxDownDefaultBrush ); + app->setProperty("SpinBox_DefaultParameters_UpDefaultPen", spinbox.data()->spinBoxUpDefaultPen ); + app->setProperty("SpinBox_DefaultParameters_UpHoverPen", spinbox.data()->spinBoxUpHoverPen ); + app->setProperty("SpinBox_DefaultParameters_UpFocusHoverPen", spinbox.data()->spinBoxUpFocusHoverPen ); + app->setProperty("SpinBox_DefaultParameters_UpClickPen", spinbox.data()->spinBoxUpClickPen ); + app->setProperty("SpinBox_DefaultParameters_UpDisablePen", spinbox.data()->spinBoxUpDisablePen ); + app->setProperty("SpinBox_DefaultParameters_DownDefaultPen", spinbox.data()->spinBoxDownDefaultPen ); + app->setProperty("SpinBox_DefaultParameters_DownHoverPen", spinbox.data()->spinBoxDownHoverPen ); + app->setProperty("SpinBox_DefaultParameters_DownFocusHoverPen", spinbox.data()->spinBoxDownFocusHoverPen ); + app->setProperty("SpinBox_DefaultParameters_DownClickPen ", spinbox.data()->spinBoxDownClickPen ); + app->setProperty("SpinBox_DefaultParameters_DownDisablePen", spinbox.data()->spinBoxDownDisablePen ); + app->setProperty("SpinBox_DefaultParameters_UpIconHightPixMap", spinbox.data()->spinBoxUpIconHightPixMap ); + app->setProperty("SpinBox_DefaultParameters_DownIconHightPixMap", spinbox.data()->spinBoxDownIconHightPixMap); + + //combobox + QSharedPointer comboBox(new ConfigComboBoxParameters); + sp->getDefaultConfigComboBoxParameters(comboBox.data(), isUseDarkPalette()); + app->setProperty("ComboBox_DefaultParameters_radius", comboBox.data()->radius ); + app->setProperty("ComboBox_DefaultParameters_DefaultBrush", comboBox.data()->comboBoxDefaultBrush); + app->setProperty("ComboBox_DefaultParameters_HoverBrush", comboBox.data()->comboBoxHoverBrush ); + app->setProperty("ComboBox_DefaultParameters_OnBrush", comboBox.data()->comboBoxOnBrush ); + app->setProperty("ComboBox_DefaultParameters_EditBrush", comboBox.data()->comboBoxEditBrush ); + app->setProperty("ComboBox_DefaultParameters_DisableBrush", comboBox.data()->comboBoxDisableBrush); + app->setProperty("ComboBox_DefaultParameters_DefaultPen", comboBox.data()->comboBoxDefaultPen ); + app->setProperty("ComboBox_DefaultParameters_HoverPen", comboBox.data()->comboBoxHoverPen ); + app->setProperty("ComboBox_DefaultParameters_OnPen", comboBox.data()->comboBoxOnPen ); + app->setProperty("ComboBox_DefaultParameters_EditPen", comboBox.data()->comboBoxEditPen ); + app->setProperty("ComboBox_DefaultParameters_DisablePen", comboBox.data()->comboBoxDisablePen ); + app->setProperty("ComboBox_DefaultParameters_FocusPen", comboBox.data()->comboBoxFocusPen ); + + //list + QSharedPointer list(new ConfigListParameters); + sp->getDefaultConfigListParameters(list.data(), isUseDarkPalette()); + app->setProperty("List_DefaultParameters_radius", list.data()->radius ); + app->setProperty("List_DefaultParameters_DefaultBrush", list.data()->listDefaultBrush ); + app->setProperty("List_DefaultParameters_HoverBrush", list.data()->listHoverBrush ); + app->setProperty("List_DefaultParameters_SelectBrush", list.data()->listSelectBrush ); + app->setProperty("List_DefaultParameters_DisableBrush", list.data()->listDisableBrush ); + app->setProperty("List_DefaultParameters_TextHoverPen", list.data()->listTextHoverPen ); + app->setProperty("List_DefaultParameters_TextSelectPen", list.data()->listTextSelectPen ); + app->setProperty("List_DefaultParameters_TextDisablePen", list.data()->listTextDisablePen); + app->setProperty("List_DefaultParameters_HoverPen", list.data()->listHoverPen ); + app->setProperty("List_DefaultParameters_SelectPen", list.data()->listSelectPen ); + app->setProperty("List_DefaultParameters_FocusPen", list.data()->listFocusPen ); + + sp->getHighlightModeConfigListParameters(list.data(), isUseDarkPalette()); + app->setProperty("List_HighlightMode_radius", list.data()->radius ); + app->setProperty("List_HighlightMode_DefaultBrush", list.data()->listDefaultBrush ); + app->setProperty("List_HighlightMode_HoverBrush", list.data()->listHoverBrush ); + app->setProperty("List_HighlightMode_SelectBrush", list.data()->listSelectBrush ); + app->setProperty("List_HighlightMode_DisableBrush", list.data()->listDisableBrush ); + app->setProperty("List_HighlightMode_TextHoverPen", list.data()->listTextHoverPen ); + app->setProperty("List_HighlightMode_TextSelectPen", list.data()->listTextSelectPen ); + app->setProperty("List_HighlightMode_TextDisablePen", list.data()->listTextDisablePen); + app->setProperty("List_HighlightMode_HoverPen", list.data()->listHoverPen ); + app->setProperty("List_HighlightMode_SelectPen", list.data()->listSelectPen ); + app->setProperty("List_HighlightMode_FocusPen", list.data()->listFocusPen ); + + //tree + QSharedPointer tree(new ConfigTreeParameters); + sp->getDefaultConfigTreeParameters(tree.data(), isUseDarkPalette()); + app->setProperty("Tree_DefaultParameters_radius", tree.data()->radius ); + app->setProperty("Tree_DefaultParameters_DefaultBrush", tree.data()->treeDefaultBrush ); + app->setProperty("Tree_DefaultParameters_HoverBrush", tree.data()->treeHoverBrush ); + app->setProperty("Tree_DefaultParameters_SelectBrush", tree.data()->treeSelectBrush ); + app->setProperty("Tree_DefaultParameters_DisableBrush", tree.data()->treeDisableBrush ); + app->setProperty("Tree_DefaultParameters_BranchDefaultBrush", tree.data()->treeBranchDefaultBrush); + app->setProperty("Tree_DefaultParameters_BranchHoverBrush", tree.data()->treeBranchHoverBrush ); + app->setProperty("Tree_DefaultParameters_BranchSelectBrush", tree.data()->treeBranchSelectBrush ); + app->setProperty("Tree_DefaultParameters_BranchDisableBrush", tree.data()->treeBranchDisableBrush); + app->setProperty("Tree_DefaultParameters_HoverPen", tree.data()->treeHoverPen ); + app->setProperty("Tree_DefaultParameters_SelectPen", tree.data()->treeSelectPen ); + app->setProperty("Tree_DefaultParameters_FocusPen", tree.data()->treeFocusPen ); + app->setProperty("Tree_DefaultParameters_TextHoverPen", tree.data()->treeTextHoverPen ); + app->setProperty("Tree_DefaultParameters_TextSelectPen", tree.data()->treeTextSelectPen ); + app->setProperty("Tree_DefaultParameters_TextDisablePen", tree.data()->treeTextDisablePen ); + + sp->getHighlightModeConfigTreeParameters(tree.data(), isUseDarkPalette()); + app->setProperty("Tree_HighlightMode_radius", tree.data()->radius ); + app->setProperty("Tree_HighlightMode_DefaultBrush", tree.data()->treeDefaultBrush ); + app->setProperty("Tree_HighlightMode_HoverBrush", tree.data()->treeHoverBrush ); + app->setProperty("Tree_HighlightMode_SelectBrush", tree.data()->treeSelectBrush ); + app->setProperty("Tree_HighlightMode_DisableBrush", tree.data()->treeDisableBrush ); + app->setProperty("Tree_HighlightMode_BranchDefaultBrush", tree.data()->treeBranchDefaultBrush); + app->setProperty("Tree_HighlightMode_BranchHoverBrush", tree.data()->treeBranchHoverBrush ); + app->setProperty("Tree_HighlightMode_BranchSelectBrush", tree.data()->treeBranchSelectBrush ); + app->setProperty("Tree_HighlightMode_BranchDisableBrush", tree.data()->treeBranchDisableBrush); + app->setProperty("Tree_HighlightMode_HoverPen", tree.data()->treeHoverPen ); + app->setProperty("Tree_HighlightMode_SelectPen", tree.data()->treeSelectPen ); + app->setProperty("Tree_HighlightMode_FocusPen", tree.data()->treeFocusPen ); + app->setProperty("Tree_HighlightMode_TextHoverPen", tree.data()->treeTextHoverPen ); + app->setProperty("Tree_HighlightMode_TextSelectPen", tree.data()->treeTextSelectPen ); + app->setProperty("Tree_HighlightMode_TextDisablePen", tree.data()->treeTextDisablePen ); + + //table + QSharedPointer table(new ConfigTableParameters); + sp->getDefaultConfigTableParameters(table.data(), isUseDarkPalette()); + app->setProperty("Table_DefaultParameters_radius", table.data()->radius ); + app->setProperty("Table_DefaultParameters_DefaultBrush", table.data()->tableDefaultBrush ); + app->setProperty("Table_DefaultParameters_HoverBrush", table.data()->tableHoverBrush ); + app->setProperty("Table_DefaultParameters_SelectBrush", table.data()->tableSelectBrush ); + app->setProperty("Table_DefaultParameters_DisableBrush", table.data()->tableDisableBrush ); + app->setProperty("Table_DefaultParameters_HoverPen", table.data()->tableHoverPen ); + app->setProperty("Table_DefaultParameters_SelectPen", table.data()->tableSelectPen ); + app->setProperty("Table_DefaultParameters_FocusPen", table.data()->tableFocusPen ); + app->setProperty("Table_DefaultParameters_TextHoverPen", table.data()->tableTextHoverPen ); + app->setProperty("Table_DefaultParameters_TextSelectPen", table.data()->tableTextSelectPen ); + app->setProperty("Table_DefaultParameters_TextDisablePen", table.data()->tableTextDisablePen); + + sp->getHighlightModeConfigTableParameters(table.data(), isUseDarkPalette()); + app->setProperty("Table_HighlightMode_radius", table.data()->radius ); + app->setProperty("Table_HighlightMode_DefaultBrush", table.data()->tableDefaultBrush ); + app->setProperty("Table_HighlightMode_HoverBrush", table.data()->tableHoverBrush ); + app->setProperty("Table_HighlightMode_SelectBrush", table.data()->tableSelectBrush ); + app->setProperty("Table_HighlightMode_DisableBrush", table.data()->tableDisableBrush ); + app->setProperty("Table_HighlightMode_HoverPen", table.data()->tableHoverPen ); + app->setProperty("Table_HighlightMode_SelectPen", table.data()->tableSelectPen ); + app->setProperty("Table_HighlightMode_FocusPen", table.data()->tableFocusPen ); + app->setProperty("Table_HighlightMode_TextHoverPen", table.data()->tableTextHoverPen ); + app->setProperty("Table_HighlightMode_TextSelectPen", table.data()->tableTextSelectPen ); + app->setProperty("Table_HighlightMode_TextDisablePen", table.data()->tableTextDisablePen); + + + //checkbox + QSharedPointer checkBox(new ConfigCheckBoxParameters); + sp->getDefaultConfigCheckBoxParameters(checkBox.data(), isUseDarkPalette()); + app->setProperty("CheckBox_DefaultParameters_radius", checkBox.data()->radius ); + app->setProperty("CheckBox_DefaultParameters_DefaultPen", checkBox.data()->checkBoxDefaultPen ); + app->setProperty("CheckBox_DefaultParameters_HoverPen", checkBox.data()->checkBoxHoverPen ); + app->setProperty("CheckBox_DefaultParameters_ClickPen", checkBox.data()->checkBoxClickPen ); + app->setProperty("CheckBox_DefaultParameters_DisablePen", checkBox.data()->checkBoxDisablePen ); + app->setProperty("CheckBox_DefaultParameters_OnDefaultPen", checkBox.data()->checkBoxOnDefaultPen ); + app->setProperty("CheckBox_DefaultParameters_OnHoverPen", checkBox.data()->checkBoxOnHoverPen ); + app->setProperty("CheckBox_DefaultParameters_OnClickPen", checkBox.data()->checkBoxOnClickPen ); + app->setProperty("CheckBox_DefaultParameters_ContentPen", checkBox.data()->checkBoxContentPen ); + app->setProperty("CheckBox_DefaultParameters_DefaultBrush", checkBox.data()->checkBoxDefaultBrush ); + app->setProperty("CheckBox_DefaultParameters_HoverBrush", checkBox.data()->checkBoxHoverBrush ); + app->setProperty("CheckBox_DefaultParameters_ClickBrush", checkBox.data()->checkBoxClickBrush ); + app->setProperty("CheckBox_DefaultParameters_DisableBrush", checkBox.data()->checkBoxDisableBrush ); + app->setProperty("CheckBox_DefaultParameters_OnDefaultBrush", checkBox.data()->checkBoxOnDefaultBrush ); + app->setProperty("CheckBox_DefaultParameters_OnHoverBrush", checkBox.data()->checkBoxOnHoverBrush ); + app->setProperty("CheckBox_DefaultParameters_OnClickBrush", checkBox.data()->checkBoxOnClickBrush ); + app->setProperty("CheckBox_DefaultParameters_PathBrush", checkBox.data()->checkBoxPathBrush ); + app->setProperty("CheckBox_DefaultParameters_PathDisableBrush", checkBox.data()->checkBoxPathDisableBrush); + + //radiobutton + QSharedPointer radiobutton(new ConfigRadioButtonParameters); + sp->getDefaultConfigRadioButtonParameters(radiobutton.data(), isUseDarkPalette()); + app->setProperty("RadioButton_DefaultParameters_radius", radiobutton.data()->radius ); + app->setProperty("RadioButton_DefaultParameters_DefaultPen", radiobutton.data()->radioButtonDefaultPen ); + app->setProperty("RadioButton_DefaultParameters_HoverPen", radiobutton.data()->radioButtonHoverPen ); + app->setProperty("RadioButton_DefaultParameters_ClickPen", radiobutton.data()->radioButtonClickPen ); + app->setProperty("RadioButton_DefaultParameters_DisablePen", radiobutton.data()->radioButtonDisablePen ); + app->setProperty("RadioButton_DefaultParameters_OnDefaultPen", radiobutton.data()->radioButtonOnDefaultPen ); + app->setProperty("RadioButton_DefaultParameters_OnHoverPen", radiobutton.data()->radioButtonOnHoverPen ); + app->setProperty("RadioButton_DefaultParameters_OnClickPen", radiobutton.data()->radioButtonOnClickPen ); + app->setProperty("RadioButton_DefaultParameters_DefaultBrush", radiobutton.data()->radioButtonDefaultBrush ); + app->setProperty("RadioButton_DefaultParameters_HoverBrush", radiobutton.data()->radioButtonHoverBrush ); + app->setProperty("RadioButton_DefaultParameters_ClickBrush", radiobutton.data()->radioButtonClickBrush ); + app->setProperty("RadioButton_DefaultParameters_DisableBrush", radiobutton.data()->radioButtonDisableBrush ); + app->setProperty("RadioButton_DefaultParameters_OnDefaultBrush", radiobutton.data()->radioButtonOnDefaultBrush ); + app->setProperty("RadioButton_DefaultParameters_OnHoverBrush", radiobutton.data()->radioButtonOnHoverBrush ); + app->setProperty("RadioButton_DefaultParameters_OnClickBrush", radiobutton.data()->radioButtonOnClickBrush ); + app->setProperty("RadioButton_DefaultParameters_ChildrenOnDefaultBrush", radiobutton.data()->radioButtonChildrenOnDefaultBrush); + app->setProperty("RadioButton_DefaultParameters_ChildrenOnHoverBrush", radiobutton.data()->radioButtonChildrenOnHoverBrush ); + app->setProperty("RadioButton_DefaultParameters_ChildrenOnClickBrush ", radiobutton.data()->radioButtonChildrenOnClickBrush ); + app->setProperty("RadioButton_DefaultParameters_ChildrenOnDisableBrush", radiobutton.data()->radioButtonChildrenOnDisableBrush); + + //slider + QSharedPointer slider(new ConfigSliderParameters); + sp->getDefaultSliderParameters(slider.data(), isUseDarkPalette()); + app->setProperty("Slider_DefaultParameters_radius", slider.data()->radius ); + app->setProperty("Slider_DefaultParameters_GrooveRadius", slider.data()->sliderGrooveRadius ); + app->setProperty("Slider_DefaultParameters_HandleDefaultBrush", slider.data()->sliderHandleDefaultBrush ); + app->setProperty("Slider_DefaultParameters_HandleHoverBrush", slider.data()->sliderHandleHoverBrush ); + app->setProperty("Slider_DefaultParameters_HandleClickBrush", slider.data()->sliderHandleClickBrush ); + app->setProperty("Slider_DefaultParameters_HandleDisableBrush", slider.data()->sliderHandleDisableBrush ); + app->setProperty("Slider_DefaultParameters_GrooveValueDefaultBrush", slider.data()->sliderGrooveValueDefaultBrush ); + app->setProperty("Slider_DefaultParameters_GrooveValueHoverBrush", slider.data()->sliderGrooveValueHoverBrush ); + app->setProperty("Slider_DefaultParameters_GrooveValueDisableBrush", slider.data()->sliderGrooveValueDisableBrush ); + app->setProperty("Slider_DefaultParameters_GrooveUnvalueDefaultBrush", slider.data()->sliderGrooveUnvalueDefaultBrush); + app->setProperty("Slider_DefaultParameters_GrooveUnvalueHoverBrush", slider.data()->sliderGrooveUnvalueHoverBrush ); + app->setProperty("Slider_DefaultParameters_GrooveUnvalueDisableBrush", slider.data()->sliderGrooveUnvalueDisableBrush); + app->setProperty("Slider_DefaultParameters_HandleDefaultPen", slider.data()->sliderHandleDefaultPen ); + app->setProperty("Slider_DefaultParameters_HandleHoverPen", slider.data()->sliderHandleHoverPen ); + app->setProperty("Slider_DefaultParameters_HandleClickPen", slider.data()->sliderHandleClickPen ); + app->setProperty("Slider_DefaultParameters_HandleDisablePen", slider.data()->sliderHandleDisablePen ); + app->setProperty("Slider_DefaultParameters_GroovePen", slider.data()->sliderGroovePen ); + app->setProperty("Slider_DefaultParameters_focusPen", slider.data()->focusPen ); + + //progressabr + QSharedPointer progressbar(new ConfigProgressBarParameters); + sp->getDefaultProgressBarParameters(progressbar.data(), isUseDarkPalette()); + app->setProperty("ProgressBar_DefaultParameters_radius", progressbar.data()->radius ); + app->setProperty("ProgressBar_DefaultParameters_ContentPen", progressbar.data()->progressBarContentPen ); + app->setProperty("ProgressBar_DefaultParameters_GrooveDefaultPen", progressbar.data()->progressBarGrooveDefaultPen ); + app->setProperty("ProgressBar_DefaultParameters_GrooveDisablePen", progressbar.data()->progressBarGrooveDisablePen ); + app->setProperty("ProgressBar_DefaultParameters_ContentBrush", progressbar.data()->progressBarContentBrush ); + app->setProperty("ProgressBar_DefaultParameters_GrooveDefaultBrush", progressbar.data()->progressBarGrooveDefaultBrush ); + app->setProperty("ProgressBar_DefaultParameters_GrooveDisableBrush", progressbar.data()->progressBarGrooveDisableBrush ); + app->setProperty("ProgressBar_DefaultParameters_ContentHightColor", progressbar.data()->progressBarContentHightColor ); + app->setProperty("ProgressBar_DefaultParameters_ContentMidLightColor", progressbar.data()->progressBarContentMidLightColor); + + //scrollbar + QSharedPointer scrollbar(new ConfigScrollBarParameters); + sp->getDefaultScrollBarParameters(scrollbar.data(), isUseDarkPalette()); + app->setProperty("ScrollBar_DefaultParameters_radius", scrollbar.data()->radius ); + app->setProperty("ScrollBar_DefaultParameters_GrooveDefaultBrush", scrollbar.data()->scrollBarGrooveDefaultBrush ); + app->setProperty("ScrollBar_DefaultParameters_GrooveInactiveBrush", scrollbar.data()->scrollBarGrooveInactiveBrush); + app->setProperty("ScrollBar_DefaultParameters_SliderDefaultBrush", scrollbar.data()->scrollBarSliderDefaultBrush ); + app->setProperty("ScrollBar_DefaultParameters_SliderHoverBrush", scrollbar.data()->scrollBarSliderHoverBrush ); + app->setProperty("ScrollBar_DefaultParameters_SliderClickBrush", scrollbar.data()->scrollBarSliderClickBrush ); + app->setProperty("ScrollBar_DefaultParameters_SliderDisableBrush", scrollbar.data()->scrollBarSliderDisableBrush ); + + //tooltip + QSharedPointer tooltip(new ConfigToolTipParameters); + sp->getDefaultToolTipParameters(tooltip.data(), isUseDarkPalette()); + app->setProperty("ToolTip_DefaultParameters_radius", tooltip.data()->radius ); + app->setProperty("ToolTip_DefaultParameters_BackgroundBrush", tooltip.data()->toolTipBackgroundBrush); + app->setProperty("ToolTip_DefaultParameters_BackgroundPen", tooltip.data()->toolTipBackgroundPen ); + + //tabwidget + QSharedPointer tabwidget(new ConfigTabWidgetParameters); + sp->getDefaultTabWidgetParameters(tabwidget.data(), isUseDarkPalette()); + app->setProperty("TabWidget_DefaultParameters_radius", tabwidget.data()->radius ); + app->setProperty("TabWidget_DefaultParameters_tabWidgetBackgroundBrush", tabwidget.data()->tabWidgetBackgroundBrush); + app->setProperty("TabWidget_DefaultParameters_tabBarBackgroundBrush", tabwidget.data()->tabBarBackgroundBrush ); + app->setProperty("TabWidget_DefaultParameters_tabBarDefaultBrush", tabwidget.data()->tabBarDefaultBrush ); + app->setProperty("TabWidget_DefaultParameters_tabBarHoverBrush", tabwidget.data()->tabBarHoverBrush ); + app->setProperty("TabWidget_DefaultParameters_tabBarClickBrush", tabwidget.data()->tabBarClickBrush ); + app->setProperty("TabWidget_DefaultParameters_tabBarSelectBrush", tabwidget.data()->tabBarSelectBrush ); + app->setProperty("TabWidget_DefaultParameters_tabBarDefaultPen", tabwidget.data()->tabBarDefaultPen ); + app->setProperty("TabWidget_DefaultParameters_tabBarHoverPen", tabwidget.data()->tabBarHoverPen ); + app->setProperty("TabWidget_DefaultParameters_tabBarClickPen", tabwidget.data()->tabBarClickPen ); + app->setProperty("TabWidget_DefaultParameters_tabBarFocusPen", tabwidget.data()->tabBarFocusPen ); + + //menu + QSharedPointer menu(new ConfigMenuParameters); + sp->getDefaultMenuParameters(menu.data(), isUseDarkPalette()); + app->setProperty("Menu_DefaultParameters_frameRadius", menu.data()->frameRadius ); + app->setProperty("Menu_DefaultParameters_itemRadius", menu.data()->itemRadius ); + app->setProperty("Menu_DefaultParameters_menuBackgroundBrush", menu.data()->menuBackgroundBrush); + app->setProperty("Menu_DefaultParameters_menuBackgroundPen", menu.data()->menuBackgroundPen ); + app->setProperty("Menu_DefaultParameters_menuItemSelectBrush", menu.data()->menuItemSelectBrush); + app->setProperty("Menu_DefaultParameters_menuItemFocusPen", menu.data()->menuItemFocusPen ); + app->setProperty("Menu_DefaultParameters_menuTextHoverPen", menu.data()->menuTextHoverPen ); +} diff --git a/ukui-styles/qt5-config-style-ukui/ukui-config-style.h b/ukui-styles/qt5-config-style-ukui/ukui-config-style.h index ba8fa44..8a444d7 100644 --- a/ukui-styles/qt5-config-style-ukui/ukui-config-style.h +++ b/ukui-styles/qt5-config-style-ukui/ukui-config-style.h @@ -24,12 +24,13 @@ #define UKUICONFIGSTYLE_H #include - #include #include #include #include #include +#include "widget-parameters/control-parameters.h" + class QStyleOptionViewItem; class QDBusInterface; @@ -88,6 +89,8 @@ public: void polish(QWidget *widget); void unpolish(QWidget *widget); void polish(QPalette& palette) ; + void polish(QApplication *app); + QIcon standardIcon(StandardPixmap standardIcon, const QStyleOption *option = nullptr, const QWidget *widget = nullptr) const override; @@ -170,6 +173,7 @@ private: void viewItemLayout(const QStyleOptionViewItem *option, QRect *checkRect, QRect *pixmapRect, QRect *textRect, bool sizehint) const; QSize viewItemSize(const QStyleOptionViewItem *option, int role) const; + void getDefaultControlParameters(QApplication *app); private: UKUIConfigStyleSpace::ConfigTabWidgetAnimationHelper *m_tab_animation_helper = nullptr; @@ -205,7 +209,6 @@ private: bool m_blink_cursor = true; int m_blink_cursor_time = 1200; - }; #endif // UKUICONFIGSTYLE_H diff --git a/ukui-styles/qt5-config-style-ukui/widget-parameters/config-checkbox-parameters.h b/ukui-styles/qt5-config-style-ukui/widget-parameters/config-checkbox-parameters.h index 9612e78..3166b90 100644 --- a/ukui-styles/qt5-config-style-ukui/widget-parameters/config-checkbox-parameters.h +++ b/ukui-styles/qt5-config-style-ukui/widget-parameters/config-checkbox-parameters.h @@ -26,10 +26,13 @@ #include #include +#include "control-parameters.h" + namespace UKUIConfigStyleSpace { -class ConfigCheckBoxParameters +class ConfigCheckBoxParameters : public ControlParameters { + Q_OBJECT public: ConfigCheckBoxParameters(); diff --git a/ukui-styles/qt5-config-style-ukui/widget-parameters/config-combobox-parameters.h b/ukui-styles/qt5-config-style-ukui/widget-parameters/config-combobox-parameters.h index e6a4def..37725a1 100644 --- a/ukui-styles/qt5-config-style-ukui/widget-parameters/config-combobox-parameters.h +++ b/ukui-styles/qt5-config-style-ukui/widget-parameters/config-combobox-parameters.h @@ -25,10 +25,13 @@ #include #include +#include "control-parameters.h" + namespace UKUIConfigStyleSpace { -class ConfigComboBoxParameters +class ConfigComboBoxParameters : public ControlParameters { + Q_OBJECT public: ConfigComboBoxParameters(); diff --git a/ukui-styles/qt5-config-style-ukui/widget-parameters/config-lineedit-parameters.h b/ukui-styles/qt5-config-style-ukui/widget-parameters/config-lineedit-parameters.h index 2d6eaf1..954c41d 100644 --- a/ukui-styles/qt5-config-style-ukui/widget-parameters/config-lineedit-parameters.h +++ b/ukui-styles/qt5-config-style-ukui/widget-parameters/config-lineedit-parameters.h @@ -27,10 +27,13 @@ #include #include +#include "control-parameters.h" + namespace UKUIConfigStyleSpace { -class ConfigLineEditParameters +class ConfigLineEditParameters : public ControlParameters { + Q_OBJECT public: ConfigLineEditParameters(); diff --git a/ukui-styles/qt5-config-style-ukui/widget-parameters/config-list-parameters.h b/ukui-styles/qt5-config-style-ukui/widget-parameters/config-list-parameters.h index e3b8a69..34e5b9d 100644 --- a/ukui-styles/qt5-config-style-ukui/widget-parameters/config-list-parameters.h +++ b/ukui-styles/qt5-config-style-ukui/widget-parameters/config-list-parameters.h @@ -26,10 +26,13 @@ #include #include +#include "control-parameters.h" + namespace UKUIConfigStyleSpace { -class ConfigListParameters +class ConfigListParameters : public ControlParameters { + Q_OBJECT public: ConfigListParameters(); diff --git a/ukui-styles/qt5-config-style-ukui/widget-parameters/config-menu-parameters.h b/ukui-styles/qt5-config-style-ukui/widget-parameters/config-menu-parameters.h index 7cf419f..9364713 100644 --- a/ukui-styles/qt5-config-style-ukui/widget-parameters/config-menu-parameters.h +++ b/ukui-styles/qt5-config-style-ukui/widget-parameters/config-menu-parameters.h @@ -27,10 +27,13 @@ #include #include #include +#include "control-parameters.h" + namespace UKUIConfigStyleSpace { -class ConfigMenuParameters +class ConfigMenuParameters : public ControlParameters { + Q_OBJECT public: ConfigMenuParameters(); diff --git a/ukui-styles/qt5-config-style-ukui/widget-parameters/config-progressbar-parameters.h b/ukui-styles/qt5-config-style-ukui/widget-parameters/config-progressbar-parameters.h index c79b738..b6d4dc7 100644 --- a/ukui-styles/qt5-config-style-ukui/widget-parameters/config-progressbar-parameters.h +++ b/ukui-styles/qt5-config-style-ukui/widget-parameters/config-progressbar-parameters.h @@ -26,10 +26,13 @@ #include #include +#include "control-parameters.h" + namespace UKUIConfigStyleSpace { -class ConfigProgressBarParameters +class ConfigProgressBarParameters : public ControlParameters { + Q_OBJECT public: ConfigProgressBarParameters(); diff --git a/ukui-styles/qt5-config-style-ukui/widget-parameters/config-pushbutton-parameters.h b/ukui-styles/qt5-config-style-ukui/widget-parameters/config-pushbutton-parameters.h index 82ce1fd..e2e7ad2 100644 --- a/ukui-styles/qt5-config-style-ukui/widget-parameters/config-pushbutton-parameters.h +++ b/ukui-styles/qt5-config-style-ukui/widget-parameters/config-pushbutton-parameters.h @@ -27,10 +27,13 @@ #include #include +#include "control-parameters.h" + namespace UKUIConfigStyleSpace { -class ConfigPushButtonParameters +class ConfigPushButtonParameters : public ControlParameters { + Q_OBJECT public: ConfigPushButtonParameters(); diff --git a/ukui-styles/qt5-config-style-ukui/widget-parameters/config-radiobutton-parameters.h b/ukui-styles/qt5-config-style-ukui/widget-parameters/config-radiobutton-parameters.h index d1e738d..66b0cd4 100644 --- a/ukui-styles/qt5-config-style-ukui/widget-parameters/config-radiobutton-parameters.h +++ b/ukui-styles/qt5-config-style-ukui/widget-parameters/config-radiobutton-parameters.h @@ -25,10 +25,13 @@ #include #include +#include "control-parameters.h" + namespace UKUIConfigStyleSpace { -class ConfigRadioButtonParameters +class ConfigRadioButtonParameters : public ControlParameters { + Q_OBJECT public: ConfigRadioButtonParameters(); diff --git a/ukui-styles/qt5-config-style-ukui/widget-parameters/config-scrollbar-parameters.h b/ukui-styles/qt5-config-style-ukui/widget-parameters/config-scrollbar-parameters.h index 1ecfb2f..b406b43 100644 --- a/ukui-styles/qt5-config-style-ukui/widget-parameters/config-scrollbar-parameters.h +++ b/ukui-styles/qt5-config-style-ukui/widget-parameters/config-scrollbar-parameters.h @@ -25,10 +25,13 @@ #define SCROLLBARPARAMETERS_H #include +#include "control-parameters.h" + namespace UKUIConfigStyleSpace { -class ConfigScrollBarParameters +class ConfigScrollBarParameters : public ControlParameters { + Q_OBJECT public: ConfigScrollBarParameters(); diff --git a/ukui-styles/qt5-config-style-ukui/widget-parameters/config-slider-parameters.h b/ukui-styles/qt5-config-style-ukui/widget-parameters/config-slider-parameters.h index ef39fab..bc539fd 100644 --- a/ukui-styles/qt5-config-style-ukui/widget-parameters/config-slider-parameters.h +++ b/ukui-styles/qt5-config-style-ukui/widget-parameters/config-slider-parameters.h @@ -27,10 +27,13 @@ #include #include #include +#include "control-parameters.h" + namespace UKUIConfigStyleSpace { -class ConfigSliderParameters +class ConfigSliderParameters : public ControlParameters { + Q_OBJECT public: ConfigSliderParameters(); diff --git a/ukui-styles/qt5-config-style-ukui/widget-parameters/config-spinbox-parameters.h b/ukui-styles/qt5-config-style-ukui/widget-parameters/config-spinbox-parameters.h index 54c808f..7e09907 100644 --- a/ukui-styles/qt5-config-style-ukui/widget-parameters/config-spinbox-parameters.h +++ b/ukui-styles/qt5-config-style-ukui/widget-parameters/config-spinbox-parameters.h @@ -26,11 +26,12 @@ #include #include - +#include "control-parameters.h" namespace UKUIConfigStyleSpace { -class ConfigSpinBoxParameters +class ConfigSpinBoxParameters : public ControlParameters { + Q_OBJECT public: ConfigSpinBoxParameters(); diff --git a/ukui-styles/qt5-config-style-ukui/widget-parameters/config-table-parameters.h b/ukui-styles/qt5-config-style-ukui/widget-parameters/config-table-parameters.h index 53a9a8d..1c057e2 100644 --- a/ukui-styles/qt5-config-style-ukui/widget-parameters/config-table-parameters.h +++ b/ukui-styles/qt5-config-style-ukui/widget-parameters/config-table-parameters.h @@ -25,11 +25,13 @@ #include #include +#include "control-parameters.h" namespace UKUIConfigStyleSpace { -class ConfigTableParameters +class ConfigTableParameters : public ControlParameters { + Q_OBJECT public: ConfigTableParameters(); diff --git a/ukui-styles/qt5-config-style-ukui/widget-parameters/config-tabwidget-parameters.h b/ukui-styles/qt5-config-style-ukui/widget-parameters/config-tabwidget-parameters.h index eb85537..487a10d 100644 --- a/ukui-styles/qt5-config-style-ukui/widget-parameters/config-tabwidget-parameters.h +++ b/ukui-styles/qt5-config-style-ukui/widget-parameters/config-tabwidget-parameters.h @@ -26,10 +26,13 @@ #include #include +#include "control-parameters.h" + namespace UKUIConfigStyleSpace { -class ConfigTabWidgetParameters +class ConfigTabWidgetParameters : public ControlParameters { + Q_OBJECT public: ConfigTabWidgetParameters(); diff --git a/ukui-styles/qt5-config-style-ukui/widget-parameters/config-toolbutton-parameters.h b/ukui-styles/qt5-config-style-ukui/widget-parameters/config-toolbutton-parameters.h index 81b2c9b..741b812 100644 --- a/ukui-styles/qt5-config-style-ukui/widget-parameters/config-toolbutton-parameters.h +++ b/ukui-styles/qt5-config-style-ukui/widget-parameters/config-toolbutton-parameters.h @@ -26,10 +26,13 @@ #include #include +#include "control-parameters.h" + namespace UKUIConfigStyleSpace { -class ConfigToolButtonParameters +class ConfigToolButtonParameters : public ControlParameters { + Q_OBJECT public: ConfigToolButtonParameters(); diff --git a/ukui-styles/qt5-config-style-ukui/widget-parameters/config-tooltip-parameters.h b/ukui-styles/qt5-config-style-ukui/widget-parameters/config-tooltip-parameters.h index b126159..3f3be97 100644 --- a/ukui-styles/qt5-config-style-ukui/widget-parameters/config-tooltip-parameters.h +++ b/ukui-styles/qt5-config-style-ukui/widget-parameters/config-tooltip-parameters.h @@ -26,10 +26,12 @@ #include #include +#include "control-parameters.h" namespace UKUIConfigStyleSpace { -class ConfigToolTipParameters +class ConfigToolTipParameters : public ControlParameters { + Q_OBJECT public: ConfigToolTipParameters(); diff --git a/ukui-styles/qt5-config-style-ukui/widget-parameters/config-tree-parameters.h b/ukui-styles/qt5-config-style-ukui/widget-parameters/config-tree-parameters.h index e5291f7..ef357f3 100644 --- a/ukui-styles/qt5-config-style-ukui/widget-parameters/config-tree-parameters.h +++ b/ukui-styles/qt5-config-style-ukui/widget-parameters/config-tree-parameters.h @@ -25,10 +25,12 @@ #include #include +#include "control-parameters.h" namespace UKUIConfigStyleSpace { -class ConfigTreeParameters +class ConfigTreeParameters : public ControlParameters { + Q_OBJECT public: ConfigTreeParameters(); diff --git a/ukui-styles/qt5-config-style-ukui/widget-parameters/control-parameters.cpp b/ukui-styles/qt5-config-style-ukui/widget-parameters/control-parameters.cpp new file mode 100644 index 0000000..e5cbe7e --- /dev/null +++ b/ukui-styles/qt5-config-style-ukui/widget-parameters/control-parameters.cpp @@ -0,0 +1,34 @@ +/* + * Qt5-UKUI's Library + * + * Copyright (C) 2023, KylinSoft Co., Ltd. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this library. If not, see . + * + * Authors: xibowen + * + */ + + +#include "control-parameters.h" +using namespace UKUIConfigStyleSpace; + +ControlParameters::ControlParameters(QObject *parent) : QObject(parent) +{ + +} +ControlParameters::~ControlParameters() +{ + +} diff --git a/ukui-styles/qt5-config-style-ukui/widget-parameters/control-parameters.h b/ukui-styles/qt5-config-style-ukui/widget-parameters/control-parameters.h new file mode 100644 index 0000000..bdaf05f --- /dev/null +++ b/ukui-styles/qt5-config-style-ukui/widget-parameters/control-parameters.h @@ -0,0 +1,42 @@ +/* + * Qt5-UKUI's Library + * + * Copyright (C) 2023, KylinSoft Co., Ltd. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this library. If not, see . + * + * Authors: xibowen + * + */ + + +#ifndef ControlParameters_H +#define ControlParameters_H + +#include + +namespace UKUIConfigStyleSpace { + +class ControlParameters : public QObject +{ + Q_OBJECT +public: + explicit ControlParameters(QObject *parent = nullptr); + + ~ControlParameters(); + +// virtual void getParameters(){} +}; +} +#endif // ControlParameters_H diff --git a/ukui-styles/ukui-style-plugin.cpp b/ukui-styles/ukui-style-plugin.cpp index 32f6930..0949da5 100644 --- a/ukui-styles/ukui-style-plugin.cpp +++ b/ukui-styles/ukui-style-plugin.cpp @@ -57,6 +57,7 @@ UKUIStylePlugin::UKUIStylePlugin(QObject *parent) : // if (appStyleSettings->currentStyleStretagy() != ApplicationStyleSettings::Default) // return; + qDebug() << "UKUIStyleSettings change...." << key; auto styleName = settings->get("styleName").toString(); auto widgetThemeName = settings->get("widgetThemeName").toString();