From f7c20853d90cd8698990711776b90dd288a2c06e Mon Sep 17 00:00:00 2001 From: xibowen Date: Thu, 16 Jun 2022 11:05:23 +0000 Subject: [PATCH] sync platformtheme 3.20 --- debian/changelog | 93 +- debian/control | 28 +- debian/libqt5-ukui-style-dev.install | 2 +- libqt5-ukui-style/settings/black-list.h | 1 + .../settings/org.ukui.style.gschema.xml | 2 +- ukui-styles/proxy-style/blur-helper.cpp | 4 +- .../proxy-style/proxy-style-plugin.cpp | 2 +- ukui-styles/proxy-style/window-manager.cpp | 2 +- .../qt5-style-ukui/checkbox-parameters.cpp | 29 + .../qt5-style-ukui/checkbox-parameters.h | 55 + .../kabstract-style-parameters.cpp | 1960 +++++++++++++++-- .../kabstract-style-parameters.h | 81 +- .../qt5-style-ukui/list-parameters.cpp | 28 + ukui-styles/qt5-style-ukui/list-parameters.h | 43 + ukui-styles/qt5-style-ukui/menu-helper.cpp | 94 - .../qt5-style-ukui/menu-parameters.cpp | 29 + ukui-styles/qt5-style-ukui/menu-parameters.h | 43 + .../qt5-style-ukui/progressbar-parameters.cpp | 29 + .../qt5-style-ukui/progressbar-parameters.h | 44 + ukui-styles/qt5-style-ukui/qt5-style-ukui.pro | 25 +- ukui-styles/qt5-style-ukui/qt5-ukui-style.cpp | 778 ++++--- ukui-styles/qt5-style-ukui/qt5-ukui-style.h | 3 - .../qt5-style-ukui/radiobutton-parameters.cpp | 28 + .../qt5-style-ukui/radiobutton-parameters.h | 54 + .../qt5-style-ukui/scrollbar-parameters.cpp | 29 + .../qt5-style-ukui/scrollbar-parameters.h | 46 + .../qt5-style-ukui/slider-parameters.cpp | 29 + .../qt5-style-ukui/slider-parameters.h | 50 + .../qt5-style-ukui/table-parameters.cpp | 28 + ukui-styles/qt5-style-ukui/table-parameters.h | 43 + .../qt5-style-ukui/tabwidget-parameters.cpp | 29 + .../qt5-style-ukui/tabwidget-parameters.h | 46 + .../qt5-style-ukui/tooltip-parameters.cpp | 29 + .../qt5-style-ukui/tooltip-parameters.h | 40 + .../qt5-style-ukui/tree-parameters.cpp | 28 + ukui-styles/qt5-style-ukui/tree-parameters.h | 48 + 36 files changed, 3190 insertions(+), 712 deletions(-) create mode 100644 ukui-styles/qt5-style-ukui/checkbox-parameters.cpp create mode 100644 ukui-styles/qt5-style-ukui/checkbox-parameters.h create mode 100644 ukui-styles/qt5-style-ukui/list-parameters.cpp create mode 100644 ukui-styles/qt5-style-ukui/list-parameters.h delete mode 100644 ukui-styles/qt5-style-ukui/menu-helper.cpp create mode 100644 ukui-styles/qt5-style-ukui/menu-parameters.cpp create mode 100644 ukui-styles/qt5-style-ukui/menu-parameters.h create mode 100644 ukui-styles/qt5-style-ukui/progressbar-parameters.cpp create mode 100644 ukui-styles/qt5-style-ukui/progressbar-parameters.h create mode 100644 ukui-styles/qt5-style-ukui/radiobutton-parameters.cpp create mode 100644 ukui-styles/qt5-style-ukui/radiobutton-parameters.h create mode 100644 ukui-styles/qt5-style-ukui/scrollbar-parameters.cpp create mode 100644 ukui-styles/qt5-style-ukui/scrollbar-parameters.h create mode 100644 ukui-styles/qt5-style-ukui/slider-parameters.cpp create mode 100644 ukui-styles/qt5-style-ukui/slider-parameters.h create mode 100644 ukui-styles/qt5-style-ukui/table-parameters.cpp create mode 100644 ukui-styles/qt5-style-ukui/table-parameters.h create mode 100644 ukui-styles/qt5-style-ukui/tabwidget-parameters.cpp create mode 100644 ukui-styles/qt5-style-ukui/tabwidget-parameters.h create mode 100644 ukui-styles/qt5-style-ukui/tooltip-parameters.cpp create mode 100644 ukui-styles/qt5-style-ukui/tooltip-parameters.h create mode 100644 ukui-styles/qt5-style-ukui/tree-parameters.cpp create mode 100644 ukui-styles/qt5-style-ukui/tree-parameters.h diff --git a/debian/changelog b/debian/changelog index 5ceb0e2..8c42ef5 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,10 +1,91 @@ -qt5-ukui-platformtheme (3.1.4.1~0509-0k0) v101; urgency=medium +qt5-ukui-platformtheme (3.14.2.3-0k1) yangtze; urgency=medium + + * 改动: + BUG号:无 + 需求号:无 + 其他改:修复gitee平台编译失败问题 + 影响域:主题框架编译 + + -- xibowen Mon, 13 Jun 2022 16:22:00 +0800 + +qt5-ukui-platformtheme (3.14.2.3-0k0) yangtze; urgency=medium + + * 改动: + BUG号:123302,修改viemitem下的checkbox没有颜色样式的问题 + 123144,修改scroll的悬停状态样式不正确的问题 + 需求号:无 + 其他改:调整颜色渐变规则,按照设计稿需求调整悬停渐变颜色样式 + 影响域:tree,table,list控件的checkbox模式样式,scroll悬停颜色,所有控件的渐变颜色规律 + + -- xibowen Mon, 13 Jun 2022 09:55:00 +0800 + +qt5-ukui-platformtheme (3.14.2.2) yangtze; urgency=medium + + * 改动: + BUG号:120162,寻光主题scroll三态颜色不正确的问题 + 115336,修复combobox下拉框的选择的勾勾图标名称,修改为object-select-symbolic,使得图标更加清晰 + 123111,修改和印主题深色模式下radiobutton与checkbox三态颜色正确的问题 + 123239,修改和印主题slider的悬停颜色错误问题,调整为渐变颜色 + 122778,修改文件对话框的文件列表没有三态的问题 + 114650,修改lineedit设置的action图标没有反白的问题 + 需求号:无 + 其他改:无 + 影响域:寻光主题下的scroll三态样式,和印主题下的radiobutton、checkbox与slider三态样式,文件对话框的列表三态样式,lineedit图标反白 + + -- xibowen Wed, 08 Jun 2022 17:55:00 +0800 + +qt5-ukui-platformtheme (3.14.2.1) yangtze; urgency=medium + + * 改动: + BUG号:114387(list,tree,table控件选中时图标变色的问题) + 需求号:无 + 其他改:修复progressbar的宽度问题 + 依据设计师,调整色板base颜色为29,29,29 + tabbar添加协议属性,可控制圆角参数 + radiobutton添加协议属性,可控制背景色与描边效果 + 影响域:progressbar的宽度,控件背景颜色的调整,tabbar与radiobutton添加可配置属性 + + -- xibowen Mon, 30 May 2022 10:10:00 +0800 + +qt5-ukui-platformtheme (3.14.2.0) jammy; urgency=medium + + * 改动: + BUG号:无 + 需求号:77049(Menu),56595(主题色切换) + 其他改:无 + 影响域:tabwidget,窗口移动效果 + + -- xibowen Tue, 24 May 2022 15:23:00 +0800 + +qt5-ukui-platformtheme (3.14.1.0) jammy; urgency=medium + + * 改动: + BUG号:无 + 需求号:77049(tabwidget) + 其他改:同步tablet窗口移动不灵活的问题修改 + 影响域:tabwidget,窗口移动效果 + + -- xibowen Wed, 18 May 2022 20:08:00 +0800 + +qt5-ukui-platformtheme (3.13.0-0k0) jammy; urgency=medium + + * 改动: + BUG号:95836,checkbox颜色问题 + 117939,slider的悬停颜色没有变化的问题 + 需求号:77049(list,table,tree,checkbox,radiobutton,slider,progressbar,scroll,tooltip) + 其他改:麒麟影音加入使用暗主题黑名单 + 生物特征去除无法切换黑白主题黑名单 + 影响域:list,table,tree,checkbox,radiobutton,slider,progressbar,scroll,tooltip,麒麟影音,生物特征黑白主题切换 + + -- xibowen Wed, 18 May 2022 11:11:00 +0800 + +qt5-ukui-platformtheme (3.1.4.1~0509-0k0) jammy; urgency=medium * 修改为quilt格式 -- Xie Wei Tue, 10 May 2022 11:54:54 +0800 -qt5-ukui-platformtheme (3.1.4-1~0509) v101; urgency=medium +qt5-ukui-platformtheme (3.1.4-1~0509) jammy; urgency=medium * 改动: BUG号:113049(处理图标加了透明度的问题) @@ -20,7 +101,7 @@ qt5-ukui-platformtheme (3.1.4-1~0509) v101; urgency=medium -- xibowen Mon, 09 May 2022 17:05:00 +0800 -qt5-ukui-platformtheme (3.1.4-1~0427) v101; urgency=medium +qt5-ukui-platformtheme (3.1.4-1~0427) jammy; urgency=medium * 改动: BUG号:无 @@ -30,7 +111,7 @@ qt5-ukui-platformtheme (3.1.4-1~0427) v101; urgency=medium -- xibowen Wed, 27 Apr 2022 18:10:00 +0800 -qt5-ukui-platformtheme (3.1.4-1~0426) v101; urgency=medium +qt5-ukui-platformtheme (3.1.4-1~0426) jammy; urgency=medium * 改动: BUG号:无 @@ -40,7 +121,7 @@ qt5-ukui-platformtheme (3.1.4-1~0426) v101; urgency=medium -- xibowen Tue, 26 Apr 2022 15:10:00 +0800 -qt5-ukui-platformtheme (3.1.4-1~0422.1) v101; urgency=medium +qt5-ukui-platformtheme (3.1.4-1~0422.1) jammy; urgency=medium * 改动: BUG号:无 @@ -50,7 +131,7 @@ qt5-ukui-platformtheme (3.1.4-1~0422.1) v101; urgency=medium -- xibowen Fri, 22 Apr 2022 11:40:00 +0800 -qt5-ukui-platformtheme (3.1.4-1~0422) v101; urgency=medium +qt5-ukui-platformtheme (3.1.4-1~0422) jammy; urgency=medium * 改动: BUG号:无 diff --git a/debian/control b/debian/control index c0eba4e..bc3660d 100644 --- a/debian/control +++ b/debian/control @@ -4,22 +4,22 @@ Priority: optional Maintainer: Kylin Team Uploaders: handsome_feng Build-Depends: debhelper-compat (=12), - libglib2.0-dev, - libgsettings-qt-dev, - libkf5wayland-dev, - libkf5windowsystem-dev, - libqt5x11extras5-dev, - libqt5xdgiconloader-dev, - pkg-config, pkg-kde-tools, + libglib2.0-dev, + libqt5x11extras5-dev, + libkf5windowsystem-dev, + libkf5wayland-dev, + libgsettings-qt-dev, + pkg-config, qt5-qmake, qtbase5-dev, qtbase5-dev-tools, qtbase5-private-dev, qtchooser, - qtdeclarative5-dev, + qttools5-dev-tools, + libqt5xdgiconloader-dev, qtquickcontrols2-5-dev, - qttools5-dev-tools + qtdeclarative5-dev Standards-Version: 4.5.1 Rules-Requires-Root: no Homepage: https://www.ukui.org @@ -29,9 +29,9 @@ Vcs-Browser: https://github.com/ukui/qt5-ukui-platformtheme Package: qt5-ukui-platformtheme Architecture: any Depends: libqt5-ukui-style1, - libqt5xdgiconloader3, - qt5-gesture-extensions, qt5-styles-ukui, + qt5-gesture-extensions, + libqt5xdgiconloader3, ${misc:Depends}, ${shlibs:Depends} Description: Qt5 QPA platform theme of UKUI @@ -45,7 +45,9 @@ Description: Qt5 QPA platform theme of UKUI Package: qt5-styles-ukui Architecture: any -Depends: libqt5-ukui-style1, ${misc:Depends}, ${shlibs:Depends} +Depends: libqt5-ukui-style1, + ${misc:Depends}, + ${shlibs:Depends} Description: QStyle plugins provided by ukui qt5-ukui-platformtheme is official platform theme of UKUI desktop environment. It also provides the common metadatas for ukui-styles @@ -59,8 +61,8 @@ Description: QStyle plugins provided by ukui Package: libqt5-ukui-style1 Architecture: any Depends: libglib2.0-0, - libgsettings-qt1, libqt5widgets5, + libgsettings-qt1, ${misc:Depends}, ${shlibs:Depends} Provides: libqt5-ukui-style diff --git a/debian/libqt5-ukui-style-dev.install b/debian/libqt5-ukui-style-dev.install index 2aa1f89..74013a7 100644 --- a/debian/libqt5-ukui-style-dev.install +++ b/debian/libqt5-ukui-style-dev.install @@ -1,5 +1,5 @@ libqt5-ukui-style/*.h usr/include/qt5-ukui libqt5-ukui-style/*/*.h usr/include/qt5-ukui libqt5-ukui-style/*/*/*.h usr/include/qt5-ukui -usr/lib/*/*.so usr/lib/*/pkgconfig/*.pc +usr/lib/*/*.so diff --git a/libqt5-ukui-style/settings/black-list.h b/libqt5-ukui-style/settings/black-list.h index b8932df..e6ed6e1 100644 --- a/libqt5-ukui-style/settings/black-list.h +++ b/libqt5-ukui-style/settings/black-list.h @@ -64,6 +64,7 @@ static const QStringList useDarkPaletteList() { l<<"ukui-flash-disk"; // l<<"ukui-bluetooth"; l<<"mktip"; + l<<"kylin-video"; return l; } diff --git a/libqt5-ukui-style/settings/org.ukui.style.gschema.xml b/libqt5-ukui-style/settings/org.ukui.style.gschema.xml index ace9075..67a2f69 100644 --- a/libqt5-ukui-style/settings/org.ukui.style.gschema.xml +++ b/libqt5-ukui-style/settings/org.ukui.style.gschema.xml @@ -68,7 +68,7 @@ - "daybreakBlue" + "default" theme color Set theme color for UKUI desktop environment. diff --git a/ukui-styles/proxy-style/blur-helper.cpp b/ukui-styles/proxy-style/blur-helper.cpp index 95f1f5b..9f3da22 100644 --- a/ukui-styles/proxy-style/blur-helper.cpp +++ b/ukui-styles/proxy-style/blur-helper.cpp @@ -272,7 +272,7 @@ void BlurHelper::delayUpdate(QWidget *w, bool updateBlurRegionOnly) break; } QPainterPath path; - path.addRoundedRect(widget->rect().adjusted(+5,+5,-5,-5), 6, 6); + path.addRoundedRect(widget->rect().adjusted(+5,+5,-5,-5), 8, 8); KWindowEffects::enableBlurBehind(widget->winId(), true, path.toFillPolygon().toPolygon()); if (!updateBlurRegionOnly) widget->update(); @@ -281,7 +281,7 @@ void BlurHelper::delayUpdate(QWidget *w, bool updateBlurRegionOnly) if (widget->inherits("QTipLabel")) { QPainterPath path; - path.addRoundedRect(widget->rect().adjusted(+3,+3,-3,-3),4, 4); + path.addRoundedRect(widget->rect().adjusted(+3,+3,-3,-3),6, 6); KWindowEffects::enableBlurBehind(widget->winId(), true, path.toFillPolygon().toPolygon()); if (!updateBlurRegionOnly) widget->update(); diff --git a/ukui-styles/proxy-style/proxy-style-plugin.cpp b/ukui-styles/proxy-style/proxy-style-plugin.cpp index ee4516e..c6a91a2 100644 --- a/ukui-styles/proxy-style/proxy-style-plugin.cpp +++ b/ukui-styles/proxy-style/proxy-style-plugin.cpp @@ -42,7 +42,7 @@ ProxyStylePlugin::ProxyStylePlugin() auto settings = UKUIStyleSettings::globalInstance(); connect(settings, &UKUIStyleSettings::changed, this, [=](const QString &key) { if (key == "styleName" || key == "widgetThemeName") { - if (blackList().contains(qAppName()) || qAppName() == "biometric-manager" || qAppName() == "kylin-software-center.py") + if (blackList().contains(qAppName()) || qAppName() == "kylin-software-center.py") return; //We should not swich a application theme which use internal style. diff --git a/ukui-styles/proxy-style/window-manager.cpp b/ukui-styles/proxy-style/window-manager.cpp index 1990223..7840342 100644 --- a/ukui-styles/proxy-style/window-manager.cpp +++ b/ukui-styles/proxy-style/window-manager.cpp @@ -128,7 +128,7 @@ bool WindowManager::eventFilter(QObject *obj, QEvent *e) * if return false will cause these windows to behave abnormally * \author wangweinan@kylinos.cn */ - if (qAbs(event->pos().x() - m_start_point.x()) < 2 || + if (qAbs(event->pos().x() - m_start_point.x()) < 2 && qAbs(event->pos().y() - m_start_point.y()) < 2) { return true; } diff --git a/ukui-styles/qt5-style-ukui/checkbox-parameters.cpp b/ukui-styles/qt5-style-ukui/checkbox-parameters.cpp new file mode 100644 index 0000000..e871749 --- /dev/null +++ b/ukui-styles/qt5-style-ukui/checkbox-parameters.cpp @@ -0,0 +1,29 @@ +/* + * Qt5-UKUI's Library + * + * Copyright (C) 2020, Tianjin KYLIN Information Technology 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 "checkbox-parameters.h" + +CheckBoxParameters::CheckBoxParameters() +{ + +} diff --git a/ukui-styles/qt5-style-ukui/checkbox-parameters.h b/ukui-styles/qt5-style-ukui/checkbox-parameters.h new file mode 100644 index 0000000..d655900 --- /dev/null +++ b/ukui-styles/qt5-style-ukui/checkbox-parameters.h @@ -0,0 +1,55 @@ +/* + * Qt5-UKUI's Library + * + * Copyright (C) 2020, Tianjin KYLIN Information Technology 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 CHECKBOXPARAMETERS_H +#define CHECKBOXPARAMETERS_H + +#include +#include + +class CheckBoxParameters +{ +public: + CheckBoxParameters(); + +//private: + int radius; + + QBrush checkBoxDefaultBrush; + QBrush checkBoxHoverBrush; + QBrush checkBoxClickBrush; + QBrush checkBoxDisableBrush; + QBrush checkBoxOnDefaultBrush; + QBrush checkBoxOnHoverBrush; + QBrush checkBoxOnClickBrush; + + QPen checkBoxDefaultPen; + QPen checkBoxHoverPen; + QPen checkBoxClickPen; + QPen checkBoxDisablePen; + QPen checkBoxOnDefaultPen; + QPen checkBoxOnHoverPen; + QPen checkBoxOnClickPen; +}; + +#endif // CHECKBOXPARAMETERS_H diff --git a/ukui-styles/qt5-style-ukui/kabstract-style-parameters.cpp b/ukui-styles/qt5-style-ukui/kabstract-style-parameters.cpp index b2daf22..ebc2860 100644 --- a/ukui-styles/qt5-style-ukui/kabstract-style-parameters.cpp +++ b/ukui-styles/qt5-style-ukui/kabstract-style-parameters.cpp @@ -24,12 +24,16 @@ #include #include #include +#include +#include +#include - +#include "ukui-style-settings.h" #include "kabstract-style-parameters.h" #include "black-list.h" extern QColor mixColor(const QColor &c1, const QColor &c2, qreal bias); +extern void qt_blurImage(QImage &blurImage, qreal radius, bool quality, int transposed); KAbstractStyleParameters::KAbstractStyleParameters(QObject *parent, bool isDark) { @@ -128,15 +132,13 @@ QPalette KAbstractStyleParameters::setPalette(QPalette &palette) } -//Default theme +//Default widget theme KDefaultStyleParameters::KDefaultStyleParameters(QObject *parent, bool isDark) : KAbstractStyleParameters(parent, isDark) { radius = 6; ColoseButtonColor = QColor(243, 34, 45); - Menu_Radius = 8; - MenuItem_Radius = 6; initPalette(isDark); } @@ -240,7 +242,7 @@ void KDefaultStyleParameters::initPalette(bool isDark) buttonText_at.setRgb(217, 217, 217); buttonText_iat.setRgb(217, 217, 217); buttonText_dis.setRgb(76, 76, 79); - base_at.setRgb(18, 18, 18); + base_at.setRgb(29, 29, 29); base_iat.setRgb(28, 28, 28); base_dis.setRgb(36, 36, 36); window_at.setRgb(35, 36, 38); @@ -577,8 +579,8 @@ void KDefaultStyleParameters::initLineEditParameters(bool isDark, const QStyleOp lineEditParameters.lineEditDefaultBrush = defaultBrush; - lineEditParameters.lineEditHoverBrush = hoverBrush;; - lineEditParameters.lineEditFocusBrush = focusBrush;; + lineEditParameters.lineEditHoverBrush = hoverBrush; + lineEditParameters.lineEditFocusBrush = focusBrush; lineEditParameters.lineEditDisableBrush = disableBrush; lineEditParameters.lineEditDefaultPen = defaultPen; @@ -620,8 +622,8 @@ void KDefaultStyleParameters::initSpinBoxParameters(bool isDark, const QStyleOpt spinBoxParameters.spinBoxDefaultBrush = defaultBrush; - spinBoxParameters.spinBoxHoverBrush = hoverBrush;; - spinBoxParameters.spinBoxFocusBrush = focusBrush;; + spinBoxParameters.spinBoxHoverBrush = hoverBrush; + spinBoxParameters.spinBoxFocusBrush = focusBrush; spinBoxParameters.spinBoxDisableBrush = disableBrush; spinBoxParameters.spinBoxDefaultPen = defaultPen; @@ -681,7 +683,7 @@ void KDefaultStyleParameters::initComboBoxParameters(bool isDark, const QStyleOp comboBoxParameters.comboBoxDefaultBrush = defaultBrush; comboBoxParameters.comboBoxHoverBrush = hoverBrush; - comboBoxParameters.comboBoxOnBrush = onBrush;; + comboBoxParameters.comboBoxOnBrush = onBrush; comboBoxParameters.comboBoxEditBrush = editBrush; comboBoxParameters.comboBoxDisableBrush = disableBrush; @@ -692,17 +694,658 @@ void KDefaultStyleParameters::initComboBoxParameters(bool isDark, const QStyleOp comboBoxParameters.comboBoxDisablePen = disablePen; } -QColor KDefaultStyleParameters::radiobutton_default(bool isDark) +void KDefaultStyleParameters::initListParameters(bool isDark, const QStyleOption *option, const QWidget *widget) { + listParameters.radius = 6; + + QBrush defaultBrush; + QBrush hoverBrush; + QBrush selectBrush; + QBrush disableBrush; + + + //default + defaultBrush = QBrush(Qt::transparent); + + //hover + hoverBrush = option->palette.brush(QPalette::Disabled, QPalette::Midlight); + + //select + selectBrush = option->palette.brush(QPalette::Active, QPalette::Highlight); + + //disable + disableBrush = QBrush(Qt::transparent); + + + listParameters.listDefaultBrush = defaultBrush; + listParameters.listHoverBrush = hoverBrush; + listParameters.listSelectBrush = selectBrush; + listParameters.listDisableBrush = disableBrush; +} + +void KDefaultStyleParameters::initTreeParameters(bool isDark, const QStyleOption *option, const QWidget *widget) +{ + treeParameters.radius = 6; + + QBrush defaultBrush; + QBrush hoverBrush; + QBrush selectBrush; + QBrush disableBrush; + + QBrush branchDefaultBrush; + QBrush branchHoverBrush; + QBrush branchSelectBrush; + QBrush branchDisableBrush; + + + //default + defaultBrush = QBrush(Qt::transparent); + branchDefaultBrush = defaultBrush; + + //hover + hoverBrush = option->palette.brush(QPalette::Disabled, QPalette::Midlight); + branchHoverBrush = hoverBrush; + + //select + selectBrush = option->palette.brush(QPalette::Active, QPalette::Highlight); + branchSelectBrush = selectBrush; + + //disable + disableBrush = QBrush(Qt::transparent); + branchDisableBrush = disableBrush; + + + treeParameters.treeDefaultBrush = defaultBrush; + treeParameters.treeHoverBrush = hoverBrush; + treeParameters.treeSelectBrush = selectBrush; + treeParameters.treeDisableBrush = disableBrush; + + treeParameters.treeBranchDefaultBrush = branchDefaultBrush; + treeParameters.treeBranchHoverBrush = branchHoverBrush; + treeParameters.treeBranchSelectBrush = branchSelectBrush; + treeParameters.treeBranchDisableBrush = branchDisableBrush; +} + +void KDefaultStyleParameters::initTableParameters(bool isDark, const QStyleOption *option, const QWidget *widget) +{ + tableParameters.radius = 6; + + QBrush defaultBrush; + QBrush hoverBrush; + QBrush selectBrush; + QBrush disableBrush; + + + //default + defaultBrush = QBrush(Qt::transparent); + + //hover + hoverBrush = option->palette.brush(QPalette::Disabled, QPalette::Midlight); + + //select + selectBrush = option->palette.brush(QPalette::Active, QPalette::Highlight); + + //disable + disableBrush = QBrush(Qt::transparent); + + + tableParameters.tableDefaultBrush = defaultBrush; + tableParameters.tableHoverBrush = hoverBrush; + tableParameters.tableSelectBrush = selectBrush; + tableParameters.tableDisableBrush = disableBrush; +} + +void KDefaultStyleParameters::initCheckBoxParameters(bool isDark, const QStyleOption *option, const QWidget *widget) +{ + checkBoxParameters.radius = 4; + + QPen defaultPen; + QPen hoverPen; + QPen clickPen; + QPen disablePen; + QPen onDefaultPen; + QPen onHoverPen; + QPen onClickPen; + + QBrush defaultBrush; + QBrush hoverBrush; + QBrush clickBrush; + QBrush disableBrush; + QBrush onDefaultBrush; + QBrush onHoverBrush; + QBrush onClickBrush; + + QColor mix = option->palette.color(QPalette::Active, QPalette::BrightText); + + //default if (isDark) { - return QColor(77, 77, 77); + defaultPen = QPen(option->palette.brush(QPalette::Disabled, QPalette::Mid), + 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin); } else { - return QColor(166, 166, 166); + defaultPen = QPen(option->palette.brush(QPalette::Disabled, QPalette::HighlightedText), + 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin); } + defaultBrush = QBrush(option->palette.color(QPalette::Active, QPalette::Base).lighter(200)); + + //hover + hoverPen = defaultPen; + if (isDark) { + hoverBrush = QBrush(mixColor(defaultBrush.color(), mix, 0.15)); + } else { + hoverBrush = QBrush(mixColor(defaultBrush.color(), mix, 0.05)); + } + + //click + clickPen = defaultPen; + if (isDark) { + clickBrush = QBrush(mixColor(defaultBrush.color(), mix, 0.1)); + } else { + clickBrush = QBrush(mixColor(defaultBrush.color(), mix, 0.15)); + } + + + //disable + disablePen = defaultPen; + disableBrush = option->palette.brush(QPalette::Disabled, QPalette::NoRole); + + //on default + onDefaultPen = QPen(Qt::NoPen); + onDefaultBrush = option->palette.brush(QPalette::Active, QPalette::Highlight); + + //on hover + onHoverPen = QPen(Qt::NoPen); + if (isDark) { + onHoverBrush = QBrush(mixColor(onDefaultBrush.color(), mix, 0.2)); + } else { + onHoverBrush = QBrush(mixColor(onDefaultBrush.color(), mix, 0.05)); + } + + //on click + onClickPen = QPen(Qt::NoPen); + if (isDark) { + onClickBrush = QBrush(mixColor(onDefaultBrush.color(), mix, 0.05)); + } else { + onClickBrush = QBrush(mixColor(onDefaultBrush.color(), mix, 0.2)); + } + + checkBoxParameters.checkBoxDefaultPen = defaultPen; + checkBoxParameters.checkBoxHoverPen = hoverPen; + checkBoxParameters.checkBoxClickPen = clickPen; + checkBoxParameters.checkBoxDisablePen = disablePen; + checkBoxParameters.checkBoxOnDefaultPen = onDefaultPen; + checkBoxParameters.checkBoxOnHoverPen = onHoverPen; + checkBoxParameters.checkBoxOnClickPen = onClickPen; + + checkBoxParameters.checkBoxDefaultBrush = defaultBrush; + checkBoxParameters.checkBoxHoverBrush = hoverBrush; + checkBoxParameters.checkBoxClickBrush = clickBrush; + checkBoxParameters.checkBoxDisableBrush = disableBrush; + checkBoxParameters.checkBoxOnDefaultBrush = onDefaultBrush; + checkBoxParameters.checkBoxOnHoverBrush = onHoverBrush; + checkBoxParameters.checkBoxOnClickBrush = onClickBrush; +} + +void KDefaultStyleParameters::initRadioButtonParameters(bool isDark, const QStyleOption *option, const QWidget *widget) +{ + radioButtonParameters.radius = 6; + + QPen defaultPen; + QPen hoverPen; + QPen clickPen; + QPen disablePen; + QPen onDefaultPen; + QPen onHoverPen; + QPen onClickPen; + + QBrush defaultBrush; + QBrush hoverBrush; + QBrush clickBrush; + QBrush disableBrush; + QBrush onDefaultBrush; + QBrush onHoverBrush; + QBrush onClickBrush; + + QColor mix = option->palette.color(QPalette::Active, QPalette::BrightText); + + //default + if (isDark) { + defaultPen = QPen(option->palette.brush(QPalette::Disabled, QPalette::Mid), + 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin); + } else { + defaultPen = QPen(option->palette.brush(QPalette::Disabled, QPalette::HighlightedText), + 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin); + } + defaultBrush = QBrush(option->palette.color(QPalette::Active, QPalette::Base).lighter(200)); + + //hover + hoverPen = defaultPen; + if (isDark) { + hoverBrush = QBrush(mixColor(defaultBrush.color(), mix, 0.15)); + } else { + hoverBrush = QBrush(mixColor(defaultBrush.color(), mix, 0.05)); + } + + //click + clickPen = defaultPen; + if (isDark) { + clickBrush = QBrush(mixColor(defaultBrush.color(), mix, 0.1)); + } else { + clickBrush = QBrush(mixColor(defaultBrush.color(), mix, 0.15)); + } + + //disable + disablePen = defaultPen; + disableBrush = option->palette.brush(QPalette::Disabled, QPalette::NoRole); + + //on default + onDefaultPen = QPen(Qt::NoPen); + onDefaultBrush = option->palette.brush(QPalette::Active, QPalette::Highlight); + + //on hover + onHoverPen = QPen(Qt::NoPen); + if (isDark) { + onHoverBrush = QBrush(mixColor(onDefaultBrush.color(), mix, 0.2)); + } else { + onHoverBrush = QBrush(mixColor(onDefaultBrush.color(), mix, 0.05)); + } + + //on click + onClickPen = QPen(Qt::NoPen); + if (isDark) { + onClickBrush = QBrush(mixColor(onDefaultBrush.color(), mix, 0.05)); + } else { + onClickBrush = QBrush(mixColor(onDefaultBrush.color(), mix, 0.2)); + } + + + //if set property + if (widget) { + if (widget->property("setDefaultPen").isValid() && widget->property("setDefaultPen").canConvert()) { + defaultPen = widget->property("setDefaultPen").value(); + } + if (widget->property("setHoverPen").isValid() && widget->property("setHoverPen").canConvert()) { + hoverPen = widget->property("setHoverPen").value(); + } + if (widget->property("setClickPen").isValid() && widget->property("setClickPen").canConvert()) { + clickPen = widget->property("setClickPen").value(); + } + if (widget->property("setDisablePen").isValid() && widget->property("setDisablePen").canConvert()) { + disablePen = widget->property("setDisablePen").value(); + } + if (widget->property("setOnDefaultPen").isValid() && widget->property("setOnDefaultPen").canConvert()) { + onDefaultPen = widget->property("setOnDefaultPen").value(); + } + if (widget->property("setOnHoverPen").isValid() && widget->property("setOnHoverPen").canConvert()) { + onHoverPen = widget->property("setOnHoverPen").value(); + } + if (widget->property("setOnClickPen").isValid() && widget->property("setOnClickPen").canConvert()) { + onClickPen = widget->property("setOnClickPen").value(); + } + if (widget->property("setDefaultBrush").isValid() && widget->property("setDefaultBrush").canConvert()) { + defaultBrush = widget->property("setDefaultBrush").value(); + } + if (widget->property("setHoverBrush").isValid() && widget->property("setHoverBrush").canConvert()) { + hoverBrush = widget->property("setHoverBrush").value(); + } + if (widget->property("setClickBrush").isValid() && widget->property("setClickBrush").canConvert()) { + clickBrush = widget->property("setClickBrush").value(); + } + if (widget->property("setDisableBrush").isValid() && widget->property("setDisableBrush").canConvert()) { + disableBrush = widget->property("setDisableBrush").value(); + } + if (widget->property("setOnDefaultBrush").isValid() && widget->property("setOnDefaultBrush").canConvert()) { + onDefaultBrush = widget->property("setOnDefaultBrush").value(); + } + if (widget->property("setOnHoverBrush").isValid() && widget->property("setOnHoverBrush").canConvert()) { + onHoverBrush = widget->property("setOnHoverBrush").value(); + } + if (widget->property("setOnClickBrush").isValid() && widget->property("setOnClickBrush").canConvert()) { + onClickBrush = widget->property("setOnClickBrush").value(); + } + } + + + radioButtonParameters.radioButtonDefaultPen = defaultPen; + radioButtonParameters.radioButtonHoverPen = hoverPen; + radioButtonParameters.radioButtonClickPen = clickPen; + radioButtonParameters.radioButtonDisablePen = disablePen; + radioButtonParameters.radioButtonOnDefaultPen = onDefaultPen; + radioButtonParameters.radioButtonOnHoverPen = onHoverPen; + radioButtonParameters.radioButtonOnClickPen = onClickPen; + + radioButtonParameters.radioButtonDefaultBrush = defaultBrush; + radioButtonParameters.radioButtonHoverBrush = hoverBrush; + radioButtonParameters.radioButtonClickBrush = clickBrush; + radioButtonParameters.radioButtonDisableBrush = disableBrush; + radioButtonParameters.radioButtonOnDefaultBrush = onDefaultBrush; + radioButtonParameters.radioButtonOnHoverBrush = onHoverBrush; + radioButtonParameters.radioButtonOnClickBrush = onClickBrush; +} + +void KDefaultStyleParameters::initSliderParameters(bool isDark, const QStyleOption *option, const QWidget *widget) +{ + QBrush handleDefaultBrush; + QBrush handleHoverBrush; + QBrush handleClickBrush; + QBrush handleDisableBrush; + + QBrush grooveValueDefaultBrush; + QBrush grooveValueHoverBrush; + QBrush grooveValueDisableBrush; + QBrush grooveUnvalueDefaultBrush; + QBrush grooveUnvalueHoverBrush; + QBrush grooveUnvalueDisableBrush; + + QColor highlight = option->palette.color(QPalette::Active, QPalette::Highlight); + QColor mix = option->palette.color(QPalette::Active, QPalette::BrightText); + + //handle default + handleDefaultBrush = option->palette.color(QPalette::Active, QPalette::Highlight); + + //handle hover + if (isDark) { + handleHoverBrush = QBrush(mixColor(highlight, mix, 0.2)); + } else { + handleHoverBrush = QBrush(mixColor(highlight, mix, 0.05)); + } + + //handle click + if (isDark) { + handleClickBrush = QBrush(mixColor(highlight, mix, 0.05)); + } else { + handleClickBrush = QBrush(mixColor(highlight, mix, 0.2)); + } + + //handle disable + handleDisableBrush = option->palette.color(QPalette::Disabled, QPalette::ButtonText); + + //groove value default + grooveValueDefaultBrush = handleHoverBrush; + + //groove value hover + grooveValueHoverBrush = handleClickBrush; + + //groove value disable + grooveValueDisableBrush = handleDisableBrush; + + //groove unvalue default + grooveUnvalueDefaultBrush = option->palette.color(QPalette::Active, QPalette::Button); + + //groove unvalue hover + grooveUnvalueHoverBrush = grooveUnvalueDefaultBrush; + + //groove unvalue disable + grooveUnvalueDisableBrush = grooveUnvalueDefaultBrush; + + + sliderParameters.sliderHandleDefaultBrush = handleDefaultBrush; + sliderParameters.sliderHandleHoverBrush = handleHoverBrush; + sliderParameters.sliderHandleClickBrush = handleClickBrush; + sliderParameters.sliderHandleDisableBrush = handleDisableBrush; + + sliderParameters.sliderGrooveValueDefaultBrush = grooveValueDefaultBrush; + sliderParameters.sliderGrooveValueHoverBrush = grooveValueHoverBrush; + sliderParameters.sliderGrooveValueDisableBrush = grooveValueDisableBrush; + + sliderParameters.sliderGrooveUnvalueDefaultBrush = grooveUnvalueDefaultBrush; + sliderParameters.sliderGrooveUnvalueHoverBrush = grooveUnvalueHoverBrush; + sliderParameters.sliderGrooveUnvalueDisableBrush = grooveUnvalueDisableBrush; +} + +void KDefaultStyleParameters::initProgressBarParameters(bool isDark, const QStyleOption *option, const QWidget *widget) +{ + QBrush contentBrush; + QBrush grooveDefaultBrush; + QBrush grooveDisableBrush; + + const QStyleOptionProgressBar *pb = qstyleoption_cast(option); + const bool vertical = pb->orientation == Qt::Vertical; + const bool inverted = pb->invertedAppearance; + + bool reverse = (!vertical && (pb->direction == Qt::RightToLeft)) || vertical; + if (inverted) + reverse = !reverse; + + //content + QColor startColor = option->palette.color(QPalette::Active, QPalette::Highlight); + QColor endColor = option->palette.color(QPalette::Active, QPalette::Highlight).lighter(120); + QLinearGradient linearGradient; + linearGradient.setColorAt(0, startColor); + linearGradient.setColorAt(1, endColor); + if (vertical) { + if (reverse) { + linearGradient.setStart(pb->rect.bottomLeft()); + linearGradient.setFinalStop(pb->rect.topLeft()); + } else { + linearGradient.setStart(pb->rect.topLeft()); + linearGradient.setFinalStop(pb->rect.bottomLeft()); + } + } else { + if (reverse) { + linearGradient.setStart(pb->rect.topRight()); + linearGradient.setFinalStop(pb->rect.topLeft()); + } else { + linearGradient.setStart(pb->rect.topLeft()); + linearGradient.setFinalStop(pb->rect.topRight()); + } + } + contentBrush = QBrush(linearGradient); + + //groove default + grooveDefaultBrush = pb->palette.brush(QPalette::Active, QPalette::Button); + + //groove disable + grooveDisableBrush = pb->palette.brush(QPalette::Disabled, QPalette::Button); + + + progressBarParameters.radius = 6; + progressBarParameters.progressBarContentBrush = contentBrush; + progressBarParameters.progressBarGrooveDefaultBrush = grooveDefaultBrush; + progressBarParameters.progressBarGrooveDisableBrush = grooveDisableBrush; +} + +void KDefaultStyleParameters::initScrollBarParameters(bool isDark, const QStyleOption *option, const QWidget *widget) +{ + int sliderRadius; + QBrush grooveDefaultBrush; + QBrush grooveInactiveBrush; + QBrush sliderDefaultBrush; + QBrush sliderHoverBrush; + QBrush sliderClickBrush; + QBrush sliderDisableBrush; + + QColor mix = option->palette.color(QPalette::Active, QPalette::BrightText); + const QStyleOptionSlider *bar = qstyleoption_cast(option); + + //radius + if (bar->orientation == Qt::Horizontal) { + sliderRadius = (bar->rect.height()) / 4; + } else { + sliderRadius = (bar->rect.width()) / 4; + } + + //groove default + grooveDefaultBrush = option->palette.brush(QPalette::Active, QPalette::Base); + + //groove inactive + grooveInactiveBrush = option->palette.brush(QPalette::Inactive, QPalette::Base); + + //slider default + sliderDefaultBrush = option->palette.brush(QPalette::Active, QPalette::Button); + + //slider hover + if (isDark) { + sliderHoverBrush = QBrush(mixColor(sliderDefaultBrush.color(), mix, 0.2)); + } else { + sliderHoverBrush = QBrush(mixColor(sliderDefaultBrush.color(), mix, 0.05)); + } + + //slider click + if (isDark) { + sliderClickBrush = QBrush(mixColor(sliderDefaultBrush.color(), mix, 0.05)); + } else { + sliderClickBrush = QBrush(mixColor(sliderDefaultBrush.color(), mix, 0.2)); + } + + //slider disable + sliderDisableBrush = option->palette.brush(QPalette::Disabled, QPalette::Button); + + + scrollBarParameters.radius = sliderRadius; + scrollBarParameters.scrollBarGrooveDefaultBrush = grooveDefaultBrush; + scrollBarParameters.scrollBarGrooveInactiveBrush = grooveInactiveBrush; + scrollBarParameters.scrollBarSliderDefaultBrush = sliderDefaultBrush; + scrollBarParameters.scrollBarSliderHoverBrush = sliderHoverBrush; + scrollBarParameters.scrollBarSliderClickBrush = sliderClickBrush; + scrollBarParameters.scrollBarSliderDisableBrush = sliderDisableBrush; +} + +void KDefaultStyleParameters::initToolTipParameters(bool isDark, const QStyleOption *option, const QWidget *widget) +{ + QBrush backgroundBrush; + + //background + backgroundBrush = option->palette.color(QPalette::Active, QPalette::ToolTipBase); + + + toolTipParameters.radius = 6; + toolTipParameters.toolTipBackgroundBrush = backgroundBrush; +} + +void KDefaultStyleParameters::initTabWidgetParameters(bool isDark, const QStyleOption *option, const QWidget *widget) +{ + int tabradius = 6; + QBrush widgetBackgroundBrush; + QBrush tabBarBackgroundBrush; + QBrush tabBarDefaultBrush; + QBrush tabBarHoverBrush; + QBrush tabBarSelectBrush; + + //tab widget background + widgetBackgroundBrush = option->palette.brush(QPalette::Active, QPalette::Base); + + //tabbar background + tabBarBackgroundBrush = option->palette.brush(QPalette::Active, QPalette::Window); + + //tabbar default + tabBarDefaultBrush = option->palette.brush(QPalette::Active, QPalette::Window); + + //tabbar hover + QColor hover_color = option->palette.color(QPalette::Active, QPalette::Window); + QColor mix = option->palette.color(QPalette::Active, QPalette::BrightText); + tabBarHoverBrush = QBrush(mixColor(hover_color, mix, 0.1)); + + //tabbar select + tabBarSelectBrush = option->palette.brush(QPalette::Active, QPalette::Base); + + + if (widget && widget->property("setRadius").isValid() && widget->property("setRadius").canConvert()) { + tabradius = widget->property("setRadius").value(); + } + + + tabWidgetParameters.radius = tabradius; + tabWidgetParameters.tabWidgetBackgroundBrush = widgetBackgroundBrush; + tabWidgetParameters.tabBarBackgroundBrush = tabBarBackgroundBrush; + tabWidgetParameters.tabBarDefaultBrush = tabBarDefaultBrush; + tabWidgetParameters.tabBarHoverBrush = tabBarHoverBrush; + tabWidgetParameters.tabBarSelectBrush = tabBarSelectBrush; +} + +void KDefaultStyleParameters::initMenuParameters(bool isDark, const QStyleOption *option, const QWidget *widget) +{ + + int frameradius = 8; + int itemradius = 6; + QPixmap framePixmap(option->rect.size()); + QBrush itemSelectBrush; + + + //frame Pixmap + framePixmap.fill(Qt::transparent); + if (qobject_cast(widget)) { + QPainter pixmapPainter(&framePixmap); + pixmapPainter.setPen(Qt::NoPen); + pixmapPainter.setBrush(option->palette.color(QPalette::Active, QPalette::Base).lighter(300)); + pixmapPainter.setRenderHint(QPainter::Antialiasing, true); + pixmapPainter.drawRoundedRect(option->rect, frameradius, frameradius); + } else { + int rander = 5; + + // Draw a black floor + QPainter pixmapPainter(&framePixmap); + pixmapPainter.setRenderHint(QPainter::Antialiasing, true); + pixmapPainter.setPen(Qt::transparent); + pixmapPainter.setBrush(option->palette.color(QPalette::Active, QPalette::BrightText)); + pixmapPainter.drawRoundedRect(option->rect.adjusted(+rander, +rander, -rander, -rander), frameradius, frameradius); + pixmapPainter.end(); + + // Blur the black background + QImage img = framePixmap.toImage(); + qt_blurImage(img, 4, false, false); + + // Dig out the center part, Shadow rendering + framePixmap = QPixmap::fromImage(img); + QPainter pixmapPainter2(&framePixmap); + pixmapPainter2.setRenderHint(QPainter::Antialiasing); + pixmapPainter2.setCompositionMode(QPainter::CompositionMode_Clear); + pixmapPainter2.setPen(Qt::transparent); + pixmapPainter2.setBrush(Qt::transparent); + pixmapPainter2.drawRoundedRect(option->rect.adjusted(+rander, +rander, -rander, -rander), frameradius, frameradius); + pixmapPainter2.end(); + + //That's when I started drawing the frame floor + auto color = option->palette.color(QPalette::Base); + if (UKUIStyleSettings::isSchemaInstalled("org.ukui.style")) { + auto opacity = UKUIStyleSettings::globalInstance()->get("menuTransparency").toInt()/100.0; + color.setAlphaF(opacity); + } + if (qApp->property("blurEnable").isValid()) { + bool blurEnable = qApp->property("blurEnable").toBool(); + if (!blurEnable) { + color.setAlphaF(1); + } + } + if (widget) { + if (widget->property("useSystemStyleBlur").isValid() && !widget->property("useSystemStyleBlur").toBool()) { + color.setAlphaF(1); + } + } + //if blur effect is not supported, do not use transparent color. + if (!KWindowEffects::isEffectAvailable(KWindowEffects::BlurBehind) || blackAppListWithBlurHelper().contains(qAppName())) { + color.setAlphaF(1); + } + + QPainterPath path; + QRegion region; + if (widget) { + region = widget->mask(); + } + if (region.isEmpty()) { + path.addRoundedRect(option->rect.adjusted(+rander, +rander, -rander,-rander), frameradius, frameradius); + } else { + path.addRegion(region); + } + + //draw blur background + QPainter pixmapPainter3(&framePixmap); + pixmapPainter3.setRenderHint(QPainter::Antialiasing); + pixmapPainter3.setPen(Qt::transparent); + pixmapPainter3.setBrush(color); + pixmapPainter3.drawPath(path); + } + + //item select brush + itemSelectBrush = QBrush(option->palette.brush(QPalette::Active, QPalette::Highlight)); + + menuParameters.frameRadius = frameradius; + menuParameters.itemRadius = itemradius; + menuParameters.menuFramePixmap = framePixmap; + menuParameters.menuItemSelectBrush = itemSelectBrush; } -//Classical theme +//Classical widget theme KClassicalStyleParameters::KClassicalStyleParameters(QObject *parent, bool isDark) : KAbstractStyleParameters(parent, isDark) { radius = 0; @@ -913,142 +1556,210 @@ void KClassicalStyleParameters::initComboBoxParameters(bool isDark, const QStyle } -QColor KClassicalStyleParameters::radiobutton_default(bool isDark) +void KClassicalStyleParameters::initListParameters(bool isDark, const QStyleOption *option, const QWidget *widget) { - if (isDark) { - return QColor(77, 77, 77); - } else { - return QColor(166, 166, 166); - } + +} + +void KClassicalStyleParameters::initTreeParameters(bool isDark, const QStyleOption *option, const QWidget *widget) +{ + +} + +void KClassicalStyleParameters::initTableParameters(bool isDark, const QStyleOption *option, const QWidget *widget) +{ + +} + +void KClassicalStyleParameters::initCheckBoxParameters(bool isDark, const QStyleOption *option, const QWidget *widget) +{ + +} + +void KClassicalStyleParameters::initRadioButtonParameters(bool isDark, const QStyleOption *option, const QWidget *widget) +{ + +} + +void KClassicalStyleParameters::initSliderParameters(bool isDark, const QStyleOption *option, const QWidget *widget) +{ + +} + +void KClassicalStyleParameters::initProgressBarParameters(bool isDark, const QStyleOption *option, const QWidget *widget) +{ + +} + +void KClassicalStyleParameters::initScrollBarParameters(bool isDark, const QStyleOption *option, const QWidget *widget) +{ + +} + +void KClassicalStyleParameters::initToolTipParameters(bool isDark, const QStyleOption *option, const QWidget *widget) +{ + +} + +void KClassicalStyleParameters::initTabWidgetParameters(bool isDark, const QStyleOption *option, const QWidget *widget) +{ + +} + +void KClassicalStyleParameters::initMenuParameters(bool isDark, const QStyleOption *option, const QWidget *widget) +{ + } +//fashion widget theme KFashionStyleParameters::KFashionStyleParameters(QObject *parent, bool isDark) : KAbstractStyleParameters(parent, isDark) { - radius = 0; + radius = 6; ColoseButtonColor = QColor("#F86458"); - Menu_Radius = 0; - MenuItem_Radius = 0; - initPalette(isDark); } void KFashionStyleParameters::initPalette(bool isDark) { - - QColor windowText_at(5, 9, 19), - windowText_iat(5, 9, 19), - windowText_dis(169, 173, 183), - button_at(204, 208, 218), - button_iat(204, 208, 218), - button_dis(219, 223, 233), - light_at(239, 243, 253), - light_iat(239, 243, 253), - light_dis(239, 243, 253), - midlight_at(190, 194, 204), - midlight_iat(190, 194, 204), - midlight_dis(190, 194, 204), - dark_at(151, 155, 165), - dark_iat(151, 155, 165), - dark_dis(179, 184, 193), - mid_at(174, 178, 188), - mid_iat(174, 178, 188), - mid_dis(174, 178, 188), - text_at(5, 9, 20), - text_iat(5, 9, 20), - text_dis(169, 173, 183), + //ukui-light palette UKUI3.1 + QColor windowText_at(38, 38, 38), + windowText_iat(0, 0, 0, 255 * 0.55), + windowText_dis(0, 0, 0, 255 * 0.3), + button_at(230, 230, 230), + button_iat(230, 230, 230), + button_dis(233, 233, 233), + light_at(255, 255, 255), + light_iat(255, 255, 255), + light_dis(242, 242, 242), + midlight_at(218, 218, 218), + midlight_iat(218, 218, 218), + midlight_dis(230, 230, 230), + dark_at(77, 77, 77), + dark_iat(77, 77, 77), + dark_dis(64, 64, 64), + mid_at(115, 115, 115), + mid_iat(115, 115, 115), + mid_dis(102, 102, 102), + text_at(38, 38, 38), + text_iat(38, 38, 38), + text_dis(0, 0, 0, 255 * 0.3), brightText_at(0, 0, 0), brightText_iat(0, 0, 0), brightText_dis(0, 0, 0), - buttonText_at(5, 9, 20), - buttonText_iat(5, 9, 20), - buttonText_dis(169, 173, 183), - base_at(238, 242, 253), - base_iat(238, 242, 253), - base_dis(232, 236, 246), - window_at(216, 220, 231), - window_iat(218, 222, 233), - window_dis(218, 222, 233), - shadow_at(214, 214, 214), - shadow_iat(214, 214, 214), - shadow_dis(201, 201, 201), - highLight_at(61, 107, 229), - highLight_iat(61, 107, 229), - hightight_dis(239, 242, 253), - highLightText_at(239, 242, 253), - highLightText_iat(239, 242, 253), - highLightText_dis(239, 242, 253), - link_at(5, 9, 253), - link_iat(5, 9, 253), - link_dis(5, 9, 253), - linkVisited_at(239, 9, 253), - linkVisited_iat(239, 9, 253), - linkVisited_dis(239, 9, 253), - alternateBase_at(232, 236, 246), - alternateBase_iat(232, 236, 246), - alternateBase_dis(218, 222, 233), - noRale_at(239, 242, 253), - noRole_iat(239, 242, 253), - noRole_dis(239, 242, 253), - toolTipBase(232, 236, 246), - toolTipText(25, 29, 40), - placeholderText(169, 173, 183); + buttonText_at(38, 38, 38), + buttonText_iat(38, 38, 38), + buttonText_dis(179, 179, 179), + base_at(255, 255, 255), + base_iat(245, 245, 245), + base_dis(237, 237, 237), + window_at(245, 245, 245), + window_iat(237, 237, 237), + window_dis(230, 230, 230), + shadow_at(0, 0, 0, 255 * 0.16), + shadow_iat(0, 0, 0, 255 * 0.16), + shadow_dis(0, 0, 0, 255 * 0.21), +// shadow_at(214, 214, 214), +// shadow_iat(214, 214, 214), +// shadow_dis(201, 201, 201), + highLight_at(55, 144, 250), + highLight_iat(55, 144, 250), + highLight_dis(233, 233, 233), + highLightText_at(255, 255, 255), + highLightText_iat(255, 255, 255), + highLightText_dis(179, 179, 179), + link_at(55, 144, 250), + link_iat(55, 144, 250), + link_dis(55, 144, 250), + linkVisited_at(114, 46, 209), + linkVisited_iat(114, 46, 209), + linkVisited_dis(114, 46, 209), + alternateBase_at(245, 245, 245), + alternateBase_iat(245, 245, 245), + alternateBase_dis(245, 245, 245), + noRale_at(240, 240, 240), + noRole_iat(240, 240, 240), + noRole_dis(217, 217, 217), + toolTipBase_at(255, 255, 255), + toolTipBase_iat(255, 255, 255), + toolTipBase_dis(255, 255, 255), + toolTipText_at(38, 38, 38), + toolTipText_iat(38, 38, 38), + toolTipText_dis(38, 38, 38), + placeholderText_at(0, 0, 0, 255 * 0.35), + placeholderText_iat(0, 0, 0, 255 * 0.35), + placeholderText_dis(0, 0, 0, 255 * 0.3); + //ukui-dark if (isDark) { - windowText_at.setRgb(216, 221, 233); - windowText_iat.setRgb(216, 221, 233); - windowText_dis.setRgb(77, 77, 77); - button_at.setRgb(61, 65, 81); - button_iat.setRgb(61, 65, 81); - button_dis.setRgb(46, 50, 64); - light_at.setRgb(236, 241, 252); - light_iat.setRgb(236, 241, 252); - light_dis.setRgb(236, 241, 252); - midlight_at.setRgb(188, 193, 206); - midlight_iat.setRgb(188, 193, 206); - midlight_dis.setRgb(188, 193, 206); - dark_at.setRgb(149, 154, 166); - dark_iat.setRgb(149, 154, 166); - dark_dis.setRgb(132, 138, 152); - mid_at.setRgb(172, 176, 188); - mid_iat.setRgb(172, 176, 188); - mid_dis.setRgb(172, 176, 188); - text_at.setRgb(219, 222, 233); - text_iat.setRgb(219, 222, 233); - text_dis.setRgb(77, 77, 77); + windowText_at.setRgb(217, 217, 217); + windowText_iat.setRgb(255, 255, 255, 255 * 0.55); + windowText_dis.setRgb(255, 255, 255, 255 * 0.3); + button_at.setRgb(55, 55, 59); + button_iat.setRgb(55, 55, 59); + button_dis.setRgb(46, 46, 48); + light_at.setRgb(255, 255, 255), + light_iat.setRgb(255, 255, 255), + light_dis.setRgb(242, 242, 242), + midlight_at.setRgb(95, 95, 98); + midlight_iat.setRgb(95, 95, 98); + midlight_dis.setRgb(79, 79, 82); + dark_at.setRgb(38, 38, 38); + dark_iat.setRgb(38, 38, 38); + dark_dis.setRgb(26, 26, 26); + mid_at.setRgb(115, 115, 115); + mid_iat.setRgb(115, 115, 115); + mid_dis.setRgb(102, 102, 102); + text_at.setRgb(217, 217, 217); + text_iat.setRgb(217, 217, 217); + text_dis.setRgb(255, 255, 255, 255 * 0.3); brightText_at.setRgb(255, 255, 255); brightText_iat.setRgb(255, 255, 255); brightText_dis.setRgb(255, 255, 255); - buttonText_at.setRgb(219, 222, 233); - buttonText_iat.setRgb(219, 222, 233); + buttonText_at.setRgb(217, 217, 217); + buttonText_iat.setRgb(217, 217, 217); buttonText_dis.setRgb(76, 76, 79); - base_at.setRgb(33, 38, 51); - base_iat.setRgb(33, 38, 51); - base_dis.setRgb(40, 46, 62); - window_at.setRgb(46, 51, 65); - window_iat.setRgb(46, 51, 65); - window_dis.setRgb(46, 51, 65); - hightight_dis.setRgb(46, 46, 48); - highLightText_at.setRgb(216, 220, 233); - highLightText_iat.setRgb(216, 220, 233); - highLightText_dis.setRgb(216, 220, 233); - link_at.setRgb(29, 19, 252); - link_iat.setRgb(29, 19, 252); - link_dis.setRgb(29, 19, 252); - linkVisited_at.setRgb(236, 15, 252); - linkVisited_iat.setRgb(236, 15, 252); - linkVisited_dis.setRgb(236, 15, 252); - alternateBase_at.setRgb(37, 42, 59); - alternateBase_iat.setRgb(37, 42, 59); - alternateBase_dis.setRgb(47, 53, 74); - noRale_at.setRgb(34, 39, 54); - noRole_iat.setRgb(34, 39, 54); - noRole_dis.setRgb(34, 39, 54); - toolTipBase.setRgb(61, 66, 83); - toolTipText.setRgb(215, 219, 232); - placeholderText.setRgb(95, 100, 114); + base_at.setRgb(29, 29, 29); + base_iat.setRgb(28, 28, 28); + base_dis.setRgb(36, 36, 36); + window_at.setRgb(35, 36, 38); + window_iat.setRgb(26, 26, 26); + window_dis.setRgb(18, 18, 18); + shadow_at.setRgb(0, 0, 0, 255 * 0.16), + shadow_iat.setRgb(0, 0, 0, 255 * 0.16), + shadow_dis.setRgb(0, 0, 0, 255 * 0.21), +// shadow_at.setRgb(214, 214, 214); +// shadow_iat.setRgb(214, 214, 214); +// shadow_dis.setRgb(201, 201, 201); + highLight_at.setRgb(55, 144, 250); + highLight_iat.setRgb(55, 144, 250); + highLight_dis.setRgb(46, 46, 46); + highLightText_at.setRgb(255, 255, 255); + highLightText_iat.setRgb(255, 255, 255); + highLightText_dis.setRgb(77, 77, 77); + link_at.setRgb(55, 144, 250); + link_iat.setRgb(55, 144, 250); + link_dis.setRgb(55, 144, 250); + linkVisited_at.setRgb(114, 46, 209); + linkVisited_iat.setRgb(114, 46, 209); + linkVisited_dis.setRgb(114, 46, 209); + alternateBase_at.setRgb(38, 38, 38); + alternateBase_iat.setRgb(38, 38, 38); + alternateBase_dis.setRgb(38, 38, 38); + noRale_at.setRgb(51, 51, 51); + noRole_iat.setRgb(51, 51, 51); + noRole_dis.setRgb(60, 60, 60); + toolTipBase_at.setRgb(38, 38, 38); + toolTipBase_iat.setRgb(38, 38, 38); + toolTipBase_dis.setRgb(38, 38, 38); + toolTipText_at.setRgb(217, 217, 217); + toolTipText_iat.setRgb(217, 217, 217); + toolTipText_dis.setRgb(217, 217, 217); + placeholderText_at.setRgb(255, 255, 255, 255 * 0.35); + placeholderText_iat.setRgb(255, 255, 255, 255 * 0.35); + placeholderText_dis.setRgb(255, 255, 255, 255 * 0.3); } defaultPalette.setColor(QPalette::Active, QPalette::WindowText, windowText_at); @@ -1101,7 +1812,7 @@ void KFashionStyleParameters::initPalette(bool isDark) defaultPalette.setColor(QPalette::Active, QPalette::Highlight, highLight_at); defaultPalette.setColor(QPalette::Inactive, QPalette::Highlight, highLight_iat); - defaultPalette.setColor(QPalette::Disabled, QPalette::Highlight, hightight_dis); + defaultPalette.setColor(QPalette::Disabled, QPalette::Highlight, highLight_dis); defaultPalette.setColor(QPalette::Active, QPalette::HighlightedText, highLightText_at); defaultPalette.setColor(QPalette::Inactive, QPalette::HighlightedText, highLightText_iat); @@ -1123,14 +1834,19 @@ void KFashionStyleParameters::initPalette(bool isDark) defaultPalette.setColor(QPalette::Inactive, QPalette::NoRole, noRole_iat); defaultPalette.setColor(QPalette::Disabled, QPalette::NoRole, noRole_dis); - defaultPalette.setColor(QPalette::ToolTipBase, toolTipBase); + defaultPalette.setColor(QPalette::Active, QPalette::ToolTipBase, toolTipBase_at); + defaultPalette.setColor(QPalette::Inactive, QPalette::ToolTipBase, toolTipBase_iat); + defaultPalette.setColor(QPalette::Disabled, QPalette::ToolTipBase, toolTipBase_dis); - defaultPalette.setColor(QPalette::ToolTipText, toolTipText); + defaultPalette.setColor(QPalette::Active, QPalette::ToolTipText, toolTipText_at); + defaultPalette.setColor(QPalette::Inactive, QPalette::ToolTipText, toolTipText_iat); + defaultPalette.setColor(QPalette::Disabled, QPalette::ToolTipText, toolTipText_dis); #if (QT_VERSION >= QT_VERSION_CHECK(5,12,0)) - defaultPalette.setColor(QPalette::PlaceholderText, placeholderText); + defaultPalette.setColor(QPalette::Active, QPalette::PlaceholderText, placeholderText_at); + defaultPalette.setColor(QPalette::Inactive, QPalette::PlaceholderText, placeholderText_iat); + defaultPalette.setColor(QPalette::Disabled, QPalette::PlaceholderText, placeholderText_dis); #endif - } void KFashionStyleParameters::initPushButtonParameters(bool isDark, const QStyleOption *option, const QWidget *widget) @@ -1149,29 +1865,22 @@ void KFashionStyleParameters::initPushButtonParameters(bool isDark, const QStyle QColor startColor; QColor endColor; QLinearGradient linearGradient; + + //hover linearGradient.setStart(option->rect.topLeft()); linearGradient.setFinalStop(option->rect.bottomLeft()); if (isDark) { - //hover - startColor = mixColor(highlight, QColor(Qt::white), 0.2); - endColor = highlight; - linearGradient.setColorAt(0, startColor); - linearGradient.setColorAt(1, endColor); - hoverBrush = QBrush(linearGradient); - - //click - clickBrush = QBrush(mixColor(highlight, mix, 0.05)); - } else { - //hover startColor = mixColor(highlight, QColor(Qt::white), 0.2); endColor = mixColor(highlight, QColor(Qt::black), 0.05); - linearGradient.setColorAt(0, startColor); - linearGradient.setColorAt(1, endColor); - hoverBrush = QBrush(linearGradient); - - //click - clickBrush = QBrush(mixColor(highlight, mix, 0.2)); + } else { + startColor = mixColor(highlight, QColor(Qt::white), 0.05); + endColor = mixColor(highlight, QColor(Qt::black), 0.2); } + linearGradient.setColorAt(0, startColor); + linearGradient.setColorAt(1, endColor); + hoverBrush = QBrush(linearGradient); + + clickBrush = QBrush(mixColor(highlight, mix, 0.1)); defaultBrush = option->palette.brush(QPalette::Active, QPalette::Button); disableBrush = option->palette.brush(QPalette::Disabled, QPalette::Button); disableOnBrush = option->palette.brush(QPalette::Disabled, QPalette::NoRole); @@ -1201,27 +1910,20 @@ void KFashionStyleParameters::initPushButtonParameters(bool isDark, const QStyle if (isWindowColoseButton) { QColor ColoseButton = ColoseButtonColor; + //hover if (isDark) { - //hover - startColor = mixColor(ColoseButton, QColor(Qt::white), 0.2); - endColor = ColoseButton; - linearGradient.setColorAt(0, startColor); - linearGradient.setColorAt(1, endColor); - hoverBrush = QBrush(linearGradient); - - //click - clickBrush = QBrush(mixColor(ColoseButton, mix, 0.05)); - } else { - //hover startColor = mixColor(ColoseButton, QColor(Qt::white), 0.2); endColor = mixColor(ColoseButton, QColor(Qt::black), 0.05); - linearGradient.setColorAt(0, startColor); - linearGradient.setColorAt(1, endColor); - hoverBrush = QBrush(linearGradient); - - //click - clickBrush = QBrush(mixColor(ColoseButton, mix, 0.2)); + } else { + startColor = mixColor(ColoseButton, QColor(Qt::white), 0.05); + endColor = mixColor(ColoseButton, QColor(Qt::black), 0.2); } + linearGradient.setColorAt(0, startColor); + linearGradient.setColorAt(1, endColor); + hoverBrush = QBrush(linearGradient); + + //click + clickBrush = QBrush(mixColor(ColoseButton, mix, 0.1)); } else if (isWindowButton && useTransparentButtonList().contains(qAppName())) { if (isDark) { mix.setAlphaF(0.28); @@ -1237,27 +1939,20 @@ void KFashionStyleParameters::initPushButtonParameters(bool isDark, const QStyle } else if (useButtonPalette || isWindowButton) { QColor button = option->palette.color(QPalette::Active, QPalette::Button); + //hover if (isDark) { - //hover startColor = mixColor(button, QColor(Qt::white), 0.2); - endColor = mixColor(button, QColor(Qt::white), 0.1); - linearGradient.setColorAt(0, startColor); - linearGradient.setColorAt(1, endColor); - hoverBrush = QBrush(linearGradient); - - //click - clickBrush = QBrush(mixColor(button, mix, 0.05)); + endColor = mixColor(button, QColor(Qt::white), 0.05); } else { - //hover - startColor = mixColor(button, QColor(Qt::black), 0.1); + startColor = mixColor(button, QColor(Qt::black), 0.05); endColor = mixColor(button, QColor(Qt::black), 0.2); - linearGradient.setColorAt(0, startColor); - linearGradient.setColorAt(1, endColor); - hoverBrush = QBrush(linearGradient); - - //click - clickBrush = QBrush(mixColor(button, mix, 0.2)); } + linearGradient.setColorAt(0, startColor); + linearGradient.setColorAt(1, endColor); + hoverBrush = QBrush(linearGradient); + + //click + clickBrush = QBrush(mixColor(button, mix, 0.2)); } if (isImportant) { @@ -1288,29 +1983,22 @@ void KFashionStyleParameters::initToolButtonParameters(bool isDark, const QStyle QColor startColor; QColor endColor; QLinearGradient linearGradient; + + //hover linearGradient.setStart(option->rect.topLeft()); linearGradient.setFinalStop(option->rect.bottomLeft()); if (isDark) { - //hover - startColor = mixColor(highlight, QColor(Qt::white), 0.2); - endColor = highlight; - linearGradient.setColorAt(0, startColor); - linearGradient.setColorAt(1, endColor); - hoverBrush = QBrush(linearGradient); - - //click - clickBrush = QBrush(mixColor(highlight, mix, 0.05)); - } else { - //hover startColor = mixColor(highlight, QColor(Qt::white), 0.2); endColor = mixColor(highlight, QColor(Qt::black), 0.05); - linearGradient.setColorAt(0, startColor); - linearGradient.setColorAt(1, endColor); - hoverBrush = QBrush(linearGradient); - - //click - clickBrush = QBrush(mixColor(highlight, mix, 0.2)); + } else { + startColor = mixColor(highlight, QColor(Qt::white), 0.05); + endColor = mixColor(highlight, QColor(Qt::black), 0.2); } + linearGradient.setColorAt(0, startColor); + linearGradient.setColorAt(1, endColor); + hoverBrush = QBrush(linearGradient); + + clickBrush = QBrush(mixColor(highlight, mix, 0.1)); defaultBrush = option->palette.brush(QPalette::Active, QPalette::Button); disableBrush = option->palette.brush(QPalette::Disabled, QPalette::Button); disableOnBrush = option->palette.brush(QPalette::Disabled, QPalette::NoRole); @@ -1336,27 +2024,20 @@ void KFashionStyleParameters::initToolButtonParameters(bool isDark, const QStyle if (isWindowColoseButton) { QColor ColoseButton = ColoseButtonColor; + //hover if (isDark) { - //hover - startColor = mixColor(ColoseButton, QColor(Qt::white), 0.2); - endColor = ColoseButton; - linearGradient.setColorAt(0, startColor); - linearGradient.setColorAt(1, endColor); - hoverBrush = QBrush(linearGradient); - - //click - clickBrush = QBrush(mixColor(ColoseButton, mix, 0.05)); - } else { - //hover startColor = mixColor(ColoseButton, QColor(Qt::white), 0.2); endColor = mixColor(ColoseButton, QColor(Qt::black), 0.05); - linearGradient.setColorAt(0, startColor); - linearGradient.setColorAt(1, endColor); - hoverBrush = QBrush(linearGradient); - - //click - clickBrush = QBrush(mixColor(ColoseButton, mix, 0.2)); + } else { + startColor = mixColor(ColoseButton, QColor(Qt::white), 0.05); + endColor = mixColor(ColoseButton, QColor(Qt::black), 0.02); } + linearGradient.setColorAt(0, startColor); + linearGradient.setColorAt(1, endColor); + hoverBrush = QBrush(linearGradient); + + //click + clickBrush = QBrush(mixColor(ColoseButton, mix, 0.1)); } else if (isWindowButton && useTransparentButtonList().contains(qAppName())) { if (isDark) { mix.setAlphaF(0.28); @@ -1372,27 +2053,20 @@ void KFashionStyleParameters::initToolButtonParameters(bool isDark, const QStyle } else if (useButtonPalette || isWindowButton) { QColor button = option->palette.color(QPalette::Active, QPalette::Button); + //hover if (isDark) { - //hover startColor = mixColor(button, QColor(Qt::white), 0.2); - endColor = mixColor(button, QColor(Qt::white), 0.1); - linearGradient.setColorAt(0, startColor); - linearGradient.setColorAt(1, endColor); - hoverBrush = QBrush(linearGradient); - - //click - clickBrush = QBrush(mixColor(button, mix, 0.05)); + endColor = mixColor(button, QColor(Qt::white), 0.05); } else { - //hover - startColor = mixColor(button, QColor(Qt::black), 0.1); + startColor = mixColor(button, QColor(Qt::black), 0.05); endColor = mixColor(button, QColor(Qt::black), 0.2); - linearGradient.setColorAt(0, startColor); - linearGradient.setColorAt(1, endColor); - hoverBrush = QBrush(linearGradient); - - //click - clickBrush = QBrush(mixColor(button, mix, 0.2)); } + linearGradient.setColorAt(0, startColor); + linearGradient.setColorAt(1, endColor); + hoverBrush = QBrush(linearGradient); + + //click + clickBrush = QBrush(mixColor(button, mix, 0.2)); } } @@ -1540,7 +2214,7 @@ void KFashionStyleParameters::initComboBoxParameters(bool isDark, const QStyleOp comboBoxParameters.comboBoxDefaultBrush = defaultBrush; comboBoxParameters.comboBoxHoverBrush = hoverBrush; - comboBoxParameters.comboBoxOnBrush = onBrush;; + comboBoxParameters.comboBoxOnBrush = onBrush; comboBoxParameters.comboBoxEditBrush = editBrush; comboBoxParameters.comboBoxDisableBrush = disableBrush; @@ -1551,11 +2225,825 @@ void KFashionStyleParameters::initComboBoxParameters(bool isDark, const QStyleOp comboBoxParameters.comboBoxDisablePen = disablePen; } -QColor KFashionStyleParameters::radiobutton_default(bool isDark) +void KFashionStyleParameters::initListParameters(bool isDark, const QStyleOption *option, const QWidget *widget) { + listParameters.radius = 6; + + QBrush defaultBrush; + QBrush hoverBrush; + QBrush selectBrush; + QBrush disableBrush; + + + //default + defaultBrush = QBrush(Qt::transparent); + + //hover + QColor button = option->palette.color(QPalette::Active, QPalette::Button); + QColor startColor; + QColor endColor; + QLinearGradient linearGradient; + linearGradient.setStart(option->rect.topLeft()); + linearGradient.setFinalStop(option->rect.bottomLeft()); if (isDark) { - return QColor(77, 77, 77); + startColor = mixColor(button, QColor(Qt::white), 0.2); + endColor = mixColor(button, QColor(Qt::white), 0.05); } else { - return QColor(166, 166, 166); + startColor = mixColor(button, QColor(Qt::black), 0.05); + endColor = mixColor(button, QColor(Qt::black), 0.2); } + linearGradient.setColorAt(0, startColor); + linearGradient.setColorAt(1, endColor); + hoverBrush = QBrush(linearGradient); + + //select + selectBrush = option->palette.brush(QPalette::Active, QPalette::Highlight); + + //disable + disableBrush = QBrush(Qt::transparent); + + + listParameters.listDefaultBrush = defaultBrush; + listParameters.listHoverBrush = hoverBrush; + listParameters.listSelectBrush = selectBrush; + listParameters.listDisableBrush = disableBrush; +} + +void KFashionStyleParameters::initTreeParameters(bool isDark, const QStyleOption *option, const QWidget *widget) +{ + treeParameters.radius = 6; + + QBrush defaultBrush; + QBrush hoverBrush; + QBrush selectBrush; + QBrush disableBrush; + + QBrush branchDefaultBrush; + QBrush branchHoverBrush; + QBrush branchSelectBrush; + QBrush branchDisableBrush; + + + //default + defaultBrush = QBrush(Qt::transparent); + branchDefaultBrush = defaultBrush; + + //hover + QColor button = option->palette.color(QPalette::Active, QPalette::Button); + QColor startColor; + QColor endColor; + QLinearGradient linearGradient; + linearGradient.setStart(option->rect.topLeft()); + linearGradient.setFinalStop(option->rect.bottomLeft()); + if (isDark) { + startColor = mixColor(button, QColor(Qt::white), 0.2); + endColor = mixColor(button, QColor(Qt::white), 0.05); + } else { + startColor = mixColor(button, QColor(Qt::black), 0.05); + endColor = mixColor(button, QColor(Qt::black), 0.2); + } + linearGradient.setColorAt(0, startColor); + linearGradient.setColorAt(1, endColor); + hoverBrush = QBrush(linearGradient); + branchHoverBrush = hoverBrush; + + //select + selectBrush = option->palette.brush(QPalette::Active, QPalette::Highlight); + branchSelectBrush = selectBrush; + + //disable + disableBrush = QBrush(Qt::transparent); + branchDisableBrush = disableBrush; + + + treeParameters.treeDefaultBrush = defaultBrush; + treeParameters.treeHoverBrush = hoverBrush; + treeParameters.treeSelectBrush = selectBrush; + treeParameters.treeDisableBrush = disableBrush; + + treeParameters.treeBranchDefaultBrush = branchDefaultBrush; + treeParameters.treeBranchHoverBrush = branchHoverBrush; + treeParameters.treeBranchSelectBrush = branchSelectBrush; + treeParameters.treeBranchDisableBrush = branchDisableBrush; +} + +void KFashionStyleParameters::initTableParameters(bool isDark, const QStyleOption *option, const QWidget *widget) +{ + tableParameters.radius = 6; + + QBrush defaultBrush; + QBrush hoverBrush; + QBrush selectBrush; + QBrush disableBrush; + + + //default + defaultBrush = QBrush(Qt::transparent); + + //hover + QColor button = option->palette.color(QPalette::Active, QPalette::Button); + QColor startColor; + QColor endColor; + QLinearGradient linearGradient; + linearGradient.setStart(option->rect.topLeft()); + linearGradient.setFinalStop(option->rect.bottomLeft()); + if (isDark) { + startColor = mixColor(button, QColor(Qt::white), 0.2); + endColor = mixColor(button, QColor(Qt::white), 0.05); + } else { + startColor = mixColor(button, QColor(Qt::black), 0.05); + endColor = mixColor(button, QColor(Qt::black), 0.2); + } + linearGradient.setColorAt(0, startColor); + linearGradient.setColorAt(1, endColor); + hoverBrush = QBrush(linearGradient); + + //select + selectBrush = option->palette.brush(QPalette::Active, QPalette::Highlight); + + //disable + disableBrush = QBrush(Qt::transparent); + + + tableParameters.tableDefaultBrush = defaultBrush; + tableParameters.tableHoverBrush = hoverBrush; + tableParameters.tableSelectBrush = selectBrush; + tableParameters.tableDisableBrush = disableBrush; +} + +void KFashionStyleParameters::initCheckBoxParameters(bool isDark, const QStyleOption *option, const QWidget *widget) +{ + checkBoxParameters.radius = 4; + + QPen defaultPen; + QPen hoverPen; + QPen clickPen; + QPen disablePen; + QPen onDefaultPen; + QPen onHoverPen; + QPen onClickPen; + + QBrush defaultBrush; + QBrush hoverBrush; + QBrush clickBrush; + QBrush disableBrush; + QBrush onDefaultBrush; + QBrush onHoverBrush; + QBrush onClickBrush; + + QColor mix = option->palette.color(QPalette::Active, QPalette::BrightText); + + //default + if (isDark) { + defaultPen = QPen(option->palette.brush(QPalette::Active, QPalette::ButtonText), + 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin); + } else { + defaultPen = QPen(option->palette.brush(QPalette::Disabled, QPalette::ButtonText), + 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin); + } + defaultBrush = QBrush(option->palette.color(QPalette::Active, QPalette::Base).lighter(200)); + + //hover + hoverPen = defaultPen; + if (isDark) { + hoverBrush = QBrush(mixColor(defaultBrush.color(), mix, 0.15)); + } else { + hoverBrush = QBrush(mixColor(defaultBrush.color(), mix, 0.05)); + } + + //click + clickPen = defaultPen; + if (isDark) { + clickBrush = QBrush(mixColor(defaultBrush.color(), mix, 0.1)); + } else { + clickBrush = QBrush(mixColor(defaultBrush.color(), mix, 0.15)); + } + + + //disable + disablePen = defaultPen; + disableBrush = option->palette.brush(QPalette::Disabled, QPalette::NoRole); + + //on default + onDefaultPen = QPen(Qt::NoPen); + onDefaultBrush = option->palette.brush(QPalette::Active, QPalette::Highlight); + + //on hover + onHoverPen = QPen(Qt::NoPen); + QColor startColor; + QColor endColor; + QLinearGradient linearGradient; + linearGradient.setStart(option->rect.topLeft()); + linearGradient.setFinalStop(option->rect.bottomLeft()); + if (isDark) { + startColor = mixColor(onDefaultBrush.color(), QColor(Qt::white), 0.2); + endColor = mixColor(onDefaultBrush.color(), QColor(Qt::black), 0.05); + } else { + startColor = mixColor(onDefaultBrush.color(), QColor(Qt::white), 0.05); + endColor = mixColor(onDefaultBrush.color(), QColor(Qt::black), 0.2); + } + linearGradient.setColorAt(0, startColor); + linearGradient.setColorAt(1, endColor); + onHoverBrush = QBrush(linearGradient); + + //on click + onClickPen = QPen(Qt::NoPen); + onClickBrush = QBrush(mixColor(onDefaultBrush.color(), mix, 0.1)); + + checkBoxParameters.checkBoxDefaultPen = defaultPen; + checkBoxParameters.checkBoxHoverPen = hoverPen; + checkBoxParameters.checkBoxClickPen = clickPen; + checkBoxParameters.checkBoxDisablePen = disablePen; + checkBoxParameters.checkBoxOnDefaultPen = onDefaultPen; + checkBoxParameters.checkBoxOnHoverPen = onHoverPen; + checkBoxParameters.checkBoxOnClickPen = onClickPen; + + checkBoxParameters.checkBoxDefaultBrush = defaultBrush; + checkBoxParameters.checkBoxHoverBrush = hoverBrush; + checkBoxParameters.checkBoxClickBrush = clickBrush; + checkBoxParameters.checkBoxDisableBrush = disableBrush; + checkBoxParameters.checkBoxOnDefaultBrush = onDefaultBrush; + checkBoxParameters.checkBoxOnHoverBrush = onHoverBrush; + checkBoxParameters.checkBoxOnClickBrush = onClickBrush; +} + +void KFashionStyleParameters::initRadioButtonParameters(bool isDark, const QStyleOption *option, const QWidget *widget) +{ + radioButtonParameters.radius = 6; + + QPen defaultPen; + QPen hoverPen; + QPen clickPen; + QPen disablePen; + QPen onDefaultPen; + QPen onHoverPen; + QPen onClickPen; + + QBrush defaultBrush; + QBrush hoverBrush; + QBrush clickBrush; + QBrush disableBrush; + QBrush onDefaultBrush; + QBrush onHoverBrush; + QBrush onClickBrush; + + QColor mix = option->palette.color(QPalette::Active, QPalette::BrightText); + + //default + if (isDark) { + defaultPen = QPen(option->palette.brush(QPalette::Active, QPalette::ButtonText), + 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin); + } else { + defaultPen = QPen(option->palette.brush(QPalette::Disabled, QPalette::ButtonText), + 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin); + } + defaultBrush = QBrush(option->palette.color(QPalette::Active, QPalette::Base).lighter(200)); + + //hover + hoverPen = defaultPen; + if (isDark) { + hoverBrush = QBrush(mixColor(defaultBrush.color(), mix, 0.15)); + } else { + hoverBrush = QBrush(mixColor(defaultBrush.color(), mix, 0.05)); + } + + //click + clickPen = defaultPen; + if (isDark) { + clickBrush = QBrush(mixColor(defaultBrush.color(), mix, 0.1)); + } else { + clickBrush = QBrush(mixColor(defaultBrush.color(), mix, 0.15)); + } + + //disable + disablePen = defaultPen; + disableBrush = option->palette.brush(QPalette::Disabled, QPalette::NoRole); + + //on default + onDefaultPen = QPen(Qt::NoPen); + onDefaultBrush = option->palette.brush(QPalette::Active, QPalette::Highlight); + + //on hover + onHoverPen = QPen(Qt::NoPen); + if (isDark) { + onHoverBrush = QBrush(mixColor(onDefaultBrush.color(), mix, 0.2)); + } else { + onHoverBrush = QBrush(mixColor(onDefaultBrush.color(), mix, 0.05)); + } + + //on click + onClickPen = QPen(Qt::NoPen); + if (isDark) { + onClickBrush = QBrush(mixColor(onDefaultBrush.color(), mix, 0.05)); + } else { + onClickBrush = QBrush(mixColor(onDefaultBrush.color(), mix, 0.2)); + } + + + //if set property + if (widget) { + if (widget->property("setDefaultPen").isValid() && widget->property("setDefaultPen").canConvert()) { + defaultPen = widget->property("setDefaultPen").value(); + } + if (widget->property("setHoverPen").isValid() && widget->property("setHoverPen").canConvert()) { + hoverPen = widget->property("setHoverPen").value(); + } + if (widget->property("setClickPen").isValid() && widget->property("setClickPen").canConvert()) { + clickPen = widget->property("setClickPen").value(); + } + if (widget->property("setDisablePen").isValid() && widget->property("setDisablePen").canConvert()) { + disablePen = widget->property("setDisablePen").value(); + } + if (widget->property("setOnDefaultPen").isValid() && widget->property("setOnDefaultPen").canConvert()) { + onDefaultPen = widget->property("setOnDefaultPen").value(); + } + if (widget->property("setOnHoverPen").isValid() && widget->property("setOnHoverPen").canConvert()) { + onHoverPen = widget->property("setOnHoverPen").value(); + } + if (widget->property("setOnClickPen").isValid() && widget->property("setOnClickPen").canConvert()) { + onClickPen = widget->property("setOnClickPen").value(); + } + if (widget->property("setDefaultBrush").isValid() && widget->property("setDefaultBrush").canConvert()) { + defaultBrush = widget->property("setDefaultBrush").value(); + } + if (widget->property("setHoverBrush").isValid() && widget->property("setHoverBrush").canConvert()) { + hoverBrush = widget->property("setHoverBrush").value(); + } + if (widget->property("setClickBrush").isValid() && widget->property("setClickBrush").canConvert()) { + clickBrush = widget->property("setClickBrush").value(); + } + if (widget->property("setDisableBrush").isValid() && widget->property("setDisableBrush").canConvert()) { + disableBrush = widget->property("setDisableBrush").value(); + } + if (widget->property("setOnDefaultBrush").isValid() && widget->property("setOnDefaultBrush").canConvert()) { + onDefaultBrush = widget->property("setOnDefaultBrush").value(); + } + if (widget->property("setOnHoverBrush").isValid() && widget->property("setOnHoverBrush").canConvert()) { + onHoverBrush = widget->property("setOnHoverBrush").value(); + } + if (widget->property("setOnClickBrush").isValid() && widget->property("setOnClickBrush").canConvert()) { + onClickBrush = widget->property("setOnClickBrush").value(); + } + } + + + radioButtonParameters.radioButtonDefaultPen = defaultPen; + radioButtonParameters.radioButtonHoverPen = hoverPen; + radioButtonParameters.radioButtonClickPen = clickPen; + radioButtonParameters.radioButtonDisablePen = disablePen; + radioButtonParameters.radioButtonOnDefaultPen = onDefaultPen; + radioButtonParameters.radioButtonOnHoverPen = onHoverPen; + radioButtonParameters.radioButtonOnClickPen = onClickPen; + + radioButtonParameters.radioButtonDefaultBrush = defaultBrush; + radioButtonParameters.radioButtonHoverBrush = hoverBrush; + radioButtonParameters.radioButtonClickBrush = clickBrush; + radioButtonParameters.radioButtonDisableBrush = disableBrush; + radioButtonParameters.radioButtonOnDefaultBrush = onDefaultBrush; + radioButtonParameters.radioButtonOnHoverBrush = onHoverBrush; + radioButtonParameters.radioButtonOnClickBrush = onClickBrush; +} + +void KFashionStyleParameters::initSliderParameters(bool isDark, const QStyleOption *option, const QWidget *widget) +{ + QBrush handleDefaultBrush; + QBrush handleHoverBrush; + QBrush handleClickBrush; + QBrush handleDisableBrush; + + QBrush grooveValueDefaultBrush; + QBrush grooveValueHoverBrush; + QBrush grooveValueDisableBrush; + QBrush grooveUnvalueDefaultBrush; + QBrush grooveUnvalueHoverBrush; + QBrush grooveUnvalueDisableBrush; + + const QStyleOptionSlider *slider = qstyleoption_cast(option); + + QColor highlight = option->palette.color(QPalette::Active, QPalette::Highlight); + QColor mix = option->palette.color(QPalette::Active, QPalette::BrightText); + + //handle default + handleDefaultBrush = option->palette.color(QPalette::Active, QPalette::Highlight); + + //handle hover + QColor startColor; + QColor endColor; + QLinearGradient linearGradient; + if (slider->orientation == Qt::Vertical) { + linearGradient.setStart(option->rect.topLeft()); + linearGradient.setFinalStop(option->rect.topRight()); + } else { + linearGradient.setStart(option->rect.topLeft()); + linearGradient.setFinalStop(option->rect.bottomLeft()); + } + + if (isDark) { + startColor = mixColor(highlight, QColor(Qt::white), 0.2); + endColor = mixColor(highlight, QColor(Qt::black), 0.05); + } else { + startColor = mixColor(highlight, QColor(Qt::white), 0.05); + endColor = mixColor(highlight, QColor(Qt::black), 0.2); + } + linearGradient.setColorAt(0, startColor); + linearGradient.setColorAt(1, endColor); + handleHoverBrush = QBrush(linearGradient); + + //handle click + handleClickBrush = QBrush(mixColor(highlight, mix, 0.1)); + + //handle disable + handleDisableBrush = option->palette.color(QPalette::Disabled, QPalette::ButtonText); + + //groove value default + grooveValueDefaultBrush = handleHoverBrush; + + //groove value hover + grooveValueHoverBrush = handleClickBrush; + + //groove value disable + grooveValueDisableBrush = handleDisableBrush; + + //groove unvalue default + grooveUnvalueDefaultBrush = option->palette.color(QPalette::Active, QPalette::Button); + + //groove unvalue hover + grooveUnvalueHoverBrush = grooveUnvalueDefaultBrush; + + //groove unvalue disable + grooveUnvalueDisableBrush = grooveUnvalueDefaultBrush; + + + sliderParameters.sliderHandleDefaultBrush = handleDefaultBrush; + sliderParameters.sliderHandleHoverBrush = handleHoverBrush; + sliderParameters.sliderHandleClickBrush = handleClickBrush; + sliderParameters.sliderHandleDisableBrush = handleDisableBrush; + + sliderParameters.sliderGrooveValueDefaultBrush = grooveValueDefaultBrush; + sliderParameters.sliderGrooveValueHoverBrush = grooveValueHoverBrush; + sliderParameters.sliderGrooveValueDisableBrush = grooveValueDisableBrush; + + sliderParameters.sliderGrooveUnvalueDefaultBrush = grooveUnvalueDefaultBrush; + sliderParameters.sliderGrooveUnvalueHoverBrush = grooveUnvalueHoverBrush; + sliderParameters.sliderGrooveUnvalueDisableBrush = grooveUnvalueDisableBrush; +} + +void KFashionStyleParameters::initProgressBarParameters(bool isDark, const QStyleOption *option, const QWidget *widget) +{ + QBrush contentBrush; + QBrush grooveDefaultBrush; + QBrush grooveDisableBrush; + + const QStyleOptionProgressBar *pb = qstyleoption_cast(option); + const bool vertical = pb->orientation == Qt::Vertical; + const bool inverted = pb->invertedAppearance; + + bool reverse = (!vertical && (pb->direction == Qt::RightToLeft)) || vertical; + if (inverted) + reverse = !reverse; + + //content + QColor startColor = option->palette.color(QPalette::Active, QPalette::Highlight); + QColor endColor = option->palette.color(QPalette::Active, QPalette::Highlight).lighter(120); + QLinearGradient linearGradient; + linearGradient.setColorAt(0, startColor); + linearGradient.setColorAt(1, endColor); + if (vertical) { + if (reverse) { + linearGradient.setStart(pb->rect.bottomLeft()); + linearGradient.setFinalStop(pb->rect.topLeft()); + } else { + linearGradient.setStart(pb->rect.topLeft()); + linearGradient.setFinalStop(pb->rect.bottomLeft()); + } + } else { + if (reverse) { + linearGradient.setStart(pb->rect.topRight()); + linearGradient.setFinalStop(pb->rect.topLeft()); + } else { + linearGradient.setStart(pb->rect.topLeft()); + linearGradient.setFinalStop(pb->rect.topRight()); + } + } + contentBrush = QBrush(linearGradient); + + //groove default + grooveDefaultBrush = pb->palette.brush(QPalette::Active, QPalette::Button); + + //groove disable + grooveDisableBrush = pb->palette.brush(QPalette::Disabled, QPalette::Button); + + + progressBarParameters.radius = 6; + progressBarParameters.progressBarContentBrush = contentBrush; + progressBarParameters.progressBarGrooveDefaultBrush = grooveDefaultBrush; + progressBarParameters.progressBarGrooveDisableBrush = grooveDisableBrush; +} + +void KFashionStyleParameters::initScrollBarParameters(bool isDark, const QStyleOption *option, const QWidget *widget) +{ + int sliderRadius; + QBrush grooveDefaultBrush; + QBrush grooveInactiveBrush; + QBrush sliderDefaultBrush; + QBrush sliderHoverBrush; + QBrush sliderClickBrush; + QBrush sliderDisableBrush; + + QColor mix = option->palette.color(QPalette::Active, QPalette::BrightText); + + const QStyleOptionSlider *bar = qstyleoption_cast(option); + + //radius + if (bar->orientation == Qt::Horizontal) { + sliderRadius = (bar->rect.height()) / 4; + } else { + sliderRadius = (bar->rect.width()) / 4; + } + + //groove default + grooveDefaultBrush = option->palette.brush(QPalette::Active, QPalette::Base); + + //groove inactive + grooveInactiveBrush = option->palette.brush(QPalette::Inactive, QPalette::Base); + + //slider default + sliderDefaultBrush = option->palette.brush(QPalette::Active, QPalette::Button); + + //slider hover + QColor startColor; + QColor endColor; + QLinearGradient linearGradient; + if (bar->orientation == Qt::Horizontal) { + linearGradient.setStart(option->rect.topLeft()); + linearGradient.setFinalStop(option->rect.bottomLeft()); + } else { + linearGradient.setStart(option->rect.topLeft()); + linearGradient.setFinalStop(option->rect.topRight()); + } + QColor color = option->palette.color(QPalette::Active, QPalette::Button); + if (isDark) { + startColor = mixColor(color, QColor(Qt::white), 0.2); + endColor = mixColor(color, QColor(Qt::white), 0.05); + } else { + startColor = mixColor(color, QColor(Qt::black), 0.05); + endColor = mixColor(color, QColor(Qt::black), 0.2); + } + linearGradient.setColorAt(0, startColor); + linearGradient.setColorAt(1, endColor); + sliderHoverBrush = QBrush(linearGradient); + + //slider click + sliderClickBrush = QBrush(mixColor(sliderDefaultBrush.color(), mix, 0.2)); + + //slider disable + sliderDisableBrush = option->palette.brush(QPalette::Disabled, QPalette::Button); + + + scrollBarParameters.radius = sliderRadius; + scrollBarParameters.scrollBarGrooveDefaultBrush = grooveDefaultBrush; + scrollBarParameters.scrollBarGrooveInactiveBrush = grooveInactiveBrush; + scrollBarParameters.scrollBarSliderDefaultBrush = sliderDefaultBrush; + scrollBarParameters.scrollBarSliderHoverBrush = sliderHoverBrush; + scrollBarParameters.scrollBarSliderClickBrush = sliderClickBrush; + scrollBarParameters.scrollBarSliderDisableBrush = sliderDisableBrush; +} + +void KFashionStyleParameters::initToolTipParameters(bool isDark, const QStyleOption *option, const QWidget *widget) +{ + QBrush backgroundBrush; + + //background + backgroundBrush = option->palette.color(QPalette::Active, QPalette::ToolTipBase); + + + toolTipParameters.radius = 6; + toolTipParameters.toolTipBackgroundBrush = backgroundBrush; +} + +void KFashionStyleParameters::initTabWidgetParameters(bool isDark, const QStyleOption *option, const QWidget *widget) +{ + int tabradius = 6; + QBrush widgetBackgroundBrush; + QBrush tabBarBackgroundBrush; + QBrush tabBarDefaultBrush; + QBrush tabBarHoverBrush; + QBrush tabBarSelectBrush; + + //tab widget background + widgetBackgroundBrush = option->palette.brush(QPalette::Active, QPalette::Base); + + //tabbar background + tabBarBackgroundBrush = option->palette.brush(QPalette::Active, QPalette::Window); + + //tabbar default + tabBarDefaultBrush = option->palette.brush(QPalette::Active, QPalette::Window); + + //tabbar hover + QColor hover_color = option->palette.color(QPalette::Active, QPalette::Window); + QColor mix = option->palette.color(QPalette::Active, QPalette::BrightText); + tabBarHoverBrush = QBrush(mixColor(hover_color, mix, 0.1)); + + //tabbar select + tabBarSelectBrush = option->palette.brush(QPalette::Active, QPalette::Base); + + + if (widget && widget->property("setRadius").isValid() && widget->property("setRadius").canConvert()) { + tabradius = widget->property("setRadius").value(); + } + + + tabWidgetParameters.radius = tabradius; + tabWidgetParameters.tabWidgetBackgroundBrush = widgetBackgroundBrush; + tabWidgetParameters.tabBarBackgroundBrush = tabBarBackgroundBrush; + tabWidgetParameters.tabBarDefaultBrush = tabBarDefaultBrush; + tabWidgetParameters.tabBarHoverBrush = tabBarHoverBrush; + tabWidgetParameters.tabBarSelectBrush = tabBarSelectBrush; +} + +void KFashionStyleParameters::initMenuParameters(bool isDark, const QStyleOption *option, const QWidget *widget) +{ + int frameradius = 8; + int itemradius = 6; + QPixmap framePixmap(option->rect.size()); + QBrush itemSelectBrush; + + //frame Pixmap + framePixmap.fill(Qt::transparent); + QRect drawRect; + if (qobject_cast(widget)) { + //path has 1px blank on right and bottom + drawRect = option->rect.adjusted(0, 0, 1, 1); + + QPainterPath drawRectPath; + drawRectPath.moveTo(drawRect.left(), drawRect.top() + frameradius); + drawRectPath.arcTo(QRect(drawRect.left(), drawRect.top(), 2 * frameradius, 2 * frameradius), 180, -90); + drawRectPath.lineTo(drawRect.right() - frameradius, drawRect.top()); + drawRectPath.arcTo(QRect(drawRect.right() - 2 * frameradius, drawRect.top(), 2 * frameradius, 2 * frameradius), 90, -90); + drawRectPath.lineTo(drawRect.right(), drawRect.bottom() - 28); + drawRectPath.arcTo(QRect(drawRect.right() - 2 * 20, drawRect.bottom() - 2 * 28, 2 * 20, 2 * 28), 0, -90); + drawRectPath.lineTo(drawRect.left() + frameradius, drawRect.bottom()); + drawRectPath.arcTo(QRect(drawRect.left(), drawRect.bottom() - 2 * frameradius, 2 * frameradius, 2 * frameradius), -90, -90); + drawRectPath.lineTo(drawRect.left(), drawRect.top() + frameradius); + + QPainter pixmapPainter(&framePixmap); + pixmapPainter.setPen(Qt::NoPen); + pixmapPainter.setBrush(option->palette.color(QPalette::Active, QPalette::Base).lighter(300)); + pixmapPainter.setRenderHint(QPainter::Antialiasing, true); + pixmapPainter.drawPath(drawRectPath); + pixmapPainter.end(); + + QPainterPath drawRightBottomPath; + drawRightBottomPath.moveTo(drawRect.right(), drawRect.bottom() - 28); + drawRightBottomPath.arcTo(QRect(drawRect.right() - 2 * 20, drawRect.bottom() - 2 * 28, 2 * 20, 2 * 28), 0, -90); + drawRightBottomPath.lineTo(drawRect.right() - frameradius, drawRect.bottom()); + drawRightBottomPath.arcTo(QRect(drawRect.right() - 2 * frameradius, drawRect.bottom() - 2 * frameradius, 2 * frameradius, 2 * frameradius), -90, 90); + drawRightBottomPath.lineTo(drawRect.right(), drawRect.bottom() - 28); + + //draw right bottom corner + QColor startColor = option->palette.color(QPalette::Active, QPalette::Base).lighter(300); + QColor endColor = mixColor(startColor, QColor(Qt::black), 0.25); + QLinearGradient linearGradient; + QPainter pixmapPainter2(&framePixmap); + linearGradient.setColorAt(0, startColor); + linearGradient.setColorAt(1, endColor); + linearGradient.setStart(drawRect.right(), drawRect.bottom() - 28); + linearGradient.setFinalStop(drawRect.right(), drawRect.bottom()); + pixmapPainter2.setRenderHint(QPainter::Antialiasing); + pixmapPainter2.setPen(Qt::transparent); + pixmapPainter2.setBrush(linearGradient); + pixmapPainter2.drawPath(drawRightBottomPath); + } else { + int rander = 5; + drawRect = option->rect.adjusted(+rander, +rander, -rander, -rander); + + // Draw a black floor + QPainter pixmapPainter(&framePixmap); + pixmapPainter.setRenderHint(QPainter::Antialiasing, true); + pixmapPainter.setPen(Qt::transparent); + pixmapPainter.setBrush(option->palette.color(QPalette::Active, QPalette::BrightText)); + pixmapPainter.drawRoundedRect(drawRect.adjusted(1, 1, -1, -1), frameradius, frameradius); + pixmapPainter.end(); + + // Blur the black background + QImage img = framePixmap.toImage(); + qt_blurImage(img, 4, false, false); + + // Dig out the center part, Shadow rendering + framePixmap = QPixmap::fromImage(img); + QPainter pixmapPainter2(&framePixmap); + pixmapPainter2.setRenderHint(QPainter::Antialiasing); + pixmapPainter2.setCompositionMode(QPainter::CompositionMode_Clear); + pixmapPainter2.setPen(Qt::transparent); + pixmapPainter2.setBrush(Qt::transparent); + pixmapPainter2.drawRoundedRect(drawRect.adjusted(1, 1, -1, -1), frameradius, frameradius); + pixmapPainter2.end(); + + //That's when I started drawing the frame floor + QColor color = option->palette.color(QPalette::Base); + QColor startColor; + QColor endColor; + if (isDark) { + endColor = option->palette.color(QPalette::Active, QPalette::Base).lighter(300); + startColor = mixColor(endColor, QColor(Qt::white), 0.2); + } else { + startColor = option->palette.color(QPalette::Active, QPalette::Base).lighter(300); + endColor = mixColor(startColor, QColor(Qt::black), 0.2); + } + + if (UKUIStyleSettings::isSchemaInstalled("org.ukui.style")) { + auto opacity = UKUIStyleSettings::globalInstance()->get("menuTransparency").toInt()/100.0; + color.setAlphaF(opacity); + startColor.setAlphaF(opacity); + endColor.setAlphaF(opacity); + } + if (qApp->property("blurEnable").isValid()) { + bool blurEnable = qApp->property("blurEnable").toBool(); + if (!blurEnable) { + color.setAlphaF(1); + startColor.setAlphaF(1); + endColor.setAlphaF(1); + } + } + if (widget) { + if (widget->property("useSystemStyleBlur").isValid() && !widget->property("useSystemStyleBlur").toBool()) { + color.setAlphaF(1); + startColor.setAlphaF(1); + endColor.setAlphaF(1); + } + } + //if blur effect is not supported, do not use transparent color. + if (!KWindowEffects::isEffectAvailable(KWindowEffects::BlurBehind) || blackAppListWithBlurHelper().contains(qAppName())) { + color.setAlphaF(1); + startColor.setAlphaF(1); + endColor.setAlphaF(1); + } + + QRegion region; + if (widget) { + region = widget->mask(); + } + + if (!region.isEmpty()) { + QPainterPath path; + path.addRegion(region); + + //draw blur background + QPainter pixmapPainter3(&framePixmap); + pixmapPainter3.setRenderHint(QPainter::Antialiasing); + pixmapPainter3.setPen(Qt::transparent); + pixmapPainter3.setBrush(color); + pixmapPainter3.drawPath(path); + } else { + //path has 1px blank on right and bottom + drawRect.adjust(0, 0, 1, 1); + + QPainterPath drawRectPath; + drawRectPath.moveTo(drawRect.left(), drawRect.top() + frameradius); + drawRectPath.arcTo(QRect(drawRect.left(), drawRect.top(), 2 * frameradius, 2 * frameradius), 180, -90); + drawRectPath.lineTo(drawRect.right() - frameradius, drawRect.top()); + drawRectPath.arcTo(QRect(drawRect.right() - 2 * frameradius, drawRect.top(), 2 * frameradius, 2 * frameradius), 90, -90); + drawRectPath.lineTo(drawRect.right(), drawRect.bottom() - 28); + drawRectPath.arcTo(QRect(drawRect.right() - 2 * 20, drawRect.bottom() - 2 * 28, 2 * 20, 2 * 28), 0, -90); + drawRectPath.lineTo(drawRect.left() + frameradius, drawRect.bottom()); + drawRectPath.arcTo(QRect(drawRect.left(), drawRect.bottom() - 2 * frameradius, 2 * frameradius, 2 * frameradius), -90, -90); + drawRectPath.lineTo(drawRect.left(), drawRect.top() + frameradius); + + //draw blur background + QPainter pixmapPainter3(&framePixmap); + pixmapPainter3.setRenderHint(QPainter::Antialiasing); + pixmapPainter3.setPen(Qt::transparent); + pixmapPainter3.setBrush(color); + pixmapPainter3.drawPath(drawRectPath); + pixmapPainter3.end(); + + QPainterPath drawRightBottomPath; + drawRightBottomPath.moveTo(drawRect.right(), drawRect.bottom() - 28); + drawRightBottomPath.arcTo(QRect(drawRect.right() - 2 * 20, drawRect.bottom() - 2 * 28, 2 * 20, 2 * 28), 0, -90); + drawRightBottomPath.lineTo(drawRect.right() - frameradius, drawRect.bottom()); + drawRightBottomPath.arcTo(QRect(drawRect.right() - 2 * frameradius, drawRect.bottom() - 2 * frameradius, 2 * frameradius, 2 * frameradius), -90, 90); + drawRightBottomPath.lineTo(drawRect.right(), drawRect.bottom() - 28); + + //draw right bottom corner + QLinearGradient linearGradient; + linearGradient.setColorAt(0, startColor); + linearGradient.setColorAt(1, endColor); + linearGradient.setStart(drawRect.right(), drawRect.bottom() - 28); + linearGradient.setFinalStop(drawRect.right(), drawRect.bottom()); + QPainter pixmapPainter4(&framePixmap); + pixmapPainter4.setRenderHint(QPainter::Antialiasing); + pixmapPainter4.setPen(Qt::transparent); + pixmapPainter4.setBrush(linearGradient); + pixmapPainter4.drawPath(drawRightBottomPath); + } + } + + //item select brush + itemSelectBrush = QBrush(option->palette.brush(QPalette::Active, QPalette::Highlight)); + + + menuParameters.frameRadius = frameradius; + menuParameters.itemRadius = itemradius; + menuParameters.menuFramePixmap = framePixmap; + menuParameters.menuItemSelectBrush = itemSelectBrush; } diff --git a/ukui-styles/qt5-style-ukui/kabstract-style-parameters.h b/ukui-styles/qt5-style-ukui/kabstract-style-parameters.h index f507d69..d7681ca 100644 --- a/ukui-styles/qt5-style-ukui/kabstract-style-parameters.h +++ b/ukui-styles/qt5-style-ukui/kabstract-style-parameters.h @@ -32,6 +32,17 @@ #include "lineedit-parameters.h" #include "spinbox-parameters.h" #include "combobox-parameters.h" +#include "list-parameters.h" +#include "tree-parameters.h" +#include "table-parameters.h" +#include "checkbox-parameters.h" +#include "radiobutton-parameters.h" +#include "slider-parameters.h" +#include "progressbar-parameters.h" +#include "scrollbar-parameters.h" +#include "tooltip-parameters.h" +#include "tabwidget-parameters.h" +#include "menu-parameters.h" @@ -62,10 +73,9 @@ public: // menu int Menu_MarginHeight = 4 + 5; - int Menu_Combobox_Popup_MarginHeight = 6; + int Menu_Combobox_Popup_MarginHeight = 4; int Menu_MarginWidth = 4 + 5; int Menu_MarginPanelWidth = 0; - int Menu_Radius = 8; // menu-item int MenuItem_MarginHeight = 2; @@ -74,7 +84,6 @@ public: int MenuItemSeparator_MarginWidth = 4; int MenuItem_DefaultHeight = 36; int MenuItem_DefaultWidght = 152; - int MenuItem_Radius = 6; // scrollbar int ScroolBar_Width = 16; @@ -94,7 +103,6 @@ public: int ExclusiveIndicator_Height = 16; int RadioButtonLabel_Spacing = 8; int RadioButton_DefaultHeight = 36; - int RadioButton_OnLength = 6; // checkbox int Indicator_Width = 16; @@ -135,14 +143,21 @@ public: LineEditParameters lineEditParameters; SpinBoxParameters spinBoxParameters; ComboBoxParameters comboBoxParameters; - - - + ListParameters listParameters; + TreeParameters treeParameters; + TableParameters tableParameters; + CheckBoxParameters checkBoxParameters; + RadioButtonParameters radioButtonParameters; + SliderParameters sliderParameters; + ProgressBarParameters progressBarParameters; + ScrollBarParameters scrollBarParameters; + ToolTipParameters toolTipParameters; + TabWidgetParameters tabWidgetParameters; + MenuParameters menuParameters; QPalette setPalette(QPalette &palette); - virtual QColor radiobutton_default(bool isDark) = 0;// palette::Button virtual void initPalette(bool isDark) = 0; virtual void initPushButtonParameters(bool isDark, const QStyleOption *option, const QWidget *widget) = 0; @@ -150,6 +165,17 @@ public: virtual void initLineEditParameters(bool isDark, const QStyleOption *option, const QWidget *widget) = 0; virtual void initSpinBoxParameters(bool isDark, const QStyleOption *option, const QWidget *widget) = 0; virtual void initComboBoxParameters(bool isDark, const QStyleOption *option, const QWidget *widget) = 0; + virtual void initListParameters(bool isDark, const QStyleOption *option, const QWidget *widget) = 0; + virtual void initTreeParameters(bool isDark, const QStyleOption *option, const QWidget *widget) = 0; + virtual void initTableParameters(bool isDark, const QStyleOption *option, const QWidget *widget) = 0; + virtual void initCheckBoxParameters(bool isDark, const QStyleOption *option, const QWidget *widget) = 0; + virtual void initRadioButtonParameters(bool isDark, const QStyleOption *option, const QWidget *widget) = 0; + virtual void initSliderParameters(bool isDark, const QStyleOption *option, const QWidget *widget) = 0; + virtual void initProgressBarParameters(bool isDark, const QStyleOption *option, const QWidget *widget) = 0; + virtual void initScrollBarParameters(bool isDark, const QStyleOption *option, const QWidget *widget) = 0; + virtual void initToolTipParameters(bool isDark, const QStyleOption *option, const QWidget *widget) = 0; + virtual void initTabWidgetParameters(bool isDark, const QStyleOption *option, const QWidget *widget) = 0; + virtual void initMenuParameters(bool isDark, const QStyleOption *option, const QWidget *widget) = 0; }; @@ -158,14 +184,23 @@ class KDefaultStyleParameters : public KAbstractStyleParameters public: KDefaultStyleParameters(QObject *parent, bool isDark); - QColor radiobutton_default(bool isDark) override; - void initPalette(bool isDark) override; void initPushButtonParameters(bool isDark, const QStyleOption *option, const QWidget *widget) override; void initToolButtonParameters(bool isDark, const QStyleOption *option, const QWidget *widget) override; void initLineEditParameters(bool isDark, const QStyleOption *option, const QWidget *widget) override; void initSpinBoxParameters(bool isDark, const QStyleOption *option, const QWidget *widget) override; void initComboBoxParameters(bool isDark, const QStyleOption *option, const QWidget *widget) override; + void initListParameters(bool isDark, const QStyleOption *option, const QWidget *widget) override; + void initTreeParameters(bool isDark, const QStyleOption *option, const QWidget *widget) override; + void initTableParameters(bool isDark, const QStyleOption *option, const QWidget *widget) override; + void initCheckBoxParameters(bool isDark, const QStyleOption *option, const QWidget *widget) override; + void initRadioButtonParameters(bool isDark, const QStyleOption *option, const QWidget *widget) override; + void initSliderParameters(bool isDark, const QStyleOption *option, const QWidget *widget) override; + void initProgressBarParameters(bool isDark, const QStyleOption *option, const QWidget *widget) override; + void initScrollBarParameters(bool isDark, const QStyleOption *option, const QWidget *widget) override; + void initToolTipParameters(bool isDark, const QStyleOption *option, const QWidget *widget) override; + void initTabWidgetParameters(bool isDark, const QStyleOption *option, const QWidget *widget) override; + void initMenuParameters(bool isDark, const QStyleOption *option, const QWidget *widget) override; }; @@ -174,14 +209,23 @@ class KClassicalStyleParameters : public KAbstractStyleParameters public: KClassicalStyleParameters(QObject *parent, bool isDark); - QColor radiobutton_default(bool isDark) override; - void initPalette(bool isDark) override; void initPushButtonParameters(bool isDark, const QStyleOption *option, const QWidget *widget) override; void initToolButtonParameters(bool isDark, const QStyleOption *option, const QWidget *widget) override; void initLineEditParameters(bool isDark, const QStyleOption *option, const QWidget *widget) override; void initSpinBoxParameters(bool isDark, const QStyleOption *option, const QWidget *widget) override; void initComboBoxParameters(bool isDark, const QStyleOption *option, const QWidget *widget) override; + void initListParameters(bool isDark, const QStyleOption *option, const QWidget *widget) override; + void initTreeParameters(bool isDark, const QStyleOption *option, const QWidget *widget) override; + void initTableParameters(bool isDark, const QStyleOption *option, const QWidget *widget) override; + void initCheckBoxParameters(bool isDark, const QStyleOption *option, const QWidget *widget) override; + void initRadioButtonParameters(bool isDark, const QStyleOption *option, const QWidget *widget) override; + void initSliderParameters(bool isDark, const QStyleOption *option, const QWidget *widget) override; + void initProgressBarParameters(bool isDark, const QStyleOption *option, const QWidget *widget) override; + void initScrollBarParameters(bool isDark, const QStyleOption *option, const QWidget *widget) override; + void initToolTipParameters(bool isDark, const QStyleOption *option, const QWidget *widget) override; + void initTabWidgetParameters(bool isDark, const QStyleOption *option, const QWidget *widget) override; + void initMenuParameters(bool isDark, const QStyleOption *option, const QWidget *widget) override; }; @@ -190,13 +234,22 @@ class KFashionStyleParameters : public KAbstractStyleParameters public: KFashionStyleParameters(QObject *parent, bool isDark); - QColor radiobutton_default(bool isDark) override; - void initPalette(bool isDark) override; void initPushButtonParameters(bool isDark, const QStyleOption *option, const QWidget *widget) override; void initToolButtonParameters(bool isDark, const QStyleOption *option, const QWidget *widget) override; void initLineEditParameters(bool isDark, const QStyleOption *option, const QWidget *widget) override; void initSpinBoxParameters(bool isDark, const QStyleOption *option, const QWidget *widget) override; void initComboBoxParameters(bool isDark, const QStyleOption *option, const QWidget *widget) override; + void initListParameters(bool isDark, const QStyleOption *option, const QWidget *widget) override; + void initTreeParameters(bool isDark, const QStyleOption *option, const QWidget *widget) override; + void initTableParameters(bool isDark, const QStyleOption *option, const QWidget *widget) override; + void initCheckBoxParameters(bool isDark, const QStyleOption *option, const QWidget *widget) override; + void initRadioButtonParameters(bool isDark, const QStyleOption *option, const QWidget *widget) override; + void initSliderParameters(bool isDark, const QStyleOption *option, const QWidget *widget) override; + void initProgressBarParameters(bool isDark, const QStyleOption *option, const QWidget *widget) override; + void initScrollBarParameters(bool isDark, const QStyleOption *option, const QWidget *widget) override; + void initToolTipParameters(bool isDark, const QStyleOption *option, const QWidget *widget) override; + void initTabWidgetParameters(bool isDark, const QStyleOption *option, const QWidget *widget) override; + void initMenuParameters(bool isDark, const QStyleOption *option, const QWidget *widget) override; }; #endif // KABSTRACTSTYLEPARAMETERS_H diff --git a/ukui-styles/qt5-style-ukui/list-parameters.cpp b/ukui-styles/qt5-style-ukui/list-parameters.cpp new file mode 100644 index 0000000..f63e052 --- /dev/null +++ b/ukui-styles/qt5-style-ukui/list-parameters.cpp @@ -0,0 +1,28 @@ +/* + * Qt5-UKUI's Library + * + * Copyright (C) 2020, Tianjin KYLIN Information Technology 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 "list-parameters.h" + +ListParameters::ListParameters() +{ + +} diff --git a/ukui-styles/qt5-style-ukui/list-parameters.h b/ukui-styles/qt5-style-ukui/list-parameters.h new file mode 100644 index 0000000..fc0c9e4 --- /dev/null +++ b/ukui-styles/qt5-style-ukui/list-parameters.h @@ -0,0 +1,43 @@ +/* + * Qt5-UKUI's Library + * + * Copyright (C) 2020, Tianjin KYLIN Information Technology 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 LISTPARAMETERS_H +#define LISTPARAMETERS_H + +#include + +class ListParameters +{ +public: + ListParameters(); + +//private: + int radius; + + QBrush listDefaultBrush; + QBrush listHoverBrush; + QBrush listSelectBrush; + QBrush listDisableBrush; +}; + +#endif // LISTPARAMETERS_H diff --git a/ukui-styles/qt5-style-ukui/menu-helper.cpp b/ukui-styles/qt5-style-ukui/menu-helper.cpp deleted file mode 100644 index 808fa4d..0000000 --- a/ukui-styles/qt5-style-ukui/menu-helper.cpp +++ /dev/null @@ -1,94 +0,0 @@ -#include -#include -#include - -#include "qt5-ukui-style.h" -#include "ukui-style-settings.h" -#include "black-list.h" -#include "kabstract-style-parameters.h" - - -extern void qt_blurImage(QImage &blurImage, qreal radius, bool quality, int transposed); - -void Qt5UKUIStyle::drawMenuPrimitive(const QStyleOption *option, QPainter *painter, const QWidget *widget) const -{ - int rander = 5; - painter->save(); - painter->setRenderHint(QPainter::Antialiasing); - QPainterPath rectPath; - rectPath.addRoundedRect(option->rect.adjusted(+rander, +rander, -rander, -rander), sp->Menu_Radius, sp->Menu_Radius); - - // Draw a black floor - QPixmap pixmap(option->rect.size()); - pixmap.fill(Qt::transparent); - QPainter pixmapPainter(&pixmap); - pixmapPainter.setRenderHint(QPainter::Antialiasing); - pixmapPainter.setPen(Qt::transparent); - pixmapPainter.setBrush(option->palette.color(QPalette::Active, QPalette::BrightText)); - pixmapPainter.drawPath(rectPath); - pixmapPainter.end(); - - // Blur the black background - QImage img = pixmap.toImage(); - qt_blurImage(img, 4, false, false); - - // Dig out the center part - pixmap = QPixmap::fromImage(img); - QPainter pixmapPainter2(&pixmap); - pixmapPainter2.setRenderHint(QPainter::Antialiasing); - pixmapPainter2.setCompositionMode(QPainter::CompositionMode_Clear); - pixmapPainter2.setPen(Qt::transparent); - pixmapPainter2.setBrush(Qt::transparent); - pixmapPainter2.drawPath(rectPath); - - // Shadow rendering - painter->drawPixmap(option->rect, pixmap, pixmap.rect()); - - //That's when I started drawing the frame floor - QStyleOption opt = *option; - auto color = opt.palette.color(QPalette::Base); - if (UKUIStyleSettings::isSchemaInstalled("org.ukui.style")) { - auto opacity = UKUIStyleSettings::globalInstance()->get("menuTransparency").toInt()/100.0; - color.setAlphaF(opacity); - } - - if (qApp->property("blurEnable").isValid()) { - bool blurEnable = qApp->property("blurEnable").toBool(); - if (!blurEnable) { - color.setAlphaF(1); - } - } - - if (widget) { - if (widget->property("useSystemStyleBlur").isValid() && !widget->property("useSystemStyleBlur").toBool()) { - color.setAlphaF(1); - } - } - - //if blur effect is not supported, do not use transparent color. - if (!KWindowEffects::isEffectAvailable(KWindowEffects::BlurBehind) || blackAppListWithBlurHelper().contains(qAppName())) { - color.setAlphaF(1); - } - - opt.palette.setColor(QPalette::Base, color); - - QPen pen(opt.palette.color(QPalette::Normal, QPalette::Dark), 1); - pen.setCapStyle(Qt::RoundCap); - pen.setJoinStyle(Qt::RoundJoin); - painter->setPen(Qt::transparent); - painter->setBrush(color); - - QPainterPath path; - QRegion region; - if (widget) - region = widget->mask(); - if (region.isEmpty()) - path.addRoundedRect(opt.rect.adjusted(+rander, +rander, -rander,-rander), sp->Menu_Radius, sp->Menu_Radius); - else - path.addRegion(region); - - //painter->drawPolygon(path.toFillPolygon().toPolygon()); - painter->drawPath(path); - painter->restore(); - return; -} diff --git a/ukui-styles/qt5-style-ukui/menu-parameters.cpp b/ukui-styles/qt5-style-ukui/menu-parameters.cpp new file mode 100644 index 0000000..064399a --- /dev/null +++ b/ukui-styles/qt5-style-ukui/menu-parameters.cpp @@ -0,0 +1,29 @@ +/* + * Qt5-UKUI's Library + * + * Copyright (C) 2020, Tianjin KYLIN Information Technology 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 "menu-parameters.h" + +MenuParameters::MenuParameters() +{ + +} diff --git a/ukui-styles/qt5-style-ukui/menu-parameters.h b/ukui-styles/qt5-style-ukui/menu-parameters.h new file mode 100644 index 0000000..c5e775d --- /dev/null +++ b/ukui-styles/qt5-style-ukui/menu-parameters.h @@ -0,0 +1,43 @@ +/* + * Qt5-UKUI's Library + * + * Copyright (C) 2020, Tianjin KYLIN Information Technology 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 MENUPARAMETERS_H +#define MENUPARAMETERS_H + +#include +#include + +class MenuParameters +{ +public: + MenuParameters(); + + int frameRadius; + int itemRadius; + + QBrush menuItemSelectBrush; + + QPixmap menuFramePixmap; +}; + +#endif // MENUPARAMETERS_H diff --git a/ukui-styles/qt5-style-ukui/progressbar-parameters.cpp b/ukui-styles/qt5-style-ukui/progressbar-parameters.cpp new file mode 100644 index 0000000..9f9a3c5 --- /dev/null +++ b/ukui-styles/qt5-style-ukui/progressbar-parameters.cpp @@ -0,0 +1,29 @@ +/* + * Qt5-UKUI's Library + * + * Copyright (C) 2020, Tianjin KYLIN Information Technology 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 "progressbar-parameters.h" + +ProgressBarParameters::ProgressBarParameters() +{ + +} diff --git a/ukui-styles/qt5-style-ukui/progressbar-parameters.h b/ukui-styles/qt5-style-ukui/progressbar-parameters.h new file mode 100644 index 0000000..0673118 --- /dev/null +++ b/ukui-styles/qt5-style-ukui/progressbar-parameters.h @@ -0,0 +1,44 @@ +/* + * Qt5-UKUI's Library + * + * Copyright (C) 2020, Tianjin KYLIN Information Technology 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 PROGRESSBARPARAMETERS_H +#define PROGRESSBARPARAMETERS_H + +#include + +class ProgressBarParameters +{ +public: + ProgressBarParameters(); + +//private: + int radius; + + QBrush progressBarContentBrush; + + QBrush progressBarGrooveDefaultBrush; + QBrush progressBarGrooveDisableBrush; + +}; + +#endif // PROGRESSBARPARAMETERS_H diff --git a/ukui-styles/qt5-style-ukui/qt5-style-ukui.pro b/ukui-styles/qt5-style-ukui/qt5-style-ukui.pro index ec1c739..50f7328 100644 --- a/ukui-styles/qt5-style-ukui/qt5-style-ukui.pro +++ b/ukui-styles/qt5-style-ukui/qt5-style-ukui.pro @@ -30,40 +30,61 @@ DEFINES += QT_MESSAGELOGCONTEXT SOURCES += \ box-animation-helper.cpp \ button-animation-helper.cpp \ + checkbox-parameters.cpp \ combobox-parameters.cpp \ kabstract-style-parameters.cpp \ lineedit-parameters.cpp \ - menu-helper.cpp \ + list-parameters.cpp \ + menu-parameters.cpp \ progressbar-animation-helper.cpp \ progressbar-animation.cpp \ + progressbar-parameters.cpp \ pushbutton-parameters.cpp \ qt5-ukui-style-plugin.cpp \ qt5-ukui-style.cpp \ + radiobutton-parameters.cpp \ + scrollbar-parameters.cpp \ shadow-helper.cpp \ + slider-parameters.cpp \ spinbox-parameters.cpp \ tab-widget-animation-helper.cpp \ scrollbar-animation-helper.cpp \ qt5-ukui-style-helper.cpp \ + table-parameters.cpp \ + tabwidget-parameters.cpp \ toolbutton-parameters.cpp \ + tooltip-parameters.cpp \ + tree-parameters.cpp \ view-helper.cpp HEADERS += \ box-animation-helper.h \ button-animation-helper.h \ + checkbox-parameters.h \ combobox-parameters.h \ kabstract-style-parameters.h \ lineedit-parameters.h \ + list-parameters.h \ + menu-parameters.h \ progressbar-animation-helper.h \ progressbar-animation.h \ + progressbar-parameters.h \ pushbutton-parameters.h \ qt5-ukui-style-plugin.h \ qt5-ukui-style.h \ + radiobutton-parameters.h \ + scrollbar-parameters.h \ shadow-helper.h \ + slider-parameters.h \ spinbox-parameters.h \ tab-widget-animation-helper.h \ scrollbar-animation-helper.h \ qt5-ukui-style-helper.h \ - toolbutton-parameters.h + table-parameters.h \ + tabwidget-parameters.h \ + toolbutton-parameters.h \ + tooltip-parameters.h \ + tree-parameters.h DISTFILES += qt5-style-ukui.json unix { diff --git a/ukui-styles/qt5-style-ukui/qt5-ukui-style.cpp b/ukui-styles/qt5-style-ukui/qt5-ukui-style.cpp index 2fd85e4..74e1dc0 100644 --- a/ukui-styles/qt5-style-ukui/qt5-ukui-style.cpp +++ b/ukui-styles/qt5-style-ukui/qt5-ukui-style.cpp @@ -188,20 +188,32 @@ bool Qt5UKUIStyle::eventFilter(QObject *obj, QEvent *e) return true; } - if (qobject_cast(obj) || qobject_cast(obj)) { - if (e->type() == QEvent::Hide) { +// //button animation cancel temporary +// if (qobject_cast(obj) || qobject_cast(obj)) { +// if (e->type() == QEvent::Hide) { +// if (QWidget *w = qobject_cast(obj)) { +// auto animator = m_button_animation_helper->animator(w); +// if (animator) { +// animator->stopAnimator("SunKen"); +// animator->stopAnimator("MouseOver"); +// animator->setAnimatorCurrentTime("SunKen", 0); +// animator->setAnimatorCurrentTime("MouseOver", 0); +// } +// } +// } +// return false; +// } + + if (qobject_cast(obj)) { + if (e->type() == QEvent::Wheel) { if (QWidget *w = qobject_cast(obj)) { - auto animator = m_button_animation_helper->animator(w); - if (animator) { - animator->stopAnimator("SunKen"); - animator->stopAnimator("MouseOver"); - animator->setAnimatorCurrentTime("SunKen", 0); - animator->setAnimatorCurrentTime("MouseOver", 0); + if (!w->hasFocus()) { + return true; } } } - return false; } + return false; } @@ -388,8 +400,11 @@ QColor Qt5UKUIStyle::highLight_Hover(const QStyleOption *option) const void Qt5UKUIStyle::setThemeColor(QString themeColor, QPalette &palette) const { - if (themeColor == "daybreakBlue") { + if (themeColor == "default") { + } else if (themeColor == "daybreakBlue") { + palette.setColor(QPalette::Active, QPalette::Highlight, QColor(55, 144, 250)); + palette.setColor(QPalette::Inactive, QPalette::Highlight, QColor(55, 144, 250)); } else if (themeColor == "jamPurple") { palette.setColor(QPalette::Active, QPalette::Highlight, QColor(114, 46, 209)); palette.setColor(QPalette::Inactive, QPalette::Highlight, QColor(114, 46, 209)); @@ -461,8 +476,10 @@ void Qt5UKUIStyle::polish(QWidget *widget) */ if(qobject_cast(widget)) { + auto combobx = qobject_cast(widget); m_combobox_animation_helper->registerWidget(widget); m_button_animation_helper->registerWidget(widget); + combobx->view()->viewport()->setAutoFillBackground(false); } if(qobject_cast(widget) || qobject_cast(widget)) @@ -650,20 +667,14 @@ void Qt5UKUIStyle::drawPrimitive(QStyle::PrimitiveElement element, const QStyleO { switch (element) { case QStyle::PE_PanelMenu: - { - if (qobject_cast(widget)) { - painter->save(); - painter->setPen(Qt::NoPen); - painter->setBrush(option->palette.color(QPalette::Active, QPalette::Base).lighter(300)); - painter->setRenderHint(QPainter::Antialiasing, true); - painter->drawRoundedRect(option->rect, sp->Menu_Radius, sp->Menu_Radius); - painter->restore(); - return; - } - } case QStyle::PE_FrameMenu: { - return this->drawMenuPrimitive(option, painter, widget); + sp->initMenuParameters(isUseDarkPalette(), option, widget); + painter->save(); + painter->setRenderHint(QPainter::Antialiasing, true); + painter->drawPixmap(option->rect, sp->menuParameters.menuFramePixmap, sp->menuParameters.menuFramePixmap.rect());; + painter->restore(); + return; } case PE_FrameFocusRect: { if (qobject_cast(widget)) @@ -730,7 +741,7 @@ void Qt5UKUIStyle::drawPrimitive(QStyle::PrimitiveElement element, const QStyleO painter->restore(); return; -// //button animation +// //button animation cancel temporary // if (sunken || on || animator->isRunning("SunKen") || animator->value("SunKen") == 1.0) { // double opacity = animator->value("SunKen").toDouble(); // if (sunken || on) { @@ -828,12 +839,13 @@ void Qt5UKUIStyle::drawPrimitive(QStyle::PrimitiveElement element, const QStyleO case PE_PanelTipLabel://UKUI Tip style: Open ground glass { if (widget && widget->isEnabled()) { + sp->initToolTipParameters(isUseDarkPalette(), option, widget); QStyleOption opt = *option; painter->save(); painter->setRenderHint(QPainter::Antialiasing); QPainterPath rectPath; - rectPath.addRoundedRect(option->rect.adjusted(+3, +3, -3, -3), sp->radius, sp->radius); + rectPath.addRoundedRect(option->rect.adjusted(+3, +3, -3, -3), sp->toolTipParameters.radius, sp->toolTipParameters.radius); // Draw a black floor QPixmap pixmap(option->rect.size()); @@ -862,7 +874,7 @@ void Qt5UKUIStyle::drawPrimitive(QStyle::PrimitiveElement element, const QStyleO painter->drawPixmap(option->rect, pixmap, pixmap.rect()); //This is the beginning of drawing the bottom of the prompt box - auto color = opt.palette.color(QPalette::ToolTipBase); + auto color = sp->toolTipParameters.toolTipBackgroundBrush.color(); if (UKUIStyleSettings::isSchemaInstalled("org.ukui.style")) { auto opacity = UKUIStyleSettings::globalInstance()->get("menuTransparency").toInt()/100.0; color.setAlphaF(opacity); @@ -891,7 +903,7 @@ void Qt5UKUIStyle::drawPrimitive(QStyle::PrimitiveElement element, const QStyleO QPainterPath path; auto region = widget->mask(); if (region.isEmpty()) { - path.addRoundedRect(opt.rect.adjusted(+3, +3, -3, -3), sp->radius, sp->radius); + path.addRoundedRect(opt.rect.adjusted(+3, +3, -3, -3), sp->toolTipParameters.radius, sp->toolTipParameters.radius); } else { path.addRegion(region); } @@ -1082,7 +1094,7 @@ void Qt5UKUIStyle::drawPrimitive(QStyle::PrimitiveElement element, const QStyleO if (const QStyleOptionTabBarBase *tbb = qstyleoption_cast(option)) { painter->save(); painter->setPen(Qt::NoPen); - painter->setBrush(tbb->palette.brush(QPalette::Active, QPalette::Window)); + painter->setBrush(sp->tabWidgetParameters.tabBarBackgroundBrush); painter->drawRect(tbb->tabBarRect); painter->restore(); return; @@ -1092,10 +1104,11 @@ void Qt5UKUIStyle::drawPrimitive(QStyle::PrimitiveElement element, const QStyleO case PE_FrameTabWidget: { if (const QStyleOptionTabWidgetFrame *twf = qstyleoption_cast(option)) { + sp->initTabWidgetParameters(isUseDarkPalette(), option, widget); painter->save(); painter->setPen(Qt::NoPen); - painter->setBrush(twf->palette.brush(QPalette::Active, QPalette::Base)); - painter->drawRect(option->rect); + painter->setBrush(sp->tabWidgetParameters.tabWidgetBackgroundBrush); + painter->drawRect(twf->rect); painter->restore(); return; } @@ -1119,13 +1132,19 @@ void Qt5UKUIStyle::drawPrimitive(QStyle::PrimitiveElement element, const QStyleO case PE_PanelLineEdit://UKUI Text edit style { if (widget) { - if (QAction *clearAction = widget->findChild(QLatin1String("_q_qlineeditclearaction"))) { + if (widget->findChild()) { QStyleOption subOption = *option; - QColor color = subOption.palette.color(QPalette::Text); - color.setAlphaF(1.0); - subOption.palette.setColor(QPalette::Text, color); - clearAction->setIcon(QIcon(HighLightEffect::ordinaryGeneratePixmap(clearAction->icon().pixmap(16, 16), &subOption, widget, HighLightEffect::BothDefaultAndHighlit))); + for (QAction *act : widget->findChildren()) { + act->setIcon(QIcon(HighLightEffect::ordinaryGeneratePixmap(act->icon().pixmap(16, 16), &subOption, widget, HighLightEffect::BothDefaultAndHighlit))); + } } +// if (QAction *clearAction = widget->findChild(QLatin1String("_q_qlineeditclearaction"))) { +// QStyleOption subOption = *option; +// QColor color = subOption.palette.color(QPalette::Text); +// color.setAlphaF(1.0); +// subOption.palette.setColor(QPalette::Text, color); +// clearAction->setIcon(QIcon(HighLightEffect::ordinaryGeneratePixmap(clearAction->icon().pixmap(16, 16), &subOption, widget, HighLightEffect::BothDefaultAndHighlit))); +// } } // Conflict with qspinbox and so on, The widget text cannot use this style @@ -1283,59 +1302,56 @@ void Qt5UKUIStyle::drawPrimitive(QStyle::PrimitiveElement element, const QStyleO if (const QStyleOptionButton* radiobutton = qstyleoption_cast(option)) { QRectF rect = radiobutton->rect.adjusted(1, 1, -1, -1); - const bool useDarkPalette = this->isUseDarkPalette(); bool enable = radiobutton->state & State_Enabled; bool mouseOver = radiobutton->state & State_MouseOver; bool sunKen = radiobutton->state & State_Sunken; - bool On = radiobutton->state & State_On; + bool on = radiobutton->state & State_On; painter->save(); painter->setRenderHint(QPainter::Antialiasing, true); - if (On) { - if (enable) { + if (enable) { + if (on) { if (sunKen) { - painter->setPen(Qt::NoPen); - painter->setBrush(highLight_Click(option)); + painter->setPen(sp->radioButtonParameters.radioButtonOnClickPen); + painter->setBrush(sp->radioButtonParameters.radioButtonOnClickBrush); } else if (mouseOver) { - painter->setPen(Qt::NoPen); - painter->setBrush(highLight_Hover(option)); + painter->setPen(sp->radioButtonParameters.radioButtonOnHoverPen); + painter->setBrush(sp->radioButtonParameters.radioButtonOnHoverBrush); } else { - painter->setPen(Qt::NoPen); - painter->setBrush(radiobutton->palette.brush(QPalette::Active, QPalette::Highlight)); + painter->setPen(sp->radioButtonParameters.radioButtonOnDefaultPen); + painter->setBrush(sp->radioButtonParameters.radioButtonOnDefaultBrush); } painter->drawEllipse(rect); - QRectF childRect(rect.x(), rect.y(), sp->RadioButton_OnLength, sp->RadioButton_OnLength); + + QRectF childRect(rect.x(), rect.y(), (rect.width() / 2) - 2, (rect.height() / 2) - 2); childRect.moveCenter(rect.center()); painter->setPen(Qt::NoPen); painter->setBrush(radiobutton->palette.brush(QPalette::Active, QPalette::HighlightedText)); painter->drawEllipse(childRect); } else { - painter->setPen(Qt::NoPen); - painter->setBrush(radiobutton->palette.brush(QPalette::Disabled, QPalette::Button)); + if (sunKen) { + painter->setPen(sp->radioButtonParameters.radioButtonClickPen); + painter->setBrush(sp->radioButtonParameters.radioButtonClickBrush); + } else if (mouseOver) { + painter->setPen(sp->radioButtonParameters.radioButtonHoverPen); + painter->setBrush(sp->radioButtonParameters.radioButtonHoverBrush); + } else { + painter->setPen(sp->radioButtonParameters.radioButtonDefaultPen); + painter->setBrush(sp->radioButtonParameters.radioButtonDefaultBrush); + } painter->drawEllipse(rect); - QRectF childRect(rect.x(), rect.y(), sp->RadioButton_OnLength, sp->RadioButton_OnLength); + } + } else { + painter->setPen(sp->radioButtonParameters.radioButtonDisablePen); + painter->setBrush(sp->radioButtonParameters.radioButtonDisableBrush); + painter->drawEllipse(rect); + + if (on) { + QRectF childRect(rect.x(), rect.y(), (rect.width() / 2) - 2, (rect.height() / 2) - 2); childRect.moveCenter(rect.center()); painter->setBrush(radiobutton->palette.brush(QPalette::Disabled, QPalette::ButtonText)); painter->drawEllipse(childRect); } - } else { - if (enable) { - if (sunKen) { - painter->setPen(useDarkPalette ? option->palette.color(QPalette::Disabled, QPalette::Mid) - : option->palette.color(QPalette::Active, QPalette::Mid)); - painter->setBrush(button_Click(option)); - } else if (mouseOver) { - painter->setPen(sp->radiobutton_default(useDarkPalette)); - painter->setBrush(option->palette.brush(QPalette::Active, QPalette::Button)); - } else { - painter->setPen(sp->radiobutton_default(useDarkPalette)); - painter->setBrush(option->palette.brush(QPalette::Active, QPalette::Button)); - } - } else { - painter->setPen(Qt::NoPen); - painter->setBrush(option->palette.brush(QPalette::Disabled, QPalette::Button)); - } - painter->drawEllipse(rect); } painter->restore(); return; @@ -1346,7 +1362,7 @@ void Qt5UKUIStyle::drawPrimitive(QStyle::PrimitiveElement element, const QStyleO case PE_IndicatorCheckBox: { if (const QStyleOptionButton *checkbox = qstyleoption_cast(option)) { - const bool useDarkPalette = this->isUseDarkPalette(); + sp->initCheckBoxParameters(isUseDarkPalette(), option, widget); bool enable = checkbox->state & State_Enabled; bool mouseOver = checkbox->state & State_MouseOver; bool sunKen = checkbox->state & State_Sunken; @@ -1373,39 +1389,40 @@ void Qt5UKUIStyle::drawPrimitive(QStyle::PrimitiveElement element, const QStyleO if (enable) { if (on | noChange) { if (sunKen) { - painter->setPen(Qt::NoPen); - painter->setBrush(highLight_Click(option)); + painter->setPen(sp->checkBoxParameters.checkBoxOnClickPen); + painter->setBrush(sp->checkBoxParameters.checkBoxOnClickBrush); } else if (mouseOver) { - painter->setPen(Qt::NoPen); - painter->setBrush(highLight_Hover(option)); + painter->setPen(sp->checkBoxParameters.checkBoxOnHoverPen); + painter->setBrush(sp->checkBoxParameters.checkBoxOnHoverBrush); } else { - painter->setPen(Qt::NoPen); - painter->setBrush(checkbox->palette.brush(QPalette::Active, QPalette::Highlight)); + painter->setPen(sp->checkBoxParameters.checkBoxOnDefaultPen); + painter->setBrush(sp->checkBoxParameters.checkBoxOnDefaultBrush); } - painter->drawRoundedRect(rect, sp->CheckBox_Radius, sp->CheckBox_Radius); + painter->drawRoundedRect(rect, sp->checkBoxParameters.radius, sp->checkBoxParameters.radius); + //draw path painter->setPen(QPen(checkbox->palette.brush(QPalette::Active, QPalette::HighlightedText), 2, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin)); painter->setBrush(Qt::NoBrush); painter->drawPath(path); } else { if (sunKen) { - painter->setPen(useDarkPalette ? option->palette.color(QPalette::Disabled, QPalette::Mid) - : option->palette.color(QPalette::Active, QPalette::Mid)); - painter->setBrush(button_Click(option)); + painter->setPen(sp->checkBoxParameters.checkBoxClickPen); + painter->setBrush(sp->checkBoxParameters.checkBoxClickBrush); } else if (mouseOver) { - painter->setPen(sp->radiobutton_default(useDarkPalette)); - painter->setBrush(checkbox->palette.brush(QPalette::Active, QPalette::Base)); + painter->setPen(sp->checkBoxParameters.checkBoxHoverPen); + painter->setBrush(sp->checkBoxParameters.checkBoxHoverBrush); } else { - painter->setPen(sp->radiobutton_default(useDarkPalette)); - painter->setBrush(checkbox->palette.brush(QPalette::Active, QPalette::Base)); + painter->setPen(sp->checkBoxParameters.checkBoxDefaultPen); + painter->setBrush(sp->checkBoxParameters.checkBoxDefaultBrush); } - painter->drawRoundedRect(rect, sp->CheckBox_Radius, sp->CheckBox_Radius); + painter->drawRoundedRect(rect, sp->checkBoxParameters.radius, sp->checkBoxParameters.radius); } } else { - painter->setPen(sp->radiobutton_default(useDarkPalette)); - painter->setBrush(checkbox->palette.brush(QPalette::Disabled, QPalette::Base)); - painter->drawRoundedRect(rect, sp->CheckBox_Radius, sp->CheckBox_Radius); + painter->setPen(sp->checkBoxParameters.checkBoxDisablePen); + painter->setBrush(sp->checkBoxParameters.checkBoxDisableBrush); + painter->drawRoundedRect(rect, sp->checkBoxParameters.radius, sp->checkBoxParameters.radius); + if (on | noChange) { painter->setPen(QPen(checkbox->palette.brush(QPalette::Disabled, QPalette::ButtonText), 2, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin)); @@ -1456,32 +1473,34 @@ void Qt5UKUIStyle::drawPrimitive(QStyle::PrimitiveElement element, const QStyleO int Radius = sp->radius; bool isTree = false; - if (qobject_cast(widget)) + + if (qobject_cast(widget) || qobject_cast(widget)) { isTree = true; + } else if(qobject_cast(widget) || qobject_cast(widget)){ + Radius = sp->listParameters.radius; + } else if(qobject_cast(widget) || qobject_cast(widget)){ + Radius = sp->tableParameters.radius; + } + else { + Radius = 0; + } + if (isTree) { if (proxy()->styleHint(QStyle::SH_ItemView_ShowDecorationSelected, option, widget)) { - painter->save(); - painter->setPen(Qt::NoPen); - if (vi->state & State_Selected) { - painter->setBrush(vi->palette.brush(QPalette::Active, QPalette::Highlight)); - painter->drawRect(vi->rect); - } else if (vi->state & State_Sunken) { - painter->setBrush(highLight_Click(option)); - painter->drawRect(vi->rect); - } else if (vi->state & State_MouseOver) { -// painter->setBrush(highLight_Hover(option)); - painter->setBrush(vi->palette.brush(QPalette::Disabled, QPalette::Midlight)); - painter->drawRect(vi->rect); - } else if (vi->features & QStyleOptionViewItem::Alternate) { + if (vi->features & QStyleOptionViewItem::Alternate) { + painter->save(); + painter->setPen(Qt::NoPen); painter->setBrush(vi->palette.brush(cg, QPalette::AlternateBase)); painter->drawRect(vi->rect); + painter->restore(); } - painter->restore(); } } else if (vi->features & QStyleOptionViewItem::Alternate) { + painter->save(); painter->setPen(Qt::NoPen); painter->setBrush(vi->palette.brush(cg, QPalette::AlternateBase)); painter->drawRoundedRect(vi->rect, Radius, Radius); + painter->restore(); } return; } @@ -1495,19 +1514,99 @@ void Qt5UKUIStyle::drawPrimitive(QStyle::PrimitiveElement element, const QStyleO const bool enable = vi->state & State_Enabled; const bool select = vi->state & State_Selected; const bool hover = vi->state & State_MouseOver; - const bool sunken = vi->state & State_Sunken; - int iconMode_Radius = sp->radius; - if (!enable) - return; + QBrush defaultBrush; + QBrush hoverBrush; + QBrush selectBrush; + QBrush disableBrush; + QPainterPath path; + + if (qobject_cast(widget) || qobject_cast(widget)) { + sp->initTreeParameters(isUseDarkPalette(), option, widget); + + defaultBrush = sp->treeParameters.treeDefaultBrush; + hoverBrush = sp->treeParameters.treeHoverBrush; + selectBrush = sp->treeParameters.treeSelectBrush; + disableBrush = sp->treeParameters.treeDisableBrush; + + if (vi->viewItemPosition == QStyleOptionViewItem::Beginning) { + if(vi->rect.left() == 0) { + QRect rect = vi->rect.adjusted(0, 0, 1, 1); + path.moveTo(rect.left(), rect.top() + sp->treeParameters.radius); + path.arcTo(rect.left(), rect.top(), 2 * sp->treeParameters.radius, 2 * sp->treeParameters.radius, 180, -90); + path.lineTo(rect.right(), rect.top()); + path.lineTo(rect.right(), rect.bottom()); + path.lineTo(rect.left() + sp->treeParameters.radius, rect.bottom()); + path.arcTo(rect.left(), rect.bottom() - 2 * sp->treeParameters.radius, 2 * sp->treeParameters.radius, 2 * sp->treeParameters.radius, -90, -90); + path.lineTo(rect.left(), rect.top() + sp->treeParameters.radius); + } else { + path.addRect(vi->rect); + } + } else if (vi->viewItemPosition == QStyleOptionViewItem::Middle) { + path.addRect(option->rect); + } else if (vi->viewItemPosition == QStyleOptionViewItem::End) { + QRect rect = vi->rect.adjusted(0, 0, 1, 1); + path.moveTo(rect.left(), rect.top()); + path.lineTo(rect.right() - sp->treeParameters.radius, rect.top()); + path.arcTo(rect.right() - 2 * sp->treeParameters.radius, rect.top(), 2 * sp->treeParameters.radius, 2 * sp->treeParameters.radius, 90, -90); + path.lineTo(rect.right(), rect.bottom() - 2 * sp->treeParameters.radius); + path.arcTo(rect.right() - 2 * sp->treeParameters.radius, rect.bottom() - 2 * sp->treeParameters.radius, + 2 * sp->treeParameters.radius, 2 * sp->treeParameters.radius, 0, -90); + path.lineTo(rect.left(), rect.bottom()); + path.lineTo(rect.left(), rect.top()); + } else if (vi->viewItemPosition == QStyleOptionViewItem::OnlyOne) { + if(vi->rect.left() == 0) { + path.addRoundedRect(vi->rect, sp->treeParameters.radius, sp->treeParameters.radius); + } else { + QRect rect = vi->rect.adjusted(0, 0, 1, 1); + path.moveTo(rect.left(), rect.top()); + path.lineTo(rect.right() - sp->treeParameters.radius, rect.top()); + path.arcTo(rect.right() - 2 * sp->treeParameters.radius, rect.top(), 2 * sp->treeParameters.radius, 2 * sp->treeParameters.radius, 90, -90); + path.lineTo(rect.right(), rect.bottom() - 2 * sp->treeParameters.radius); + path.arcTo(rect.right() - 2 * sp->treeParameters.radius, rect.bottom() - 2 * sp->treeParameters.radius, + 2 * sp->treeParameters.radius, 2 * sp->treeParameters.radius, 0, -90); + path.lineTo(rect.left(), rect.bottom()); + path.lineTo(rect.left(), rect.top()); + } + } else { + path.addRect(vi->rect); + } + } else if(qobject_cast(widget) || qobject_cast(widget)){ + sp->initListParameters(isUseDarkPalette(), option, widget); + + defaultBrush = sp->listParameters.listDefaultBrush; + hoverBrush = sp->listParameters.listHoverBrush; + selectBrush = sp->listParameters.listSelectBrush; + disableBrush = sp->listParameters.listDisableBrush; + path.addRoundedRect(vi->rect, sp->listParameters.radius, sp->listParameters.radius); + } else if(qobject_cast(widget) || qobject_cast(widget)){ + sp->initTableParameters(isUseDarkPalette(), option, widget); + + defaultBrush = sp->tableParameters.tableDefaultBrush; + hoverBrush = sp->tableParameters.tableHoverBrush; + selectBrush = sp->tableParameters.tableSelectBrush; + disableBrush = sp->tableParameters.tableDisableBrush; + path.addRoundedRect(vi->rect, sp->tableParameters.radius, sp->tableParameters.radius); + } + else { + path.addRect(vi->rect); + defaultBrush = QBrush(Qt::transparent); + hoverBrush = option->palette.brush(QPalette::Disabled, QPalette::Midlight); + selectBrush = option->palette.brush(QPalette::Active, QPalette::Highlight); + disableBrush = QBrush(Qt::transparent); + } if ((vi->decorationPosition == QStyleOptionViewItem::Top) || (vi->decorationPosition == QStyleOptionViewItem::Bottom)) isIconMode = true; - QRect iconRect = proxy()->subElementRect(SE_ItemViewItemDecoration, option, widget); - QRect textRect = proxy()->subElementRect(SE_ItemViewItemText, option, widget); - if (isIconMode) { + QRect iconRect = proxy()->subElementRect(SE_ItemViewItemDecoration, option, widget); + QRect textRect = proxy()->subElementRect(SE_ItemViewItemText, option, widget); + int iconMode_Radius = sp->radius; + + if (!enable) + return; + if (select) { int Margin_Height = 2; const int Margin = proxy()->pixelMetric(QStyle::PM_FocusFrameHMargin, option, widget); @@ -1544,10 +1643,7 @@ void Qt5UKUIStyle::drawPrimitive(QStyle::PrimitiveElement element, const QStyleO } else { painter->save(); painter->setPen(Qt::NoPen); - if (sunken) { - painter->setBrush(button_Click(option)); - painter->drawRoundedRect(option->rect, iconMode_Radius, iconMode_Radius); - } else if (hover) { + if (hover) { painter->setBrush(button_Hover(option)); painter->drawRoundedRect(option->rect, iconMode_Radius, iconMode_Radius); } @@ -1560,30 +1656,19 @@ void Qt5UKUIStyle::drawPrimitive(QStyle::PrimitiveElement element, const QStyleO painter->fillRect(vi->rect, vi->backgroundBrush); painter->setBrushOrigin(oldBO); } + painter->save(); painter->setPen(Qt::NoPen); - QPainterPath path; - if (qobject_cast(widget) || qobject_cast(widget)) { - path.addRect(vi->rect); - } else if(qobject_cast(widget) || qobject_cast(widget)){ - path.addRoundedRect(vi->rect, sp->radius, sp->radius); - } else if(qobject_cast(widget) || qobject_cast(widget)){ - path.addRoundedRect(vi->rect, sp->radius, sp->radius); - } - else { - path.addRect(vi->rect); - } - - if (select) { - painter->setBrush(vi->palette.brush(QPalette::Active, QPalette::Highlight)); - painter->drawPath(path); - } else if (sunken) { - painter->setBrush(highLight_Click(option)); - painter->drawPath(path); + if (!enable) { + painter->setBrush(disableBrush); + } else if (select) { + painter->setBrush(selectBrush); } else if (hover) { - painter->setBrush(vi->palette.brush(QPalette::Disabled, QPalette::Midlight)); - painter->drawPath(path); + painter->setBrush(hoverBrush); + } else { + painter->setBrush(defaultBrush); } + painter->drawPath(path); painter->restore(); } if (vi->state & State_HasFocus) { @@ -1600,30 +1685,42 @@ void Qt5UKUIStyle::drawPrimitive(QStyle::PrimitiveElement element, const QStyleO bool isHover = option->state & State_MouseOver; bool isSelected = option->state & State_Selected; bool enable = option->state & State_Enabled; - QColor color = option->palette.color(enable? QPalette::Active: QPalette::Disabled, - QPalette::Highlight); + QBrush brush; - QColor color2 = option->palette.color(enable? QPalette::Active: QPalette::Disabled, - QPalette::HighlightedText); + sp->initTreeParameters(isUseDarkPalette(), option, widget); - if (isSelected || isHover) { - if (isHover && !isSelected) { - color = option->palette.color(QPalette::Disabled, QPalette::Midlight); - } - painter->fillRect(option->rect, color); - auto vopt = qstyleoption_cast(option); - QStyleOptionViewItem tmp = *vopt; - - // for now the style paint arrow with highlight text brush when hover - // we but don't want to highligh the indicator when hover a view item. - if (isHover) { - tmp.state &= ~QStyle::State_MouseOver; - } - - tmp.palette.setColor(tmp.palette.currentColorGroup(), QPalette::Highlight, color2); - return Style::drawPrimitive(PE_IndicatorBranch, &tmp, painter, widget); + if (!enable) { + brush = sp->treeParameters.treeBranchDisableBrush; + } else if (isSelected) { + brush = sp->treeParameters.treeBranchSelectBrush; + } else if (isHover) { + brush = sp->treeParameters.treeBranchHoverBrush; + } else { + brush = sp->treeParameters.treeBranchDefaultBrush; } - break; + + QPainterPath path; + if (option->rect.left() == 0) { + //raund radius at beginning + QRect rect = option->rect.adjusted(0, 0, 1, 1); + path.moveTo(rect.left(), rect.top() + sp->treeParameters.radius); + path.arcTo(rect.left(), rect.top(), 2 * sp->treeParameters.radius, 2 * sp->treeParameters.radius, 180, -90); + path.lineTo(rect.right(), rect.top()); + path.lineTo(rect.right(), rect.bottom()); + path.lineTo(rect.left() + sp->treeParameters.radius, rect.bottom()); + path.arcTo(rect.left(), rect.bottom() - 2 * sp->treeParameters.radius, 2 * sp->treeParameters.radius, 2 * sp->treeParameters.radius, -90, -90); + path.lineTo(rect.left(), rect.top() + sp->treeParameters.radius); + } else { + path.addRect(option->rect); + } + + painter->save(); + painter->setPen(Qt::NoPen); + painter->setBrush(brush); + painter->drawPath(path); + painter->restore(); + return Style::drawPrimitive(PE_IndicatorBranch, option, painter, widget); + } // if (!(option->state & State_Children)) { @@ -1642,7 +1739,8 @@ void Qt5UKUIStyle::drawPrimitive(QStyle::PrimitiveElement element, const QStyleO // proxy()->drawPrimitive(reverse ? PE_IndicatorArrowLeft : PE_IndicatorArrowRight, &subOption, painter, widget); // } // return; - } + } break; + case PE_IndicatorViewItemCheck: return proxy()->drawPrimitive(PE_IndicatorCheckBox, option, painter, widget); @@ -1676,13 +1774,18 @@ void Qt5UKUIStyle::drawComplexControl(QStyle::ComplexControl control, const QSty switch (control) { case CC_ScrollBar: { if (const QStyleOptionSlider *bar = qstyleoption_cast(option)) { + sp->initScrollBarParameters(isUseDarkPalette(), option, widget); if (widget && widget->property("drawScrollBarGroove").isValid() && (!widget->property("drawScrollBarGroove").toBool())) { } else { const bool active = bar->state & State_Active; painter->save(); painter->setPen(Qt::NoPen); - painter->setBrush(bar->palette.brush(active ? QPalette::Active : QPalette::Inactive, QPalette::Base)); + if (active) { + painter->setBrush(sp->scrollBarParameters.scrollBarGrooveDefaultBrush); + } else { + painter->setBrush(sp->scrollBarParameters.scrollBarGrooveInactiveBrush); + } painter->drawRect(bar->rect); painter->restore(); } @@ -1700,15 +1803,15 @@ void Qt5UKUIStyle::drawComplexControl(QStyle::ComplexControl control, const QSty case CC_Slider: { if (const QStyleOptionSlider *slider = qstyleoption_cast(option)) { + sp->initSliderParameters(isUseDarkPalette(), option, widget); QRect groove = proxy()->subControlRect(CC_Slider, option, SC_SliderGroove, widget); QRect handle = proxy()->subControlRect(CC_Slider, option, SC_SliderHandle, widget); const bool horizontal = slider->orientation == Qt::Horizontal; const bool enable = slider->state & State_Enabled; const bool hover = slider->state & State_MouseOver; const bool suken = slider->state & State_Sunken; - QColor sColor = slider->palette.color(QPalette::Active, QPalette::Highlight); - QColor gColor = slider->palette.color(QPalette::Active, QPalette::Button); if (slider->subControls & SC_SliderGroove) { + QBrush sBrush, gBrush; QRect sRect, gRect; if (horizontal) { if (slider->upsideDown) { @@ -1727,12 +1830,24 @@ void Qt5UKUIStyle::drawComplexControl(QStyle::ComplexControl control, const QSty gRect.setRect(groove.x(), handle.center().y(), groove.width(), groove.height() - handle.center().y()); } } + + if (!enable) { + sBrush = sp->sliderParameters.sliderGrooveValueDisableBrush; + gBrush = sp->sliderParameters.sliderGrooveUnvalueDisableBrush; + } else if (hover) { + sBrush = sp->sliderParameters.sliderGrooveValueHoverBrush; + gBrush = sp->sliderParameters.sliderGrooveUnvalueHoverBrush; + } else { + sBrush = sp->sliderParameters.sliderGrooveValueDefaultBrush; + gBrush = sp->sliderParameters.sliderGrooveUnvalueDefaultBrush; + } + painter->save(); painter->setPen(Qt::NoPen); painter->setRenderHint(QPainter::Antialiasing, true); - painter->setBrush(sColor); + painter->setBrush(sBrush); painter->drawRoundedRect(sRect, 2, 2); - painter->setBrush(gColor); + painter->setBrush(gBrush); painter->drawRoundedRect(gRect, 2, 2); painter->restore(); } @@ -1770,19 +1885,26 @@ void Qt5UKUIStyle::drawComplexControl(QStyle::ComplexControl control, const QSty } if (slider->subControls & SC_SliderHandle) { - QColor hColor = slider->palette.color(QPalette::Active, QPalette::Highlight); + //we need to reinit our brush because it has QGradient without use option rect + QStyleOptionSlider handleOption = *slider; + handleOption.rect = handle; + sp->initSliderParameters(isUseDarkPalette(), &handleOption, widget); + + QBrush hBrush; if (!enable) { - hColor = slider->palette.color(QPalette::Disabled, QPalette::ButtonText); + hBrush = sp->sliderParameters.sliderHandleDisableBrush; } else if (suken) { - hColor = highLight_Click(option); + hBrush = sp->sliderParameters.sliderHandleClickBrush; } else if (hover) { - hColor = highLight_Hover(option); + hBrush = sp->sliderParameters.sliderHandleHoverBrush; + } else { + hBrush = sp->sliderParameters.sliderHandleDefaultBrush; } painter->save(); painter->setRenderHint(QPainter::Antialiasing, true); painter->setPen(Qt::NoPen); - painter->setBrush(hColor); + painter->setBrush(hBrush); painter->drawEllipse(handle); painter->restore(); } @@ -1912,13 +2034,14 @@ void Qt5UKUIStyle::drawComplexControl(QStyle::ComplexControl control, const QSty if (sb->subControls & (SC_SpinBoxUp | SC_SpinBoxDown)) { if (sb->stepEnabled & QAbstractSpinBox::StepUpEnabled) { QPainterPath upPath; - upPath.moveTo(upRect.left(), upRect.top() + sp->radius); - upPath.arcTo(upRect.left(), upRect.top(), sp->radius * 2, sp->radius * 2, 180, -90); - upPath.lineTo(upRect.right() - sp->radius, upRect.top()); - upPath.arcTo(upRect.right() + 1 - 2 * sp->radius, upRect.top(), sp->radius * 2, sp->radius * 2, 90, -90); + upPath.moveTo(upRect.left(), upRect.top() + sp->spinBoxParameters.radius); + upPath.arcTo(upRect.left(), upRect.top(), sp->spinBoxParameters.radius * 2, sp->spinBoxParameters.radius * 2, 180, -90); + upPath.lineTo(upRect.right() - sp->spinBoxParameters.radius, upRect.top()); + upPath.arcTo(upRect.right() + 1 - 2 * sp->spinBoxParameters.radius, upRect.top(), sp->spinBoxParameters.radius * 2, + sp->spinBoxParameters.radius * 2, 90, -90); upPath.lineTo(upRect.right() + 1, upRect.bottom()); upPath.lineTo(upRect.left(), upRect.bottom()); - upPath.lineTo(upRect.left(), upRect.top() - sp->radius); + upPath.lineTo(upRect.left(), upRect.top() - sp->spinBoxParameters.radius); upOption.state |= State_Enabled; if (up && enable) { painter->setBrush(this->highLight_Hover(option)); @@ -1935,13 +2058,15 @@ void Qt5UKUIStyle::drawComplexControl(QStyle::ComplexControl control, const QSty if (sb->stepEnabled & QAbstractSpinBox::StepDownEnabled) { QPainterPath downPath; - downPath.moveTo(downRect.left(), downRect.bottom() - sp->radius); - downPath.arcTo(downRect.left(), downRect.bottom() - sp->radius * 2, sp->radius * 2, sp->radius * 2, 180, 90); - downPath.lineTo(downRect.right() - sp->radius, downRect.bottom()); - downPath.arcTo(downRect.right() + 1 - sp->radius * 2, downRect.bottom() - sp->radius * 2, sp->radius * 2, sp->radius * 2, 270, 90); + downPath.moveTo(downRect.left(), downRect.bottom() - sp->spinBoxParameters.radius); + downPath.arcTo(downRect.left(), downRect.bottom() - sp->spinBoxParameters.radius * 2, sp->spinBoxParameters.radius * 2, + sp->spinBoxParameters.radius * 2, 180, 90); + downPath.lineTo(downRect.right() - sp->spinBoxParameters.radius, downRect.bottom()); + downPath.arcTo(downRect.right() + 1 - sp->spinBoxParameters.radius * 2, downRect.bottom() - sp->spinBoxParameters.radius * 2, + sp->spinBoxParameters.radius * 2, sp->spinBoxParameters.radius * 2, 270, 90); downPath.lineTo(downRect.right() + 1, downRect.top()); downPath.lineTo(downRect.left(), downRect.top()); - downPath.lineTo(downRect.left(), downRect.bottom() - sp->radius); + downPath.lineTo(downRect.left(), downRect.bottom() - sp->spinBoxParameters.radius); downOption.state |= State_Enabled; if (down && enable) { painter->setBrush(this->highLight_Hover(option)); @@ -2141,57 +2266,74 @@ void Qt5UKUIStyle::drawControl(QStyle::ControlElement element, const QStyleOptio const bool mouseOver = bar->state & State_MouseOver; const bool horizontal = (bar->orientation == Qt::Horizontal); QRect rect = bar->rect; + QRectF drawRect; painter->save(); painter->setPen(Qt::NoPen); painter->setRenderHint(QPainter::Antialiasing, true); - animator->setAnimatorDirectionForward("slider_opacity", mouseOver); + //width animation animator->setAnimatorDirectionForward("groove_width", mouseOver); if (mouseOver) { - if (!animator->isRunning("slider_opacity") && animator->currentAnimatorTime("slider_opacity") == 0) { - animator->startAnimator("slider_opacity"); - } if (!animator->isRunning("groove_width") && animator->currentAnimatorTime("groove_width") == 0) { animator->startAnimator("groove_width"); } } else { - if (!animator->isRunning("slider_opacity") && animator->currentAnimatorTime("slider_opacity") > 0) { - animator->startAnimator("slider_opacity"); - } if (!animator->isRunning("groove_width") && animator->currentAnimatorTime("groove_width") > 0) { animator->startAnimator("groove_width"); } } - - if (sunKen) { - if (animator->currentAnimatorTime("additional_opacity") == 0) { - animator->setAnimatorDirectionForward("additional_opacity", sunKen); - animator->startAnimator("additional_opacity"); - } - } else { - if (animator->currentAnimatorTime("additional_opacity") > 0) { - animator->setAnimatorDirectionForward("additional_opacity", sunKen); - animator->startAnimator("additional_opacity"); - } - } - - QRectF drawRect; qreal len = animator->value("groove_width").toReal() * 4 + 4; - qreal m_opacity = animator->value("slider_opacity").toReal(); - qreal s_opacity = animator->value("additional_opacity").toReal(); - if (horizontal) { drawRect.setRect(rect.x(), rect.y() + (rect.height() - len) / 2, rect.width(), len); } else { drawRect.setRect(rect.x() + (rect.width() - len) / 2, rect.y(), len, rect.height()); } - painter->setBrush(mixColor(bar->palette.color(QPalette::Active, QPalette::Button), - bar->palette.color(QPalette::Active, QPalette::WindowText), m_opacity + s_opacity)); +// //hover color animation +// animator->setAnimatorDirectionForward("slider_opacity", mouseOver); +// if (mouseOver) { +// if (!animator->isRunning("slider_opacity") && animator->currentAnimatorTime("slider_opacity") == 0) { +// animator->startAnimator("slider_opacity"); +// } +// } else { +// if (!animator->isRunning("slider_opacity") && animator->currentAnimatorTime("slider_opacity") > 0) { +// animator->startAnimator("slider_opacity"); +// } +// } +// qreal m_opacity = animator->value("slider_opacity").toReal(); + +// //click color animation +// animator->setAnimatorDirectionForward("additional_opacity", sunKen); +// if (sunKen) { +// if (animator->currentAnimatorTime("additional_opacity") == 0) { +// animator->startAnimator("additional_opacity"); +// } +// } else { +// if (animator->currentAnimatorTime("additional_opacity") > 0) { +// animator->startAnimator("additional_opacity"); +// } +// } +// qreal s_opacity = animator->value("additional_opacity").toReal(); +// if (isUseDarkPalette()) { +// painter->setBrush(mixColor(sp->scrollBarParameters.scrollBarSliderDefaultBrush.color(), +// bar->palette.color(QPalette::Active, QPalette::WindowText), m_opacity + (0.1 - s_opacity))); +// } else { +// painter->setBrush(mixColor(sp->scrollBarParameters.scrollBarSliderDefaultBrush.color(), +// bar->palette.color(QPalette::Active, QPalette::WindowText), m_opacity + s_opacity)); +// } + + if (!enable) - painter->setBrush(bar->palette.brush(QPalette::Disabled, QPalette::Button)); - painter->drawRoundedRect(drawRect, len / 2, len / 2); + painter->setBrush(sp->scrollBarParameters.scrollBarSliderDisableBrush); + else if (sunKen) { + painter->setBrush(sp->scrollBarParameters.scrollBarSliderClickBrush); + } else if (mouseOver) { + painter->setBrush(sp->scrollBarParameters.scrollBarSliderHoverBrush); + } else { + painter->setBrush(sp->scrollBarParameters.scrollBarSliderDefaultBrush); + } + painter->drawRoundedRect(drawRect, sp->scrollBarParameters.radius, sp->scrollBarParameters.radius); painter->restore(); return; } @@ -2548,6 +2690,7 @@ void Qt5UKUIStyle::drawControl(QStyle::ControlElement element, const QStyleOptio case CE_TabBarTabShape: { if (const QStyleOptionTab *tab = qstyleoption_cast(option)) { + sp->initTabWidgetParameters(isUseDarkPalette(), option, widget); bool selected = tab->state & State_Selected; bool hover = tab->state & State_MouseOver; QRect drawRect = option->rect; @@ -2607,18 +2750,10 @@ void Qt5UKUIStyle::drawControl(QStyle::ControlElement element, const QStyleOptio // bool onlyOne = tab->position == QStyleOptionTab::OnlyOneTab; int tabOverlap = proxy()->pixelMetric(PM_TabBarTabOverlap, option, widget); + int TabBarTab_Radius = sp->tabWidgetParameters.radius; + QPainterPath path; if (selected) { -// if (fisttab || onlyOne) { -// drawRect.adjust(0, 0, tabOverlap, 0); -// } else if (lastTab) { -// drawRect.adjust(-tabOverlap, 0, 0, 0); -// } else { -// drawRect.adjust(-tabOverlap, 0, tabOverlap, 0); -// } drawRect.adjust(0, 0, tabOverlap, 0); - - int TabBarTab_Radius = sp->radius; - QPainterPath path; path.moveTo(drawRect.left() + TabBarTab_Radius, drawRect.top()); path.arcTo(QRect(drawRect.left(), drawRect.top(), TabBarTab_Radius * 2, TabBarTab_Radius * 2), 90, 90); path.lineTo(drawRect.left(), drawRect.bottom() - TabBarTab_Radius); @@ -2631,19 +2766,7 @@ void Qt5UKUIStyle::drawControl(QStyle::ControlElement element, const QStyleOptio path.arcTo(QRect(drawRect.right() - TabBarTab_Radius * 2, drawRect.top(), TabBarTab_Radius * 2, TabBarTab_Radius * 2), 0, 90); path.lineTo(drawRect.left() + TabBarTab_Radius, drawRect.top()); - - painter->setBrush(tab->palette.brush(QPalette::Active, QPalette::Base)); - painter->drawPath(path); } else { - if (hover) { - QColor hover_color = option->palette.color(QPalette::Active, QPalette::Window); - QColor mix = option->palette.color(QPalette::Active, QPalette::BrightText); - - painter->setBrush(mixColor(hover_color, mix, 0.1)); - } else { - painter->setBrush(tab->palette.brush(QPalette::Active, QPalette::Window)); - } - if (widget != NULL && qobject_cast(widget)) { const auto *tabbar = qobject_cast(widget); int select_index = tabbar->currentIndex(); @@ -2651,9 +2774,6 @@ void Qt5UKUIStyle::drawControl(QStyle::ControlElement element, const QStyleOptio if (select_index - now_index == 1) { //select rect left drawRect.adjust(0, 0, tabOverlap, 0); - - QPainterPath path; - int TabBarTab_Radius = 6; path.moveTo(drawRect.left(), drawRect.top()); path.lineTo(drawRect.left(), drawRect.bottom()); path.lineTo(drawRect.right() - TabBarTab_Radius, drawRect.bottom()); @@ -2663,15 +2783,9 @@ void Qt5UKUIStyle::drawControl(QStyle::ControlElement element, const QStyleOptio path.arcTo(QRect(drawRect.right(), drawRect.top(), TabBarTab_Radius * 2, TabBarTab_Radius * 2), 180, -90); path.lineTo(drawRect.left(), drawRect.top()); - - painter->drawPath(path); - } else if(select_index - now_index == -1) { //select rect right drawRect.adjust(0, 0, tabOverlap, 0); - - QPainterPath path; - int TabBarTab_Radius = 6; path.moveTo(drawRect.right(), drawRect.bottom()); path.lineTo(drawRect.right(), drawRect.top()); path.lineTo(drawRect.left() - TabBarTab_Radius, drawRect.top()); @@ -2680,16 +2794,22 @@ void Qt5UKUIStyle::drawControl(QStyle::ControlElement element, const QStyleOptio path.arcTo(QRect(drawRect.left(), drawRect.bottom() - TabBarTab_Radius * 2, TabBarTab_Radius * 2, TabBarTab_Radius * 2), 180, 90); path.lineTo(drawRect.right(), drawRect.bottom()); - - painter->drawPath(path); } else { - painter->drawRect(drawRect); + path.addRect(drawRect); } } else { - painter->drawRect(drawRect); + path.addRect(drawRect); } } + if (selected) { + painter->setBrush(sp->tabWidgetParameters.tabBarSelectBrush); + } else if (hover) { + painter->setBrush(sp->tabWidgetParameters.tabBarHoverBrush); + } else { + painter->setBrush(sp->tabWidgetParameters.tabBarDefaultBrush); + } + painter->drawPath(path); painter->restore(); return; } @@ -2815,6 +2935,7 @@ void Qt5UKUIStyle::drawControl(QStyle::ControlElement element, const QStyleOptio case CE_RadioButton: { if (const QStyleOptionButton *button = qstyleoption_cast(option)) { + sp->initRadioButtonParameters(isUseDarkPalette(), option, widget); QStyleOptionButton subopt = *button; subopt.rect = proxy()->subElementRect(SE_RadioButtonIndicator, option, widget); proxy()->drawPrimitive(PE_IndicatorRadioButton, &subopt, painter, widget); @@ -2936,6 +3057,7 @@ void Qt5UKUIStyle::drawControl(QStyle::ControlElement element, const QStyleOptio if (menuItem->menuItemType == QStyleOptionMenuItem::EmptyArea) { return; } + sp->initMenuParameters(isUseDarkPalette(), option, widget); QRect drawRect = menuItem->rect; if (menuItem->menuItemType == QStyleOptionMenuItem::Separator) { @@ -2949,19 +3071,10 @@ void Qt5UKUIStyle::drawControl(QStyle::ControlElement element, const QStyleOptio return; } - const bool hover(menuItem->state & State_MouseOver); const bool sunken(menuItem->state & State_Sunken); const bool selected(menuItem->state & State_Selected); const bool layout(menuItem->direction == Qt::LeftToRight); bool isComboBox = qobject_cast(widget); - //if it's combobox popup, then repaint backgroud by base color - if (enable && isComboBox) { - painter->save(); - painter->setPen(Qt::NoPen); - painter->setBrush(menuItem->palette.color(QPalette::Active, QPalette::Base).lighter(300)); - painter->drawRect(drawRect); - painter->restore(); - } //if it's comobobox popup, set combobox popup size rect if (isComboBox) { @@ -2969,12 +3082,12 @@ void Qt5UKUIStyle::drawControl(QStyle::ControlElement element, const QStyleOptio drawRect.adjust(MenuItem_HMargin, 0, -MenuItem_HMargin, 0); } - if (enable && (selected | hover | sunken)) { + if (enable && (selected | sunken)) { painter->save(); painter->setRenderHint(QPainter::Antialiasing); painter->setPen(Qt::NoPen); - painter->setBrush(menuItem->palette.brush(QPalette::Active, QPalette::Highlight)); - painter->drawRoundedRect(drawRect, sp->MenuItem_Radius, sp->MenuItem_Radius); + painter->setBrush(sp->menuParameters.menuItemSelectBrush); + painter->drawRoundedRect(drawRect, sp->menuParameters.itemRadius, sp->menuParameters.itemRadius); painter->restore(); } int MenuItem_Spacing = 8; @@ -2994,7 +3107,7 @@ void Qt5UKUIStyle::drawControl(QStyle::ControlElement element, const QStyleOptio // radioOption.rect = proxy()->subElementRect(SE_RadioButtonIndicator, &radioOption, widget); // proxy()->drawPrimitive(PE_IndicatorRadioButton, &radioOption, painter, widget); int iconWidth = proxy()->pixelMetric(PM_SmallIconSize, option, widget); - QIcon icon = QIcon::fromTheme("dialog-ok"); + QIcon icon = QIcon::fromTheme("object-select-symbolic"); QIcon::Mode mode = enable ? QIcon::Active : QIcon::Disabled; QPixmap pixmap = icon.pixmap(iconWidth, iconWidth, mode , QIcon::On); QPixmap drawPixmap = HighLightEffect::bothOrdinaryAndHoverGeneratePixmap(pixmap, option, widget); @@ -3010,7 +3123,7 @@ void Qt5UKUIStyle::drawControl(QStyle::ControlElement element, const QStyleOptio } else if (menuItem->checkType == QStyleOptionMenuItem::NonExclusive) { if (checked) { int iconWidth = proxy()->pixelMetric(PM_SmallIconSize, option, widget); - QIcon icon = QIcon::fromTheme("dialog-ok"); + QIcon icon = QIcon::fromTheme("object-select-symbolic"); QIcon::Mode mode = enable ? (selected ? QIcon::Active : QIcon::Normal) : QIcon::Disabled; QPixmap pixmap = icon.pixmap(iconWidth, iconWidth, mode , QIcon::On); QPixmap drawPixmap = HighLightEffect::bothOrdinaryAndHoverGeneratePixmap(pixmap, option, widget); @@ -3074,7 +3187,7 @@ void Qt5UKUIStyle::drawControl(QStyle::ControlElement element, const QStyleOptio QString text = menuItem->text; painter->save(); if (enable) { - if (selected | hover | sunken) { + if (selected | sunken) { painter->setPen(menuItem->palette.color(QPalette::Active, QPalette::HighlightedText)); } else { painter->setPen(menuItem->palette.color(QPalette::Active, QPalette::Text)); @@ -3219,11 +3332,16 @@ void Qt5UKUIStyle::drawControl(QStyle::ControlElement element, const QStyleOptio case CE_ProgressBarGroove: { + sp->initProgressBarParameters(isUseDarkPalette(), option, widget); const bool enable = option->state & State_Enabled; painter->save(); painter->setPen(Qt::NoPen); - painter->setBrush(option->palette.brush(enable ? QPalette::Active : QPalette::Disabled, QPalette::Button)); - painter->drawRoundedRect(option->rect, sp->radius, sp->radius); + if (!enable) { + painter->setBrush(sp->progressBarParameters.progressBarGrooveDisableBrush); + } else { + painter->setBrush(sp->progressBarParameters.progressBarGrooveDefaultBrush); + } + painter->drawRoundedRect(option->rect, sp->progressBarParameters.radius, sp->progressBarParameters.radius); painter->restore(); return; } @@ -3231,76 +3349,13 @@ void Qt5UKUIStyle::drawControl(QStyle::ControlElement element, const QStyleOptio case CE_ProgressBarContents: { if (const QStyleOptionProgressBar *pb = qstyleoption_cast(option)) { - const auto progress = qMax(pb->progress, pb->minimum); // workaround for bug in QProgressBar - - const bool vertical = pb->orientation == Qt::Vertical; - const bool inverted = pb->invertedAppearance; - const bool indeterminate = (pb->minimum == 0 && pb->maximum == 0); - - QRect rect = pb->rect; - int maxWidth = vertical ? pb->rect.height() : pb->rect.width(); - const auto totalSteps = qMax(Q_INT64_C(1), qint64(pb->maximum) - pb->minimum); - const auto progressSteps = qint64(progress) - pb->minimum; - const auto progressBarWidth = progressSteps * maxWidth / totalSteps; - int len = indeterminate ? maxWidth : progressBarWidth; - - bool reverse = (!vertical && (pb->direction == Qt::RightToLeft)) || vertical; - if (inverted) - reverse = !reverse; - - QColor startColor = option->palette.color(QPalette::Active, QPalette::Highlight); - QColor endColor = option->palette.color(QPalette::Active, QPalette::Highlight).lighter(120); - QLinearGradient linearGradient; - linearGradient.setColorAt(0, startColor); - linearGradient.setColorAt(1, endColor); - QRect progressRect; - int diff = 0; - if (indeterminate) { - len = 56; - double currentValue = 0; - if (QVariantAnimation *animation = m_animation_helper->animation(option->styleObject)) { - currentValue = animation->currentValue().toDouble(); - if (animation->currentTime() == 0) { - animation->setDirection(QAbstractAnimation::Forward); - animation->start(); - } else if (animation->currentTime() == animation->totalDuration()) { - animation->setDirection(QAbstractAnimation::Backward); - animation->start(); - } - } else { - m_animation_helper->startAnimation(new ProgressBarAnimation(option->styleObject)); - } - diff = currentValue * (maxWidth - len); - } else { - m_animation_helper->stopAnimation(option->styleObject); - } - if (vertical) { - if (reverse) { - progressRect.setRect(rect.left(), rect.bottom() + 1 - len - diff, rect.width(), len); - linearGradient.setStart(progressRect.bottomLeft()); - linearGradient.setFinalStop(progressRect.topLeft()); - } else { - progressRect.setRect(rect.x(), rect.top() + diff, rect.width(), len); - linearGradient.setStart(progressRect.topLeft()); - linearGradient.setFinalStop(progressRect.bottomLeft()); - } - } else { - if (reverse) { - progressRect.setRect(rect.right() + 1 - len - diff, rect.top(), len, rect.height()); - linearGradient.setStart(progressRect.topRight()); - linearGradient.setFinalStop(progressRect.topLeft()); - } else { - progressRect.setRect(rect.x() + diff, rect.y(), len, rect.height()); - linearGradient.setStart(progressRect.topLeft()); - linearGradient.setFinalStop(progressRect.topRight()); - } - } + sp->initProgressBarParameters(isUseDarkPalette(), pb, widget); painter->save(); painter->setPen(Qt::NoPen); - painter->setBrush(linearGradient); + painter->setBrush(sp->progressBarParameters.progressBarContentBrush); painter->setRenderHint(QPainter::Antialiasing, true); - painter->drawRoundedRect(progressRect, sp->radius, sp->radius); + painter->drawRoundedRect(pb->rect, sp->progressBarParameters.radius, sp->progressBarParameters.radius); painter->restore(); return; } @@ -3479,6 +3534,7 @@ void Qt5UKUIStyle::drawControl(QStyle::ControlElement element, const QStyleOptio QStyleOptionButton option; option.rect = checkRect; option.state = vi->state & ~QStyle::State_HasFocus; + option.palette = vi->palette; switch (vi->checkState) { case Qt::Unchecked: @@ -3498,19 +3554,12 @@ void Qt5UKUIStyle::drawControl(QStyle::ControlElement element, const QStyleOptio QIcon::Mode mode = QIcon::Normal; if (!(vi->state & QStyle::State_Enabled)) mode = QIcon::Disabled; - else if (vi->state & QStyle::State_Selected) - mode = QIcon::Selected; +// else if (vi->state & QStyle::State_Selected) +// mode = QIcon::Selected; QIcon::State state = vi->state & QStyle::State_Open ? QIcon::On : QIcon::Off; QPixmap pixmap = vi->icon.pixmap(vi->decorationSize, mode, state); - QStyleOptionViewItem tmp = *vi; - //listitem state of MouseOver use color gray.so icon shouldn't use highlight effect.Except table wight and table list - if((vi->state & QStyle::State_MouseOver) && !(vi->state & QStyle::State_Selected) && - (!qobject_cast(widget)) && (!qobject_cast(widget))) { - tmp.state &= ~QStyle::State_MouseOver; - } - - QStyle::drawItemPixmap(painter, iconRect, tmp.decorationAlignment, HighLightEffect::generatePixmap(pixmap, &tmp, widget)); + QStyle::drawItemPixmap(painter, iconRect, vi->decorationAlignment, HighLightEffect::generatePixmap(pixmap, vi, widget)); } if (!vi->text.isEmpty()) { @@ -4339,17 +4388,70 @@ QRect Qt5UKUIStyle::subElementRect(SubElement element, const QStyleOption *optio } case SE_ProgressBarGroove: - case SE_ProgressBarContents: case SE_ProgressBarLabel: { if (const QStyleOptionProgressBar *pb = qstyleoption_cast(option)) { - //QT progressbar default minimun thick is 25.We need to cut it first. - int thick = (25 - sp->ProgressBar_DefaultThick)/2; - if (pb->orientation == Qt::Vertical) { - return option->rect.adjusted(thick, 0, -thick, 0); + return pb->rect; + } + break; + } + + case SE_ProgressBarContents: + { + if (const QStyleOptionProgressBar *pb = qstyleoption_cast(option)) { + const auto progress = qMax(pb->progress, pb->minimum); // workaround for bug in QProgressBar + const bool vertical = pb->orientation == Qt::Vertical; + const bool inverted = pb->invertedAppearance; + const bool indeterminate = (pb->minimum == 0 && pb->maximum == 0); + + int maxWidth = vertical ? pb->rect.height() : pb->rect.width(); + const auto totalSteps = qMax(Q_INT64_C(1), qint64(pb->maximum) - pb->minimum); + const auto progressSteps = qint64(progress) - pb->minimum; + const auto progressBarWidth = progressSteps * maxWidth / totalSteps; + int len = indeterminate ? maxWidth : progressBarWidth; + + bool reverse = (!vertical && (pb->direction == Qt::RightToLeft)) || vertical; + if (inverted) + reverse = !reverse; + + int diff = 0; + if (indeterminate) { + len = 56; + double currentValue = 0; + if (QVariantAnimation *animation = m_animation_helper->animation(option->styleObject)) { + currentValue = animation->currentValue().toDouble(); + if (animation->currentTime() == 0) { + animation->setDirection(QAbstractAnimation::Forward); + animation->start(); + } else if (animation->currentTime() == animation->totalDuration()) { + animation->setDirection(QAbstractAnimation::Backward); + animation->start(); + } + } else { + m_animation_helper->startAnimation(new ProgressBarAnimation(option->styleObject)); + } + diff = currentValue * (maxWidth - len); } else { - return option->rect.adjusted(0, thick, 0, -thick); + m_animation_helper->stopAnimation(option->styleObject); } + + QRect rect = proxy()->subElementRect(SE_ProgressBarGroove, pb, widget); + QRect progressRect; + if (vertical) { + if (reverse) { + progressRect.setRect(rect.left(), rect.bottom() + 1 - len - diff, rect.width(), len); + } else { + progressRect.setRect(rect.x(), rect.top() + diff, rect.width(), len); + } + } else { + if (reverse) { + progressRect.setRect(rect.right() + 1 - len - diff, rect.top(), len, rect.height()); + } else { + progressRect.setRect(rect.x() + diff, rect.y(), len, rect.height()); + } + } + + return progressRect; } break; } @@ -4666,11 +4768,11 @@ QSize Qt5UKUIStyle::sizeFromContents(ContentsType ct, const QStyleOption *option { if (const QStyleOptionProgressBar *pb = qstyleoption_cast(option)) { if (pb->orientation == Qt::Vertical) { - newSize.setWidth(newSize.width() - 8); + newSize.setWidth(qMax(newSize.width() - 8, sp->ProgressBar_DefaultThick)); newSize.setHeight(qMax(newSize.height(), sp->ProgressBar_DefaultLength)); } else { - newSize.setHeight(newSize.height() - 8); newSize.setWidth(qMax(newSize.width(), sp->ProgressBar_DefaultLength)); + newSize.setHeight(qMax(newSize.height() - 8, sp->ProgressBar_DefaultThick)); } return newSize; } @@ -4754,7 +4856,7 @@ QSize Qt5UKUIStyle::sizeFromContents(ContentsType ct, const QStyleOption *option break; } - return QFusionStyle::sizeFromContents(ct, option, size, widget);; + return QFusionStyle::sizeFromContents(ct, option, size, widget); } diff --git a/ukui-styles/qt5-style-ukui/qt5-ukui-style.h b/ukui-styles/qt5-style-ukui/qt5-ukui-style.h index 039874a..bd82a16 100644 --- a/ukui-styles/qt5-style-ukui/qt5-ukui-style.h +++ b/ukui-styles/qt5-style-ukui/qt5-ukui-style.h @@ -154,9 +154,6 @@ private: void setThemeColor(QString themeColor, QPalette &palette) const; - // menu - void drawMenuPrimitive(const QStyleOption *option, QPainter *painter, const QWidget *widget) const; - // view QString calculateElidedText(const QString &text, const QTextOption &textOption, const QFont &font, const QRect &textRect, const Qt::Alignment valign, diff --git a/ukui-styles/qt5-style-ukui/radiobutton-parameters.cpp b/ukui-styles/qt5-style-ukui/radiobutton-parameters.cpp new file mode 100644 index 0000000..7fbdbf5 --- /dev/null +++ b/ukui-styles/qt5-style-ukui/radiobutton-parameters.cpp @@ -0,0 +1,28 @@ +/* + * Qt5-UKUI's Library + * + * Copyright (C) 2020, Tianjin KYLIN Information Technology 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 "radiobutton-parameters.h" + +RadioButtonParameters::RadioButtonParameters() +{ + +} diff --git a/ukui-styles/qt5-style-ukui/radiobutton-parameters.h b/ukui-styles/qt5-style-ukui/radiobutton-parameters.h new file mode 100644 index 0000000..acdaeab --- /dev/null +++ b/ukui-styles/qt5-style-ukui/radiobutton-parameters.h @@ -0,0 +1,54 @@ +/* + * Qt5-UKUI's Library + * + * Copyright (C) 2020, Tianjin KYLIN Information Technology 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 RADIOBUTTONPARAMETERS_H +#define RADIOBUTTONPARAMETERS_H + +#include +#include + +class RadioButtonParameters +{ +public: + RadioButtonParameters(); + +//private: + int radius; + + QBrush radioButtonDefaultBrush; + QBrush radioButtonHoverBrush; + QBrush radioButtonClickBrush; + QBrush radioButtonDisableBrush; + QBrush radioButtonOnDefaultBrush; + QBrush radioButtonOnHoverBrush; + QBrush radioButtonOnClickBrush; + + QPen radioButtonDefaultPen; + QPen radioButtonHoverPen; + QPen radioButtonClickPen; + QPen radioButtonDisablePen; + QPen radioButtonOnDefaultPen; + QPen radioButtonOnHoverPen; + QPen radioButtonOnClickPen; +}; + +#endif // RADIOBUTTONPARAMETERS_H diff --git a/ukui-styles/qt5-style-ukui/scrollbar-parameters.cpp b/ukui-styles/qt5-style-ukui/scrollbar-parameters.cpp new file mode 100644 index 0000000..9362d8e --- /dev/null +++ b/ukui-styles/qt5-style-ukui/scrollbar-parameters.cpp @@ -0,0 +1,29 @@ +/* + * Qt5-UKUI's Library + * + * Copyright (C) 2020, Tianjin KYLIN Information Technology 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 "scrollbar-parameters.h" + +ScrollBarParameters::ScrollBarParameters() +{ + +} diff --git a/ukui-styles/qt5-style-ukui/scrollbar-parameters.h b/ukui-styles/qt5-style-ukui/scrollbar-parameters.h new file mode 100644 index 0000000..f12fb8d --- /dev/null +++ b/ukui-styles/qt5-style-ukui/scrollbar-parameters.h @@ -0,0 +1,46 @@ +/* + * Qt5-UKUI's Library + * + * Copyright (C) 2020, Tianjin KYLIN Information Technology 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 SCROLLBARPARAMETERS_H +#define SCROLLBARPARAMETERS_H + +#include + +class ScrollBarParameters +{ +public: + ScrollBarParameters(); + +//private: + int radius; + QBrush scrollBarGrooveDefaultBrush; + QBrush scrollBarGrooveInactiveBrush; + + QBrush scrollBarSliderDefaultBrush; + QBrush scrollBarSliderHoverBrush; + QBrush scrollBarSliderClickBrush; + QBrush scrollBarSliderDisableBrush; + +}; + +#endif // SCROLLBARPARAMETERS_H diff --git a/ukui-styles/qt5-style-ukui/slider-parameters.cpp b/ukui-styles/qt5-style-ukui/slider-parameters.cpp new file mode 100644 index 0000000..75aca89 --- /dev/null +++ b/ukui-styles/qt5-style-ukui/slider-parameters.cpp @@ -0,0 +1,29 @@ +/* + * Qt5-UKUI's Library + * + * Copyright (C) 2020, Tianjin KYLIN Information Technology 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 "slider-parameters.h" + +SliderParameters::SliderParameters() +{ + +} diff --git a/ukui-styles/qt5-style-ukui/slider-parameters.h b/ukui-styles/qt5-style-ukui/slider-parameters.h new file mode 100644 index 0000000..5f2959f --- /dev/null +++ b/ukui-styles/qt5-style-ukui/slider-parameters.h @@ -0,0 +1,50 @@ +/* + * Qt5-UKUI's Library + * + * Copyright (C) 2020, Tianjin KYLIN Information Technology 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 SLIDERPARAMETERS_H +#define SLIDERPARAMETERS_H + +#include + +class SliderParameters +{ +public: + SliderParameters(); + +//private: +// int radius; + QBrush sliderHandleDefaultBrush; + QBrush sliderHandleHoverBrush; + QBrush sliderHandleClickBrush; + QBrush sliderHandleDisableBrush; + + QBrush sliderGrooveValueDefaultBrush; + QBrush sliderGrooveValueHoverBrush; + QBrush sliderGrooveValueDisableBrush; + + QBrush sliderGrooveUnvalueDefaultBrush; + QBrush sliderGrooveUnvalueHoverBrush; + QBrush sliderGrooveUnvalueDisableBrush; +}; + +#endif // SLIDERPARAMETERS_H diff --git a/ukui-styles/qt5-style-ukui/table-parameters.cpp b/ukui-styles/qt5-style-ukui/table-parameters.cpp new file mode 100644 index 0000000..ce5e3c3 --- /dev/null +++ b/ukui-styles/qt5-style-ukui/table-parameters.cpp @@ -0,0 +1,28 @@ +/* + * Qt5-UKUI's Library + * + * Copyright (C) 2020, Tianjin KYLIN Information Technology 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 "table-parameters.h" + +TableParameters::TableParameters() +{ + +} diff --git a/ukui-styles/qt5-style-ukui/table-parameters.h b/ukui-styles/qt5-style-ukui/table-parameters.h new file mode 100644 index 0000000..c20c707 --- /dev/null +++ b/ukui-styles/qt5-style-ukui/table-parameters.h @@ -0,0 +1,43 @@ +/* + * Qt5-UKUI's Library + * + * Copyright (C) 2020, Tianjin KYLIN Information Technology 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 TABLEPARAMETERS_H +#define TABLEPARAMETERS_H + +#include + + +class TableParameters +{ +public: + TableParameters(); + +//private: + int radius; + + QBrush tableDefaultBrush; + QBrush tableHoverBrush; + QBrush tableSelectBrush; + QBrush tableDisableBrush; +}; + +#endif // TABLEPARAMETERS_H diff --git a/ukui-styles/qt5-style-ukui/tabwidget-parameters.cpp b/ukui-styles/qt5-style-ukui/tabwidget-parameters.cpp new file mode 100644 index 0000000..ee368a5 --- /dev/null +++ b/ukui-styles/qt5-style-ukui/tabwidget-parameters.cpp @@ -0,0 +1,29 @@ +/* + * Qt5-UKUI's Library + * + * Copyright (C) 2020, Tianjin KYLIN Information Technology 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 "tabwidget-parameters.h" + +TabWidgetParameters::TabWidgetParameters() +{ + +} diff --git a/ukui-styles/qt5-style-ukui/tabwidget-parameters.h b/ukui-styles/qt5-style-ukui/tabwidget-parameters.h new file mode 100644 index 0000000..4d7bb67 --- /dev/null +++ b/ukui-styles/qt5-style-ukui/tabwidget-parameters.h @@ -0,0 +1,46 @@ +/* + * Qt5-UKUI's Library + * + * Copyright (C) 2020, Tianjin KYLIN Information Technology 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 TABWIDGETPARAMETERS_H +#define TABWIDGETPARAMETERS_H + +#include + +class TabWidgetParameters +{ +public: + TabWidgetParameters(); + +//private: + int radius; + + QBrush tabWidgetBackgroundBrush; + QBrush tabBarBackgroundBrush; + QBrush tabBarDefaultBrush; + QBrush tabBarHoverBrush; + QBrush tabBarSelectBrush; + + +}; + +#endif // TABWIDGETPARAMETERS_H diff --git a/ukui-styles/qt5-style-ukui/tooltip-parameters.cpp b/ukui-styles/qt5-style-ukui/tooltip-parameters.cpp new file mode 100644 index 0000000..264f25e --- /dev/null +++ b/ukui-styles/qt5-style-ukui/tooltip-parameters.cpp @@ -0,0 +1,29 @@ +/* + * Qt5-UKUI's Library + * + * Copyright (C) 2020, Tianjin KYLIN Information Technology 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 "tooltip-parameters.h" + +ToolTipParameters::ToolTipParameters() +{ + +} diff --git a/ukui-styles/qt5-style-ukui/tooltip-parameters.h b/ukui-styles/qt5-style-ukui/tooltip-parameters.h new file mode 100644 index 0000000..c43c79b --- /dev/null +++ b/ukui-styles/qt5-style-ukui/tooltip-parameters.h @@ -0,0 +1,40 @@ +/* + * Qt5-UKUI's Library + * + * Copyright (C) 2020, Tianjin KYLIN Information Technology 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 TOOLTIPPARAMETERS_H +#define TOOLTIPPARAMETERS_H + +#include + +class ToolTipParameters +{ +public: + ToolTipParameters(); + +//private: + int radius; + + QBrush toolTipBackgroundBrush; +}; + +#endif // TOOLTIPPARAMETERS_H diff --git a/ukui-styles/qt5-style-ukui/tree-parameters.cpp b/ukui-styles/qt5-style-ukui/tree-parameters.cpp new file mode 100644 index 0000000..16ee3dd --- /dev/null +++ b/ukui-styles/qt5-style-ukui/tree-parameters.cpp @@ -0,0 +1,28 @@ +/* + * Qt5-UKUI's Library + * + * Copyright (C) 2020, Tianjin KYLIN Information Technology 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 "tree-parameters.h" + +TreeParameters::TreeParameters() +{ + +} diff --git a/ukui-styles/qt5-style-ukui/tree-parameters.h b/ukui-styles/qt5-style-ukui/tree-parameters.h new file mode 100644 index 0000000..ce3595f --- /dev/null +++ b/ukui-styles/qt5-style-ukui/tree-parameters.h @@ -0,0 +1,48 @@ +/* + * Qt5-UKUI's Library + * + * Copyright (C) 2020, Tianjin KYLIN Information Technology 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 TREEPARAMETERS_H +#define TREEPARAMETERS_H + +#include + +class TreeParameters +{ +public: + TreeParameters(); + +//private: + int radius; + + QBrush treeDefaultBrush; + QBrush treeHoverBrush; + QBrush treeSelectBrush; + QBrush treeDisableBrush; + + QBrush treeBranchDefaultBrush; + QBrush treeBranchHoverBrush; + QBrush treeBranchSelectBrush; + QBrush treeBranchDisableBrush; + +}; + +#endif // TREEPARAMETERS_H