From b6b68dafd9bdba7048d801801ee4eb19e7e62ef6 Mon Sep 17 00:00:00 2001 From: tanjing Date: Wed, 30 Aug 2023 11:32:00 +0800 Subject: [PATCH] =?UTF-8?q?list=20tree=20table=E9=BB=98=E8=AE=A4=E9=80=89?= =?UTF-8?q?=E4=B8=AD=E4=B8=BA=E7=81=B0=E8=89=B2=EF=BC=8C=E5=B9=B6=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E4=B8=80=E4=B8=AA=E8=AE=BE=E7=BD=AE=E9=80=89=E4=B8=AD?= =?UTF-8?q?=E4=B8=BA=E9=AB=98=E4=BA=AE=E8=89=B2=E7=9A=84=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../themeconfig/UKUIConfigClassical.json | 42 ++++++++++++++++ .../themeconfig/UKUIConfigDefault.json | 48 +++++++++++++++++++ .../themeconfig/UKUIConfigFashion.json | 48 +++++++++++++++++++ .../ukui-config-style-parameters.cpp | 21 ++++++-- .../ukui-config-style.cpp | 6 +++ ukui-styles/themeinformation.h | 3 ++ 6 files changed, 164 insertions(+), 4 deletions(-) diff --git a/ukui-styles/qt5-config-style-ukui/themeconfig/UKUIConfigClassical.json b/ukui-styles/qt5-config-style-ukui/themeconfig/UKUIConfigClassical.json index 7136a60..a1017d0 100644 --- a/ukui-styles/qt5-config-style-ukui/themeconfig/UKUIConfigClassical.json +++ b/ukui-styles/qt5-config-style-ukui/themeconfig/UKUIConfigClassical.json @@ -240,6 +240,13 @@ "TextHoverPen" : {"value": "ButtonText_at", "type": "paletterole"}, "TextSelectPen" : {"value": "ButtonText_at", "type": "paletterole"} }, + "HighlightListView":{ + "DefaultBrush" : {"value": "0, 0, 0, 0", "type": "color"}, + "HoverBrush" : {"type": "color"}, + "DisableBrush" : {"value": "0, 0, 0, 0", "type": "color"}, + "TextHoverPen" : {"value": "ButtonText_at", "type": "paletterole"}, + "TextSelectPen" : {"value": "ButtonText_at", "type": "paletterole"} + }, "TranslucentListView":{ "DefaultBrush" : {"value": "0, 0, 0, 0", "type": "color"}, "HoverBrush" : {"type": "color"}, @@ -255,6 +262,13 @@ "DisableBrush" : {"value": "255, 255, 255, 0", "type": "color"}, "TextHoverPen" : {"value": "ButtonText_at", "type": "paletterole"}, "TextSelectPen" : {"value": "ButtonText_at", "type": "paletterole"} + }, + "HighlightTreeView":{ + "DefaultBrush" : {"value": "255, 255, 255, 0", "type": "color"}, + "HoverBrush" : { "type": "color"}, + "DisableBrush" : {"value": "255, 255, 255, 0", "type": "color"}, + "TextHoverPen" : {"value": "ButtonText_at", "type": "paletterole"}, + "TextSelectPen" : {"value": "ButtonText_at", "type": "paletterole"} } }, "Table":{ @@ -264,6 +278,13 @@ "DisableBrush" : {"value": "255, 255, 255, 0", "type": "color"}, "TextHoverPen" : {"value": "ButtonText_at", "type": "paletterole"}, "TextSelectPen" : {"value": "ButtonText_at", "type": "paletterole"} + }, + "HighlightTable":{ + "DefaultBrush" : {"value": "255, 255, 255, 0", "type": "color"}, + "HoverBrush" : { "type": "color"}, + "DisableBrush" : {"value": "255, 255, 255, 0", "type": "color"}, + "TextHoverPen" : {"value": "ButtonText_at", "type": "paletterole"}, + "TextSelectPen" : {"value": "ButtonText_at", "type": "paletterole"} } }, "CheckBox":{ @@ -601,6 +622,13 @@ "TextHoverPen" : {"value": "ButtonText_at", "type": "paletterole"}, "TextSelectPen" : {"value": "ButtonText_at", "type": "paletterole"} }, + "HighlightListView":{ + "DefaultBrush" : {"value": "0, 0, 0, 0", "type": "color"}, + "HoverBrush" : {"type": "color"}, + "DisableBrush" : {"value": "0, 0, 0, 0", "type": "color"}, + "TextHoverPen" : {"value": "ButtonText_at", "type": "paletterole"}, + "TextSelectPen" : {"value": "ButtonText_at", "type": "paletterole"} + }, "TranslucentListView":{ "DefaultBrush" : {"value": "0, 0, 0, 0", "type": "color"}, "HoverBrush" : {"type": "color"}, @@ -616,6 +644,13 @@ "DisableBrush" : {"value": "0, 0, 0, 0", "type": "color"}, "TextHoverPen" : {"value": "ButtonText_at", "type": "paletterole"}, "TextSelectPen" : {"value": "ButtonText_at", "type": "paletterole"} + }, + "HighlightTreeView":{ + "DefaultBrush" : {"value": "0, 0, 0, 0", "type": "color"}, + "HoverBrush" : { "type": "color"}, + "DisableBrush" : {"value": "0, 0, 0, 0", "type": "color"}, + "TextHoverPen" : {"value": "ButtonText_at", "type": "paletterole"}, + "TextSelectPen" : {"value": "ButtonText_at", "type": "paletterole"} } }, "Table":{ @@ -625,6 +660,13 @@ "DisableBrush" : {"value": "0, 0, 0, 0", "type": "color"}, "TextHoverPen" : {"value": "ButtonText_at", "type": "paletterole"}, "TextSelectPen" : {"value": "ButtonText_at", "type": "paletterole"} + }, + "HighlightTable":{ + "DefaultBrush" : {"value": "0, 0, 0, 0", "type": "color"}, + "HoverBrush" : { "type": "color"}, + "DisableBrush" : {"value": "0, 0, 0, 0", "type": "color"}, + "TextHoverPen" : {"value": "ButtonText_at", "type": "paletterole"}, + "TextSelectPen" : {"value": "ButtonText_at", "type": "paletterole"} } }, "CheckBox":{ diff --git a/ukui-styles/qt5-config-style-ukui/themeconfig/UKUIConfigDefault.json b/ukui-styles/qt5-config-style-ukui/themeconfig/UKUIConfigDefault.json index 23b5a99..c99d47f 100644 --- a/ukui-styles/qt5-config-style-ukui/themeconfig/UKUIConfigDefault.json +++ b/ukui-styles/qt5-config-style-ukui/themeconfig/UKUIConfigDefault.json @@ -235,6 +235,14 @@ }, "ListView":{ "DefaultListView":{ + "DefaultBrush" : {"value": "0, 0, 0, 0", "type": "color"}, + "HoverBrush" : {"value": "0, 0, 0, 0.05", "type": "color"}, + "SelectBrush" : {"value": "Button_dis", "type": "paletterole"}, + "DisableBrush" : {"value": "0, 0, 0, 0", "type": "color"}, + "TextHoverPen" : {"value": "Text_at", "type": "paletterole"}, + "TextSelectPen" : {"value": "Text_at", "type": "paletterole"} + }, + "HighlightListView":{ "DefaultBrush" : {"value": "0, 0, 0, 0", "type": "color"}, "HoverBrush" : {"value": "0, 0, 0, 0.05", "type": "color"}, "SelectBrush" : {"value": "HighLight_at", "type": "paletterole"}, @@ -253,6 +261,14 @@ }, "TreeView":{ "DefaultTreeView":{ + "DefaultBrush" : {"value": "255, 255, 255, 0", "type": "color"}, + "HoverBrush" : {"value": "0, 0, 0, 0.05", "type": "color"}, + "SelectBrush" : {"value": "Button_dis", "type": "paletterole"}, + "DisableBrush" : {"value": "255, 255, 255, 0", "type": "color"}, + "TextHoverPen" : {"value": "Text_at", "type": "paletterole"}, + "TextSelectPen" : {"value": "Text_at", "type": "paletterole"} + }, + "HighlightTreeView":{ "DefaultBrush" : {"value": "255, 255, 255, 0", "type": "color"}, "HoverBrush" : {"value": "0, 0, 0, 0.05", "type": "color"}, "SelectBrush" : {"value": "HighLight_at", "type": "paletterole"}, @@ -263,6 +279,14 @@ }, "Table":{ "DefaultTable":{ + "DefaultBrush" : {"value": "255, 255, 255, 0", "type": "color"}, + "HoverBrush" : {"value": "0, 0, 0, 0.05", "type": "color"}, + "SelectBrush" : {"value": "Button_dis", "type": "paletterole"}, + "DisableBrush" : {"value": "255, 255, 255, 0", "type": "color"}, + "TextHoverPen" : {"value": "Text_at", "type": "paletterole"}, + "TextSelectPen" : {"value": "Text_at", "type": "paletterole"} + }, + "HighlightTable":{ "DefaultBrush" : {"value": "255, 255, 255, 0", "type": "color"}, "HoverBrush" : {"value": "0, 0, 0, 0.05", "type": "color"}, "SelectBrush" : {"value": "HighLight_at", "type": "paletterole"}, @@ -619,6 +643,14 @@ }, "ListView":{ "DefaultListView":{ + "DefaultBrush" : {"value": "255, 255, 255, 0", "type": "color"}, + "HoverBrush" : {"value": "255, 255, 255, 0.15", "type": "color"}, + "SelectBrush" : {"value": "64, 64, 64", "type": "color"}, + "DisableBrush" : {"value": "255, 255, 255, 0", "type": "color"}, + "TextHoverPen" : {"value": "Text_at", "type": "paletterole"}, + "TextSelectPen" : {"value": "Text_at", "type": "paletterole"} + }, + "HighlightListView":{ "DefaultBrush" : {"value": "255, 255, 255, 0", "type": "color"}, "HoverBrush" : {"value": "255, 255, 255, 0.15", "type": "color"}, "SelectBrush" : {"value": "HighLight_at", "type": "paletterole"}, @@ -637,6 +669,14 @@ }, "TreeView":{ "DefaultTreeView":{ + "DefaultBrush" : {"value": "255, 255, 255, 0", "type": "color"}, + "HoverBrush" : {"value": "255, 255, 255, 0.15", "type": "color"}, + "SelectBrush" : {"value": "64, 64, 64", "type": "color"}, + "DisableBrush" : {"value": "255, 255, 255, 0", "type": "color"}, + "TextHoverPen" : {"value": "Text_at", "type": "paletterole"}, + "TextSelectPen" : {"value": "Text_at", "type": "paletterole"} + }, + "HighlightTreeView":{ "DefaultBrush" : {"value": "255, 255, 255, 0", "type": "color"}, "HoverBrush" : {"value": "255, 255, 255, 0.15", "type": "color"}, "SelectBrush" : {"value": "HighLight_at", "type": "paletterole"}, @@ -647,6 +687,14 @@ }, "Table":{ "DefaultTable":{ + "DefaultBrush" : {"value": "255, 255, 255, 0", "type": "color"}, + "HoverBrush" : {"value": "255, 255, 255, 0.15", "type": "color"}, + "SelectBrush" : {"value": "64, 64, 64", "type": "color"}, + "DisableBrush" : {"value": "255, 255, 255, 0", "type": "color"}, + "TextHoverPen" : {"value": "Text_at", "type": "paletterole"}, + "TextSelectPen" : {"value": "Text_at", "type": "paletterole"} + }, + "HighlightTable":{ "DefaultBrush" : {"value": "255, 255, 255, 0", "type": "color"}, "HoverBrush" : {"value": "255, 255, 255, 0.15", "type": "color"}, "SelectBrush" : {"value": "HighLight_at", "type": "paletterole"}, diff --git a/ukui-styles/qt5-config-style-ukui/themeconfig/UKUIConfigFashion.json b/ukui-styles/qt5-config-style-ukui/themeconfig/UKUIConfigFashion.json index 0de7d72..0148840 100644 --- a/ukui-styles/qt5-config-style-ukui/themeconfig/UKUIConfigFashion.json +++ b/ukui-styles/qt5-config-style-ukui/themeconfig/UKUIConfigFashion.json @@ -233,6 +233,14 @@ }, "ListView":{ "DefaultListView":{ + "DefaultBrush" : {"value": "255, 255, 255, 0", "type": "color"}, + "HoverBrush" : {"type": "gradient"}, + "SelectBrush" : {"value": "Button_dis", "type": "paletterole"}, + "DisableBrush" : {"value": "255, 255, 255, 0", "type": "color"}, + "TextHoverPen" : {"value": "Text_at", "type": "paletterole"}, + "TextSelectPen" : {"value": "Text_at", "type": "paletterole"} + }, + "HighlightListView":{ "DefaultBrush" : {"value": "255, 255, 255, 0", "type": "color"}, "HoverBrush" : {"type": "gradient"}, "SelectBrush" : {"value": "HighLight_at", "type": "paletterole"}, @@ -250,6 +258,14 @@ }, "TreeView":{ "DefaultTreeView":{ + "DefaultBrush" : {"value": "255, 255, 255, 0", "type": "color"}, + "HoverBrush" : { "type": "gradient"}, + "SelectBrush" : {"value": "Button_dis", "type": "paletterole"}, + "DisableBrush" : {"value": "255, 255, 255, 0", "type": "color"}, + "TextHoverPen" : {"value": "Text_at", "type": "paletterole"}, + "TextSelectPen" : {"value": "Text_at", "type": "paletterole"} + }, + "HighlightTreeView":{ "DefaultBrush" : {"value": "255, 255, 255, 0", "type": "color"}, "HoverBrush" : { "type": "gradient"}, "SelectBrush" : {"value": "HighLight_at", "type": "paletterole"}, @@ -260,6 +276,14 @@ }, "Table":{ "DefaultTable":{ + "DefaultBrush" : {"value": "255, 255, 255, 0", "type": "color"}, + "HoverBrush" : { "type": "gradient"}, + "SelectBrush" : {"value": "Button_dis", "type": "paletterole"}, + "DisableBrush" : {"value": "255, 255, 255, 0", "type": "color"}, + "TextHoverPen" : {"value": "Text_at", "type": "paletterole"}, + "TextSelectPen" : {"value": "Text_at", "type": "paletterole"} + }, + "HighlightTable":{ "DefaultBrush" : {"value": "255, 255, 255, 0", "type": "color"}, "HoverBrush" : { "type": "gradient"}, "SelectBrush" : {"value": "HighLight_at", "type": "paletterole"}, @@ -613,6 +637,14 @@ }, "ListView":{ "DefaultListView":{ + "DefaultBrush" : {"value": "255, 255, 255, 0", "type": "color"}, + "HoverBrush" : {"type": "gradient"}, + "SelectBrush" : {"value": "64, 64, 64", "type": "color"}, + "DisableBrush" : {"value": "255, 255, 255, 0", "type": "color"}, + "TextHoverPen" : {"value": "Text_at", "type": "paletterole"}, + "TextSelectPen" : {"value": "Text_at", "type": "paletterole"} + }, + "HighlightListView":{ "DefaultBrush" : {"value": "255, 255, 255, 0", "type": "color"}, "HoverBrush" : {"type": "gradient"}, "SelectBrush" : {"value": "HighLight_at", "type": "paletterole"}, @@ -630,6 +662,14 @@ }, "TreeView":{ "DefaultTreeView":{ + "DefaultBrush" : {"value": "255, 255, 255, 0", "type": "color"}, + "HoverBrush" : { "type": "gradient"}, + "SelectBrush" : {"value": "64, 64, 64", "type": "color"}, + "DisableBrush" : {"value": "255, 255, 255, 0", "type": "color"}, + "TextHoverPen" : {"value": "Text_at", "type": "paletterole"}, + "TextSelectPen" : {"value": "Text_at", "type": "paletterole"} + }, + "HighlightTreeView":{ "DefaultBrush" : {"value": "255, 255, 255, 0", "type": "color"}, "HoverBrush" : { "type": "gradient"}, "SelectBrush" : {"value": "HighLight_at", "type": "paletterole"}, @@ -640,6 +680,14 @@ }, "Table":{ "DefaultTable":{ + "DefaultBrush" : {"value": "255, 255, 255, 0", "type": "color"}, + "HoverBrush" : { "type": "gradient"}, + "SelectBrush" : {"value": "64, 64, 64", "type": "color"}, + "DisableBrush" : {"value": "255, 255, 255, 0", "type": "color"}, + "TextHoverPen" : {"value": "Text_at", "type": "paletterole"}, + "TextSelectPen" : {"value": "Text_at", "type": "paletterole"} + }, + "HighlightTable":{ "DefaultBrush" : {"value": "255, 255, 255, 0", "type": "color"}, "HoverBrush" : { "type": "gradient"}, "SelectBrush" : {"value": "HighLight_at", "type": "paletterole"}, 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 2f01086..0d27068 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 @@ -2125,11 +2125,15 @@ void UKUIConfigStyleParameters::initConfigListParameters(bool isDark, const QSty int radius = m_radiusStruct.normalRadius; bool needTranslucent = false; + bool highlightMode = false; + if (widget && widget->property("highlightMode").isValid()) { + highlightMode = widget->property("highlightMode").toBool(); + } if (widget && widget->property("needTranslucent").isValid()) { needTranslucent = widget->property("needTranslucent").toBool(); } - UKUIColorTheme::ListViewColorCfg listViewColorCfg = readCfg()->listViewColorCfg(option->palette ,needTranslucent ? C_ListView_Translucent : C_ListView_Default); + UKUIColorTheme::ListViewColorCfg listViewColorCfg = readCfg()->listViewColorCfg(option->palette, highlightMode ? C_ListView_Highlight : (needTranslucent ? C_ListView_Translucent : C_ListView_Default)); QBrush defaultBrush = listViewColorCfg.defaultBrush; QBrush hoverBrush = listViewColorCfg.hoverBrush; @@ -2261,7 +2265,11 @@ void UKUIConfigStyleParameters::initConfigTreeParameters(bool isDark, const QSty { int radius = m_radiusStruct.normalRadius;; - UKUIColorTheme::TreeViewColorCfg treeViewColorCfg = readCfg()->treeViewColorCfg(option->palette, C_TreeView_Default); + bool highlightMode = false; + if (widget && widget->property("highlightMode").isValid()) { + highlightMode = widget->property("highlightMode").toBool(); + } + UKUIColorTheme::TreeViewColorCfg treeViewColorCfg = readCfg()->treeViewColorCfg(option->palette, highlightMode ? C_TreeView_HighLight : C_TreeView_Default); QBrush defaultBrush = treeViewColorCfg.defaultBrush; QBrush hoverBrush = treeViewColorCfg.hoverBrush; @@ -2400,8 +2408,13 @@ void UKUIConfigStyleParameters::initConfigTreeParameters(bool isDark, const QSty void UKUIConfigStyleParameters::initConfigTableParameters(bool isDark, const QStyleOption *option, const QWidget *widget) { - int radius = m_radiusStruct.normalRadius;; - UKUIColorTheme::TableColorCfg tableColorCfg = readCfg()->tableColorCfg(option->palette, C_Table_Default); + int radius = m_radiusStruct.normalRadius; + + bool highlightMode = false; + if (widget && widget->property("highlightMode").isValid()) { + highlightMode = widget->property("highlightMode").toBool(); + } + UKUIColorTheme::TableColorCfg tableColorCfg = readCfg()->tableColorCfg(option->palette, highlightMode ? C_Table_Highlight : C_Table_Default); QBrush defaultBrush = tableColorCfg.defaultBrush; QBrush hoverBrush = QBrush(tableColorCfg.hoverBrush); 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 6640a23..48559ed 100644 --- a/ukui-styles/qt5-config-style-ukui/ukui-config-style.cpp +++ b/ukui-styles/qt5-config-style-ukui/ukui-config-style.cpp @@ -2200,6 +2200,12 @@ void UKUIConfigStyle::drawPrimitive(QStyle::PrimitiveElement element, const QSty target = HighLightEffect::ordinaryGeneratePixmap(pixmap, option, widget); else if(!sp->indicatorIconHoverNeedHighLight) target = HighLightEffect::ordinaryGeneratePixmap(pixmap, option, widget); + else if(widget && (widget->inherits("QTreeView") || widget->inherits("QTreeWidget"))){ + if(widget->property("highlightMode").isValid() && widget->property("highlightMode").toBool()) + target = HighLightEffect::bothOrdinaryAndHoverGeneratePixmap(pixmap, option, widget); + else + target = HighLightEffect::ordinaryGeneratePixmap(pixmap, option, widget); + } else target = HighLightEffect::bothOrdinaryAndHoverGeneratePixmap(pixmap, option, widget); diff --git a/ukui-styles/themeinformation.h b/ukui-styles/themeinformation.h index 4af35c2..937ae83 100644 --- a/ukui-styles/themeinformation.h +++ b/ukui-styles/themeinformation.h @@ -184,6 +184,7 @@ #define UKUITable "Table" #define C_Table_Default "DefaultTable" +#define C_Table_Highlight "HighlightTable" #define C_Table_DefaultBrush "DefaultBrush" #define C_Table_HoverBrush "HoverBrush" #define C_Table_SelectBrush "SelectBrush" @@ -195,6 +196,7 @@ #define UKUIListView "ListView" #define C_ListView_Default "DefaultListView" +#define C_ListView_Highlight "HighlightListView" #define C_ListView_Translucent "TranslucentListView" #define C_ListView_DefaultBrush "DefaultBrush" #define C_ListView_HoverBrush "HoverBrush" @@ -207,6 +209,7 @@ #define UKUITreeView "TreeView" #define C_TreeView_Default "DefaultTreeView" +#define C_TreeView_HighLight "HighlightTreeView" #define C_TreeView_Translucent "TranslucentTreeView" #define C_TreeView_DefaultBrush "DefaultBrush" #define C_TreeView_HoverBrush "HoverBrush"