在app级别添加常用控件的默认状态的一些接口

This commit is contained in:
tanjing 2024-02-29 15:28:10 +08:00
parent 689ce75bd4
commit b370c10b36
23 changed files with 1146 additions and 238 deletions

View File

@ -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;
};
}

View File

@ -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 <QSharedPointer>
#include <QStyleOption>
#include <QWidget>
#include <QPainter>
@ -94,6 +95,7 @@
#include <QCheckBox>
#include <KWindowEffects>
#include <KWindowSystem>
#include <QtConcurrent/QtConcurrent>
#include <private/qlineedit_p.h>
@ -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<ConfigPushButtonParameters> 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<ConfigToolButtonParameters> 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<ConfigLineEditParameters> 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<ConfigSpinBoxParameters> 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<ConfigComboBoxParameters> 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<ConfigListParameters> 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<ConfigTreeParameters> 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<ConfigTableParameters> 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<ConfigCheckBoxParameters> 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<ConfigRadioButtonParameters> 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<ConfigSliderParameters> 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<ConfigProgressBarParameters> 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<ConfigScrollBarParameters> 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<ConfigToolTipParameters> 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<ConfigTabWidgetParameters> 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<ConfigMenuParameters> 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 );
}

View File

@ -24,12 +24,13 @@
#define UKUICONFIGSTYLE_H
#include <QProxyStyle>
#include <QFontMetrics>
#include <QStyleOption>
#include <private/qtextengine_p.h>
#include <qmath.h>
#include <QGSettings>
#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

View File

@ -26,10 +26,13 @@
#include <QBrush>
#include <QPen>
#include "control-parameters.h"
namespace UKUIConfigStyleSpace {
class ConfigCheckBoxParameters
class ConfigCheckBoxParameters : public ControlParameters
{
Q_OBJECT
public:
ConfigCheckBoxParameters();

View File

@ -25,10 +25,13 @@
#include <QBrush>
#include <QPen>
#include "control-parameters.h"
namespace UKUIConfigStyleSpace {
class ConfigComboBoxParameters
class ConfigComboBoxParameters : public ControlParameters
{
Q_OBJECT
public:
ConfigComboBoxParameters();

View File

@ -27,10 +27,13 @@
#include <QBrush>
#include <QPen>
#include "control-parameters.h"
namespace UKUIConfigStyleSpace {
class ConfigLineEditParameters
class ConfigLineEditParameters : public ControlParameters
{
Q_OBJECT
public:
ConfigLineEditParameters();

View File

@ -26,10 +26,13 @@
#include <QBrush>
#include <QPen>
#include "control-parameters.h"
namespace UKUIConfigStyleSpace {
class ConfigListParameters
class ConfigListParameters : public ControlParameters
{
Q_OBJECT
public:
ConfigListParameters();

View File

@ -27,10 +27,13 @@
#include <QPixmap>
#include <QBrush>
#include <QPen>
#include "control-parameters.h"
namespace UKUIConfigStyleSpace {
class ConfigMenuParameters
class ConfigMenuParameters : public ControlParameters
{
Q_OBJECT
public:
ConfigMenuParameters();

View File

@ -26,10 +26,13 @@
#include <QBrush>
#include <QPen>
#include "control-parameters.h"
namespace UKUIConfigStyleSpace {
class ConfigProgressBarParameters
class ConfigProgressBarParameters : public ControlParameters
{
Q_OBJECT
public:
ConfigProgressBarParameters();

View File

@ -27,10 +27,13 @@
#include <QBrush>
#include <QPen>
#include "control-parameters.h"
namespace UKUIConfigStyleSpace {
class ConfigPushButtonParameters
class ConfigPushButtonParameters : public ControlParameters
{
Q_OBJECT
public:
ConfigPushButtonParameters();

View File

@ -25,10 +25,13 @@
#include <QBrush>
#include <QPen>
#include "control-parameters.h"
namespace UKUIConfigStyleSpace {
class ConfigRadioButtonParameters
class ConfigRadioButtonParameters : public ControlParameters
{
Q_OBJECT
public:
ConfigRadioButtonParameters();

View File

@ -25,10 +25,13 @@
#define SCROLLBARPARAMETERS_H
#include <QBrush>
#include "control-parameters.h"
namespace UKUIConfigStyleSpace {
class ConfigScrollBarParameters
class ConfigScrollBarParameters : public ControlParameters
{
Q_OBJECT
public:
ConfigScrollBarParameters();

View File

@ -27,10 +27,13 @@
#include <QBrush>
#include <QPainterPath>
#include <QPen>
#include "control-parameters.h"
namespace UKUIConfigStyleSpace {
class ConfigSliderParameters
class ConfigSliderParameters : public ControlParameters
{
Q_OBJECT
public:
ConfigSliderParameters();

View File

@ -26,11 +26,12 @@
#include <QBrush>
#include <QPen>
#include "control-parameters.h"
namespace UKUIConfigStyleSpace {
class ConfigSpinBoxParameters
class ConfigSpinBoxParameters : public ControlParameters
{
Q_OBJECT
public:
ConfigSpinBoxParameters();

View File

@ -25,11 +25,13 @@
#include <QBrush>
#include <QPen>
#include "control-parameters.h"
namespace UKUIConfigStyleSpace {
class ConfigTableParameters
class ConfigTableParameters : public ControlParameters
{
Q_OBJECT
public:
ConfigTableParameters();

View File

@ -26,10 +26,13 @@
#include <QBrush>
#include <QPen>
#include "control-parameters.h"
namespace UKUIConfigStyleSpace {
class ConfigTabWidgetParameters
class ConfigTabWidgetParameters : public ControlParameters
{
Q_OBJECT
public:
ConfigTabWidgetParameters();

View File

@ -26,10 +26,13 @@
#include <QBrush>
#include <QPen>
#include "control-parameters.h"
namespace UKUIConfigStyleSpace {
class ConfigToolButtonParameters
class ConfigToolButtonParameters : public ControlParameters
{
Q_OBJECT
public:
ConfigToolButtonParameters();

View File

@ -26,10 +26,12 @@
#include <QBrush>
#include <QPen>
#include "control-parameters.h"
namespace UKUIConfigStyleSpace {
class ConfigToolTipParameters
class ConfigToolTipParameters : public ControlParameters
{
Q_OBJECT
public:
ConfigToolTipParameters();

View File

@ -25,10 +25,12 @@
#include <QBrush>
#include <QPen>
#include "control-parameters.h"
namespace UKUIConfigStyleSpace {
class ConfigTreeParameters
class ConfigTreeParameters : public ControlParameters
{
Q_OBJECT
public:
ConfigTreeParameters();

View File

@ -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 <https://www.gnu.org/licenses/>.
*
* Authors: xibowen <lanyue@kylinos.cn>
*
*/
#include "control-parameters.h"
using namespace UKUIConfigStyleSpace;
ControlParameters::ControlParameters(QObject *parent) : QObject(parent)
{
}
ControlParameters::~ControlParameters()
{
}

View File

@ -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 <https://www.gnu.org/licenses/>.
*
* Authors: xibowen <lanyue@kylinos.cn>
*
*/
#ifndef ControlParameters_H
#define ControlParameters_H
#include <QObject>
namespace UKUIConfigStyleSpace {
class ControlParameters : public QObject
{
Q_OBJECT
public:
explicit ControlParameters(QObject *parent = nullptr);
~ControlParameters();
// virtual void getParameters(){}
};
}
#endif // ControlParameters_H

View File

@ -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();