diff --git a/debian/changelog b/debian/changelog index c6b22b0..6634394 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,23 @@ +qt5-ukui-platformtheme (4.1.0.0-0k9) nile; urgency=medium + + * 改动: + BUG号:无 + 需求号:无 + 其他改动:补充对外获取主题控件默认颜色相关的接口 + 影响域:无 + + -- tanjing Thu, 26 Oct 2023 09:47:22 +0800 + +qt5-ukui-platformtheme (4.1.0.0-0k8) nile; urgency=medium + + * 改动: + BUG号:无 + 需求号:无 + 其他改动:gsettings添加圆角,响应gsettings设置任意色为高亮色 + 影响域:无 + + -- tanjing Mon, 23 Oct 2023 17:08:58 +0800 + qt5-ukui-platformtheme (4.1.0.0-0k7) nile; urgency=medium * 改动: diff --git a/debian/patches/0008-commit-2c7dbff6-fixbug145709.patch b/debian/patches/0008-commit-2c7dbff6-fixbug145709.patch new file mode 100644 index 0000000..432e95d --- /dev/null +++ b/debian/patches/0008-commit-2c7dbff6-fixbug145709.patch @@ -0,0 +1,6655 @@ +From: tanjing +Date: Wed, 25 Oct 2023 11:36:02 +0800 +Subject: =?utf-8?b?Y29tbWl0IzJjN2RiZmY2IGZpeGJ1ZzE0NTcwOSDmlofku7blr7nor50=?= + =?utf-8?b?5qGG5Yid5aeL5YyW5pe25Lya6Lez6L2s6Lev5b6E5LyY5YyW?= + +--- + libqt5-ukui-style/settings/black-list.h | 12 + + .../settings/org.ukui.style.gschema.xml | 7 +- + qt5-ukui-platformtheme/qt5-ukui-platformtheme.pro | 4 +- + .../translations/qt5-ukui-platformtheme_zh_CN.ts | 297 +- + .../translations/qt5-ukui-platformtheme_zh_HK.ts | 258 ++ + .../widget/filedialog/kyfiledialog.cpp | 133 +- + .../widget/filedialog/kyfiledialog.h | 12 +- + ukui-qml-style-helper/kystylehelper.h | 78 +- + ukui-styles/blur-helper.cpp | 4 +- + .../qt5-config-style-ukui/config-shadow-helper.cpp | 8 +- + .../themeconfig/classical.json | 2 +- + .../qt5-config-style-ukui/themeconfig/default.json | 2 +- + .../qt5-config-style-ukui/themeconfig/fashion.json | 2 +- + .../ukui-config-style-parameters.cpp | 331 +- + .../ukui-config-style-parameters.h | 2 +- + .../qt5-config-style-ukui/ukui-config-style.cpp | 172 +- + .../qt5-config-style-ukui/ukui-config-style.h | 2 +- + .../qt5-style-ukui/kabstract-style-parameters.cpp | 3953 -------------------- + .../qt5-style-ukui/kabstract-style-parameters.h | 311 -- + ukui-styles/qt5-style-ukui/qt5-ukui-style.cpp | 55 +- + .../themeconfig/style-ukui-classical.json | 2 +- + ukui-styles/qt5-style-ukui/ukui-style-parameters.h | 2 +- + ukui-styles/readconfig.cpp | 2 +- + ukui-styles/themeinformation.h | 2 +- + ukui-styles/ukui-style-plugin.cpp | 42 +- + ukui-styles/window-manager.cpp | 5 + + 26 files changed, 1100 insertions(+), 4600 deletions(-) + create mode 100644 qt5-ukui-platformtheme/translations/qt5-ukui-platformtheme_zh_HK.ts + delete mode 100644 ukui-styles/qt5-style-ukui/kabstract-style-parameters.cpp + delete mode 100644 ukui-styles/qt5-style-ukui/kabstract-style-parameters.h + +diff --git a/libqt5-ukui-style/settings/black-list.h b/libqt5-ukui-style/settings/black-list.h +index a1a8825..e3166b1 100644 +--- a/libqt5-ukui-style/settings/black-list.h ++++ b/libqt5-ukui-style/settings/black-list.h +@@ -106,4 +106,16 @@ static const QStringList focusStateActiveList() { + return l; + } + ++static const QStringList windowManageBlackList() { ++ QStringList l; ++ l << "iflyime-spe-sym"; ++ l << "iflyime-qimpanel"; ++ l << "iflyime-setw"; ++ l << "iflyime-sett"; ++ l << "iflyime-qim"; ++ l << "iflyime-hw"; ++ l << "SpecificSymbol"; ++ return l; ++} ++ + #endif // BLACKLIST_H +diff --git a/libqt5-ukui-style/settings/org.ukui.style.gschema.xml b/libqt5-ukui-style/settings/org.ukui.style.gschema.xml +index 5232ba1..1b777a5 100644 +--- a/libqt5-ukui-style/settings/org.ukui.style.gschema.xml ++++ b/libqt5-ukui-style/settings/org.ukui.style.gschema.xml +@@ -63,7 +63,7 @@ + + "daybreakBlue" + theme color +- Set theme color for UKUI desktop environment.include default,daybreakBlue,jamPurple,magenta,sunRed,sunsetOrange,dustGold,polarGreen ++ Set theme color for UKUI desktop environment.include default,daybreakBlue,jamPurple,magenta,sunRed,sunsetOrange,dustGold,polarGreen, and using rgba for example "(125,125,125)" + + + true +@@ -87,5 +87,10 @@ + Custom highlight color + Set custom highlight color for UKUI desktop environment.Now is to compatible with third party application + ++ ++ 8 ++ Window Radius ++ Set the rounded corner size of the window ++ + + +diff --git a/qt5-ukui-platformtheme/qt5-ukui-platformtheme.pro b/qt5-ukui-platformtheme/qt5-ukui-platformtheme.pro +index 846d03c..90842aa 100644 +--- a/qt5-ukui-platformtheme/qt5-ukui-platformtheme.pro ++++ b/qt5-ukui-platformtheme/qt5-ukui-platformtheme.pro +@@ -64,8 +64,8 @@ TRANSLATIONS += \ + $$PWD/translations/qt5-ukui-platformtheme_mn.ts \ + $$PWD/translations/qt5-ukui-platformtheme_kk.ts \ + $$PWD/translations/qt5-ukui-platformtheme_ky.ts \ +- $$PWD/translations/qt5-ukui-platformtheme_ug.ts +- ++ $$PWD/translations/qt5-ukui-platformtheme_ug.ts \ ++ $$PWD/translations/qt5-ukui-platformtheme_zh_HK.ts + + unix { + target.path = $$[QT_INSTALL_PLUGINS]/platformthemes +diff --git a/qt5-ukui-platformtheme/translations/qt5-ukui-platformtheme_zh_CN.ts b/qt5-ukui-platformtheme/translations/qt5-ukui-platformtheme_zh_CN.ts +index ac74561..7c6289d 100644 +--- a/qt5-ukui-platformtheme/translations/qt5-ukui-platformtheme_zh_CN.ts ++++ b/qt5-ukui-platformtheme/translations/qt5-ukui-platformtheme_zh_CN.ts +@@ -2,262 +2,257 @@ + + + +- MessageBox +- +- +- Close +- 关闭 +- +- +- +- QApplication +- +- +- Executable '%1' requires Qt %2, found Qt %3. +- +- +- +- +- Incompatible Qt Library Error +- +- +- +- +- QDialogButtonBox +- +- +- +- OK +- +- +- +- +- QMessageBox +- +- +- +- +- Show Details... +- +- +- +- +- +- Hide Details... +- +- +- +- +- QObject +- +- +- File Name +- 文件名称 +- +- +- +- Modified Date +- 修改日期 +- +- +- +- File Type +- 文件类型 +- +- +- +- File Size +- 文件大小 +- +- +- +- Original Path +- 原始路径 +- +- +- +- Descending +- 降序 +- +- +- +- Ascending +- 升序 +- +- +- +- Use global sorting +- 使用全局排序 +- +- +- +- List View +- 列表视图 +- +- +- +- Icon View +- 图标视图 +- +- +- +- Close +- 关闭 +- +- +- +- UKUI::TabWidget::DefaultSlideAnimatorFactory +- +- +- Default Slide +- +- +- +- +- Let tab widget switch with a slide animation. +- +- +- +- +- UKUIFileDialog::KyFileDialogHelper ++ KyFileDialogHelper + +- ++ + Open File + 打开 + + +- ++ + Save File + 保存 + + +- ++ + All Files (*) + 所有(*) + + + +- UKUIFileDialog::KyNativeFileDialog ++ KyNativeFileDialog + +- ++ + Go Back + 后退 + + +- ++ + Go Forward + 前进 + + +- ++ + Cd Up + 向上 + + +- ++ + Search + 搜索 + + +- ++ + View Type + 视图类型 + + +- ++ + Sort Type + 排序类型 + + +- +- ++ ++ + Maximize + 最大化 + + +- ++ + Close + 关闭 + + +- ++ + Restore + 还原 + + +- ++ + Name + 文件名 + + +- +- ++ ++ + Open + 打开 + + +- +- ++ ++ + Cancel + 取消 + + +- ++ + Save as + 另存为 + + +- ++ + New Folder + 新建文件夹 + + +- +- ++ ++ + Save + 保存 + + +- +- +- ++ ++ ++ + Directories + 目录 + + +- ++ + Warning + 警告 + + +- ++ + exist, are you sure replace? + 已存在,是否替换? + + +- ++ + NewFolder + 新建文件夹 + + +- ++ + Undo + 撤销 + + +- ++ + Redo + 重做 + + +- ++ + warn + 警告 + + +- ++ + This operation is not supported. + 不支持此操作。 + + ++ ++ MessageBox ++ ++ ++ Close ++ 关闭 ++ ++ ++ ++ QApplication ++ ++ ++ Executable '%1' requires Qt %2, found Qt %3. ++ 可执行文件“%1”需要数量%2,找到数量%3。 ++ ++ ++ ++ Incompatible Qt Library Error ++ 不兼容的Qt库错误 ++ ++ ++ ++ QDialogButtonBox ++ ++ ++ ++ OK ++ 确认 ++ ++ ++ ++ QMessageBox ++ ++ ++ ++ ++ Show Details... ++ 显示细节…… ++ ++ ++ ++ ++ Hide Details... ++ 隐藏细节…… ++ ++ ++ ++ QObject ++ ++ ++ File Name ++ 文件名称 ++ ++ ++ ++ Modified Date ++ 修改日期 ++ ++ ++ ++ File Type ++ 文件类型 ++ ++ ++ ++ File Size ++ 文件大小 ++ ++ ++ ++ Original Path ++ 原始路径 ++ ++ ++ ++ Descending ++ 降序 ++ ++ ++ ++ Ascending ++ 升序 ++ ++ ++ ++ Use global sorting ++ 使用全局排序 ++ ++ ++ ++ List View ++ 列表视图 ++ ++ ++ ++ Icon View ++ 图标视图 ++ ++ ++ ++ UKUI::TabWidget::DefaultSlideAnimatorFactory ++ ++ ++ Default Slide ++ 默认slide ++ ++ ++ ++ Let tab widget switch with a slide animation. ++ 让选项卡小部件切换为幻灯片动画。 ++ ++ + +diff --git a/qt5-ukui-platformtheme/translations/qt5-ukui-platformtheme_zh_HK.ts b/qt5-ukui-platformtheme/translations/qt5-ukui-platformtheme_zh_HK.ts +new file mode 100644 +index 0000000..f39f694 +--- /dev/null ++++ b/qt5-ukui-platformtheme/translations/qt5-ukui-platformtheme_zh_HK.ts +@@ -0,0 +1,258 @@ ++ ++ ++ ++ ++ KyFileDialogHelper ++ ++ ++ Open File ++ 打開 ++ ++ ++ ++ Save File ++ 保存 ++ ++ ++ ++ All Files (*) ++ 所有(*) ++ ++ ++ ++ KyNativeFileDialog ++ ++ ++ Go Back ++ 後退 ++ ++ ++ ++ Go Forward ++ 前進 ++ ++ ++ ++ Cd Up ++ 向上 ++ ++ ++ ++ Search ++ 搜索 ++ ++ ++ ++ View Type ++ 視圖類型 ++ ++ ++ ++ Sort Type ++ 排序類型 ++ ++ ++ ++ ++ Maximize ++ 最大化 ++ ++ ++ ++ Close ++ 關閉 ++ ++ ++ ++ Restore ++ 還原 ++ ++ ++ ++ Name ++ 檔名 ++ ++ ++ ++ ++ Open ++ 打開 ++ ++ ++ ++ ++ Cancel ++ 取消 ++ ++ ++ ++ Save as ++ 另存為 ++ ++ ++ ++ New Folder ++ 新建資料夾 ++ ++ ++ ++ ++ Save ++ 保存 ++ ++ ++ ++ ++ ++ Directories ++ 目錄 ++ ++ ++ ++ Warning ++ 警告 ++ ++ ++ ++ exist, are you sure replace? ++ 已存在,是否替換? ++ ++ ++ ++ NewFolder ++ 新建資料夾 ++ ++ ++ ++ Undo ++ 撤銷 ++ ++ ++ ++ Redo ++ 重做 ++ ++ ++ ++ warn ++ 警告 ++ ++ ++ ++ This operation is not supported. ++ 不支援此操作。 ++ ++ ++ ++ MessageBox ++ ++ ++ Close ++ 關閉 ++ ++ ++ ++ QApplication ++ ++ ++ Executable '%1' requires Qt %2, found Qt %3. ++ 可執行檔「%1」 需要數量%2,找到數量%3。 ++ ++ ++ ++ Incompatible Qt Library Error ++ 不相容的Qt庫錯誤 ++ ++ ++ ++ QDialogButtonBox ++ ++ ++ ++ OK ++ 確認 ++ ++ ++ ++ QMessageBox ++ ++ ++ ++ ++ Show Details... ++ 顯示細節...... ++ ++ ++ ++ ++ Hide Details... ++ 隱藏細節...... ++ ++ ++ ++ QObject ++ ++ ++ File Name ++ 檔名稱 ++ ++ ++ ++ Modified Date ++ 修改日期 ++ ++ ++ ++ File Type ++ 檔案類型 ++ ++ ++ ++ File Size ++ 檔大小 ++ ++ ++ ++ Original Path ++ 原始路徑 ++ ++ ++ ++ Descending ++ 降序 ++ ++ ++ ++ Ascending ++ 升序 ++ ++ ++ ++ Use global sorting ++ 使用全域排序 ++ ++ ++ ++ List View ++ 清單檢視 ++ ++ ++ ++ Icon View ++ 圖示檢視 ++ ++ ++ ++ UKUI::TabWidget::DefaultSlideAnimatorFactory ++ ++ ++ Default Slide ++ 默認slide ++ ++ ++ ++ Let tab widget switch with a slide animation. ++ 讓選項卡小部件切換為幻燈片動畫。 ++ ++ ++ +diff --git a/qt5-ukui-platformtheme/widget/filedialog/kyfiledialog.cpp b/qt5-ukui-platformtheme/widget/filedialog/kyfiledialog.cpp +index 546f535..9361d33 100644 +--- a/qt5-ukui-platformtheme/widget/filedialog/kyfiledialog.cpp ++++ b/qt5-ukui-platformtheme/widget/filedialog/kyfiledialog.cpp +@@ -72,25 +72,16 @@ KyNativeFileDialog::KyNativeFileDialog(QWidget *parent) + : QDialog(parent), + d_ptr(new KyNativeFileDialogPrivate) + { +- const QString locale = QLocale::system().name(); +- QTranslator *translator = new QTranslator(this); +- pDebug << "local: " << locale; +- if (translator->load("/usr/share/qt5-ukui-platformtheme/qt5-ukui-platformtheme_" + QLocale::system().name())) { +- pDebug << "Load translations file success!"; +- QApplication::installTranslator(translator); +- } else { +- pDebug << "Load translations file failed!"; +- } ++ QString locale = QLocale::system().name(); + +- QTranslator *t = new QTranslator(this); +- pDebug << "QTranslator t load" << t->load("/usr/share/libpeony-qt/libpeony-qt_"+QLocale::system().name()); +- QApplication::installTranslator(t); +- QTranslator *t2 = new QTranslator(this); +- pDebug << "QTranslator t2 load" << t2->load("/usr/share/peony-qt-desktop/peony-qt-desktop_"+QLocale::system().name()); +- QApplication::installTranslator(t2); +- QTranslator *t3 = new QTranslator(this); +- pDebug << "QTranslator t3 load" << t3->load("/usr/share/qt5/translations/qt_"+QLocale::system().name()); +- QApplication::installTranslator(t3); ++ if(qApp->property("Language").isValid()) ++ { ++ QString language = qApp->property("Language").toString(); ++ QFile file("/usr/share/qt5-ukui-platformtheme/qt5-ukui-platformtheme_" + language + ".qm"); ++ if(file.exists()) ++ locale = language; ++ } ++ installTranslate(locale); + + mKyFileDialogUi = new Ui_KyFileDialog(this); + +@@ -671,10 +662,23 @@ void KyNativeFileDialog::goToUri(const QString &uri, bool addToHistory, bool for + + if(uri.isEmpty() || uri == getCurrentUri()) + return; +- ++ QString nUri = uri, nCurrentUri = getCurrentUri(); ++ pDebug << "nUri000..." << nUri << "nCurrentUri...." << nCurrentUri; ++ if(nUri.endsWith("/")){ ++ if((nUri.length() >= 2 && nUri[nUri.length() - 2] != "/") || nUri.length() <2) ++ nUri = nUri.remove(nUri.length() - 1, 1); ++ } ++ if(nCurrentUri.endsWith("/")){ ++ if((nCurrentUri.length() >= 2 && nCurrentUri[nCurrentUri.length() - 2] != "/") || nCurrentUri.length() <2) ++ nCurrentUri = nCurrentUri.remove(nCurrentUri.length() - 1, 1); ++ } ++ pDebug << "nUri..." << nUri << "nCurrentUri...." << nCurrentUri; ++ if(nUri == nCurrentUri) { ++ return; ++ } + pDebug << "getCurrentUri....,,,,:" << getCurrentUri(); + pDebug << "isShow......:" << (m_fileDialogHelper == nullptr) << m_fileDialogHelper->isShow() << isInitialGoToUriNum; +- if(isInitialGoToUriNum || (m_fileDialogHelper != nullptr && m_fileDialogHelper->isShow())) ++ if(true)//(isInitialGoToUriNum || (m_fileDialogHelper != nullptr && m_fileDialogHelper->isShow())) + { + isInitialGoToUriNum = false; + getCurrentPage()->stopLoading(); +@@ -1680,8 +1684,8 @@ void KyNativeFileDialog::paintEvent(QPaintEvent *e) + // sidebarPath.addRect(adjustedRect.adjusted(6, 0, 0, 0)); + QPainter p(this); + QPainterPath contentPath; +- if(this && this->property("maxRadius").isValid()) +- radius = this->property("maxRadius").toInt(); ++ if(this && this->property("windowRadius").isValid()) ++ radius = this->property("windowRadius").toInt(); + // qDebug() << "KyNativeFileDialog radius........" << radius; + contentPath.addRoundedRect(this->rect(), radius, radius); + auto bgPath = contentPath - sidebarPath; +@@ -2508,6 +2512,28 @@ void KyNativeFileDialog::updateSearchProgressBar() + // } + } + ++void KyNativeFileDialog::installTranslate(QString locale) ++{ ++ m_translator0 = new QTranslator(this); ++ pDebug << "local: " << locale; ++ if (m_translator0->load("/usr/share/qt5-ukui-platformtheme/qt5-ukui-platformtheme_" + locale)) { ++ pDebug << "Load translations file success!"; ++ QApplication::installTranslator(m_translator0); ++ } else { ++ pDebug << "Load translations file failed!"; ++ } ++ ++ m_translator1 = new QTranslator(this); ++ pDebug << "QTranslator t load" << m_translator1->load("/usr/share/libpeony-qt/libpeony-qt_" + locale); ++ QApplication::installTranslator(m_translator1); ++ m_translator2 = new QTranslator(this); ++ pDebug << "QTranslator t2 load" << m_translator2->load("/usr/share/peony-qt-desktop/peony-qt-desktop_" + locale); ++ QApplication::installTranslator(m_translator2); ++ m_translator3 = new QTranslator(this); ++ pDebug << "QTranslator t3 load" << m_translator3->load("/usr/share/qt5/translations/qt_" + locale); ++ QApplication::installTranslator(m_translator3); ++} ++ + KyFileDialogHelper::KyFileDialogHelper() : QPlatformFileDialogHelper(), mKyFileDialog(new KyNativeFileDialog) + { + mKyFileDialog->setHelper(this); +@@ -2551,7 +2577,17 @@ void KyFileDialogHelper::hide() + + bool KyFileDialogHelper::show(Qt::WindowFlags windowFlags, Qt::WindowModality windowModality, QWindow *parent) + { ++ if(m_isShow){ ++ mKyFileDialog->delayShow(); ++ return true; ++ } + pDebug << "show........." << (options() == nullptr); ++ pDebug << "option initialselectfiles..." << options()->initiallySelectedFiles(); ++ pDebug << "option initialDirectory..." << options()->initialDirectory(); ++ ++ m_initialDirectory = options()->initialDirectory(); ++ m_initialSelectFiles = options()->initiallySelectedFiles(); ++ + if(parent != nullptr) + pDebug << "window....:" << parent->x() << parent->y() << parent->width() << parent->height(); + else +@@ -2575,9 +2611,17 @@ bool KyFileDialogHelper::show(Qt::WindowFlags windowFlags, Qt::WindowModality wi + pDebug << "filedialog select000....." << fd->selectedFiles(); + pDebug << "filedialog selectUrls000....." << fd->selectedUrls(); + pDebug << "filedialog directoryUrl000....." << fd->directoryUrl(); +- if(fd->directory().exists()) +- mKyFileDialog->setDirectory(fd->directory()); ++ if(m_initialSelectFiles.length() > 0 && QFile::exists(m_initialSelectFiles.value(0).path())){ ++ QDir dir(m_initialSelectFiles.value(0).path()); ++ dir.cdUp(); ++ pDebug <<"dirrrrr..." << dir.path(); ++ mKyFileDialog->mKyFileDialogUi->m_pathbarWidget->updatePath(QUrl::fromLocalFile(dir.absolutePath()).toString()); ++ mKyFileDialog->setDirectory(dir); ++ } else if(fd->directory().exists()){ ++ mKyFileDialog->mKyFileDialogUi->m_pathbarWidget->updatePath(QUrl::fromLocalFile(fd->directory().absolutePath()).toString()); + ++ mKyFileDialog->setDirectory(fd->directory()); ++ } + // if(fd->directoryUrl().) + + // for(QPushButton *btn : mKyFileDialog->findChildren()) +@@ -2596,11 +2640,23 @@ bool KyFileDialogHelper::show(Qt::WindowFlags windowFlags, Qt::WindowModality wi + for(QWidget *widget : qApp->allWidgets()){ + if(QFileDialog *fd = qobject_cast(widget)){ + if(options()->windowTitle() == fd->windowTitle()){ +- pDebug << "parent us null filedoalog set parent...." << fd->geometry(); ++ pDebug << "parent us null filedoalog set parent...." << fd->geometry() << options()->windowTitle() << fd->objectName(); + if(mKyFileDialog->parentWidget() != fd){ + mKyFileDialog->setParent(fd, windowFlags); + } +- if(fd->directory().exists()){ ++ pDebug << "parent us null filedoalog directory...." << fd->directory(); ++ pDebug << "parent us null filedoalog selectedFiles...." << m_initialSelectFiles.value(0).path() << QFile::exists(m_initialSelectFiles.value(0).path()); ++ if(m_initialSelectFiles.length() > 0 && QFile::exists(m_initialSelectFiles.value(0).path())){ ++ QDir dir(m_initialSelectFiles.value(0).path()); ++ dir.cdUp(); ++ pDebug <<"dirrrrr..." << dir.path(); ++ mKyFileDialog->mKyFileDialogUi->m_pathbarWidget->updatePath(QUrl::fromLocalFile(dir.absolutePath()).toString()); ++ ++ mKyFileDialog->setDirectory(dir); ++ } ++ else if(fd->directory().exists()){ ++ mKyFileDialog->mKyFileDialogUi->m_pathbarWidget->updatePath(QUrl::fromLocalFile(fd->directory().absolutePath()).toString()); ++ + mKyFileDialog->setDirectory(fd->directory()); + } + break; +@@ -2622,12 +2678,13 @@ bool KyFileDialogHelper::show(Qt::WindowFlags windowFlags, Qt::WindowModality wi + } + + mKyFileDialog->delayShow(); +- m_isShow = true; ++ viewInitialFinished(); + return true; + } + + void KyFileDialogHelper::initDialog() + { ++ m_isShow = true; + + pDebug << "initDialog filter...." << options()->filter() << options()->nameFilters() << options()->mimeTypeFilters() << options()->viewMode(); + if (options()->windowTitle().isEmpty()) { +@@ -2697,15 +2754,17 @@ void KyFileDialogHelper::viewInitialFinished() + + QTimer::singleShot(500, this, [this](){ + +- auto selectirectory = options()->initialDirectory(); +- auto selectedFiles = options()->initiallySelectedFiles(); ++ auto selectirectory = m_initialDirectory;// options()->initialDirectory(); ++ auto selectedFiles = m_initialSelectFiles; //options()->initiallySelectedFiles(); + QStringList strList; + + pDebug << "m_viewInitialFinished:" << m_viewInitialFinished; + pDebug << "viewInitialFinished selectirectory:" << selectirectory; + pDebug << "viewInitialFinished selectedFiles:" << selectedFiles; + +- if(selectedFiles.length() > 0 && !m_viewInitialFinished) ++ if(m_viewInitialFinished) ++ return; ++ if(selectedFiles.length() > 0) + { + pDebug << "initiallySelectedFiles:" << selectedFiles; + +@@ -2723,8 +2782,10 @@ void KyFileDialogHelper::viewInitialFinished() + if(strList.length() > 0){ + QString path; + QUrl url(strList[0]); +- if(mKyFileDialog->isDir(url.path())) ++ if(mKyFileDialog->isDir(url.path()) && options()->fileMode() != QFileDialog::Directory && ++ options()->fileMode() != QFileDialog::DirectoryOnly){ + path = url.path(); ++ } + else{ + QDir dir(url.path()); + dir.cdUp(); +@@ -2853,6 +2914,8 @@ QList KyFileDialogHelper::selectedFiles() const + else if(urlList.length() == 0) + { + QString path = mKyFileDialog->getCurrentUri(); ++ if(path.isEmpty()) ++ return urlList; + if(!path.endsWith("/")) + path += "/"; + pDebug << "selected filesss...:" << path + mKyFileDialog->copyEditText(); +@@ -2864,6 +2927,8 @@ QList KyFileDialogHelper::selectedFiles() const + { + QList urls; + QString path = mKyFileDialog->getCurrentUri(); ++ if(path.isEmpty()) ++ return urls; + if(!path.endsWith("/")) + path += "/"; + path += mKyFileDialog->copyEditText(); +@@ -2909,7 +2974,13 @@ QString KyFileDialogHelper::selectedMimeTypeFilter() const + + bool KyFileDialogHelper::isSupportedUrl(const QUrl &url) const + { ++ pDebug << "options initialdirectory...." << options()->initialDirectory(); ++ pDebug << "options selectfiles..." << options()->initiallySelectedFiles(); + pDebug << "isSupportedUrl..." << url << url.isLocalFile(); ++ pDebug << "options windowTitle" << options()->windowTitle(); ++ if(!mKyFileDialog->isVisible()){ ++ return false; ++ } + // return false; + return url.isLocalFile(); + +diff --git a/qt5-ukui-platformtheme/widget/filedialog/kyfiledialog.h b/qt5-ukui-platformtheme/widget/filedialog/kyfiledialog.h +index 3710fb1..20368bd 100644 +--- a/qt5-ukui-platformtheme/widget/filedialog/kyfiledialog.h ++++ b/qt5-ukui-platformtheme/widget/filedialog/kyfiledialog.h +@@ -30,6 +30,7 @@ + #include + #include + #include ++#include + #include "qpa/qplatformdialoghelper.h" + #include + +@@ -180,6 +181,8 @@ public: + + QString copyEditText(); + ++ void installTranslate(QString local); ++ + Q_SIGNALS: + void switchViewRequest(const QString &viewId); + +@@ -216,7 +219,6 @@ protected: + + private: + Ui_KyFileDialog *mKyFileDialogUi = nullptr; +- KyNativeFileDialog *mKyFileDialog = nullptr; + QScopedPointer d_ptr; + Q_DECLARE_PRIVATE_D(qGetPtrHelper(d_ptr), KyNativeFileDialog) + void onAcceptButtonClicked(); +@@ -244,6 +246,12 @@ private: + QMap m_nameFilterMap; + QStringList m_uris_to_edit; + bool m_needSearch = false; ++ ++ QTranslator *m_translator0 = nullptr; ++ QTranslator *m_translator1 = nullptr; ++ QTranslator *m_translator2 = nullptr; ++ QTranslator *m_translator3 = nullptr; ++ + }; + + class KyFileDialogHelper : public QPlatformFileDialogHelper +@@ -292,6 +300,8 @@ private: + QUrl m_selectedFiles; + bool m_viewInitialFinished = false; + bool m_isShow = false; ++ QUrl m_initialDirectory; ++ QList m_initialSelectFiles; + + private: + void initDialog(); +diff --git a/ukui-qml-style-helper/kystylehelper.h b/ukui-qml-style-helper/kystylehelper.h +index 45a39a6..6468dc0 100644 +--- a/ukui-qml-style-helper/kystylehelper.h ++++ b/ukui-qml-style-helper/kystylehelper.h +@@ -36,24 +36,25 @@ class KyStyleHelper : public QQuickItem + Q_PROPERTY(QPalette palette READ palette NOTIFY paletteChanged) + Q_PROPERTY(QFont font READ font NOTIFY fontChanged) + ++ Q_PROPERTY(QColor windowtextcolorrole READ windowtextcolor NOTIFY qcolorChanged) + Q_PROPERTY(QColor buttoncolorrole READ buttoncolor NOTIFY qcolorChanged) +- Q_PROPERTY(QColor windowcolorrole READ windowcolor NOTIFY qcolorChanged) ++ Q_PROPERTY(QColor lightcolorrole READ lightcolor NOTIFY qcolorChanged) ++ Q_PROPERTY(QColor midlightcolorrole READ midlightcolor NOTIFY qcolorChanged) + Q_PROPERTY(QColor darkcolorrole READ darkcolor NOTIFY qcolorChanged) +- Q_PROPERTY(QColor windowtextcolorrole READ windowtextcolor NOTIFY qcolorChanged) +- Q_PROPERTY(QColor basecolorrole READ basecolor NOTIFY qcolorChanged) ++ Q_PROPERTY(QColor midcolorrole READ midcolor NOTIFY qcolorChanged) + Q_PROPERTY(QColor textcolorrole READ textcolor NOTIFY qcolorChanged) ++ Q_PROPERTY(QColor brighttextcolorrole READ brighttextcolor NOTIFY qcolorChanged) + Q_PROPERTY(QColor buttontextcolorrole READ buttontextcolor NOTIFY qcolorChanged) ++ Q_PROPERTY(QColor basecolorrole READ basecolor NOTIFY qcolorChanged) ++ Q_PROPERTY(QColor windowcolorrole READ windowcolor NOTIFY qcolorChanged) ++ Q_PROPERTY(QColor shadowcolorrole READ shadowcolor NOTIFY qcolorChanged) + Q_PROPERTY(QColor highlightcolorrole READ highlightcolor NOTIFY qcolorChanged) + Q_PROPERTY(QColor highlightedtextcolorrole READ highlightedtextcolor NOTIFY qcolorChanged) +- Q_PROPERTY(QColor tooltipbasecolorrole READ tooltipbasecolor NOTIFY qcolorChanged) +- Q_PROPERTY(QColor tooltiptextcolorrole READ tooltiptextcolor NOTIFY qcolorChanged) +- Q_PROPERTY(QColor lightcolorrole READ lightcolor NOTIFY qcolorChanged) +- Q_PROPERTY(QColor midlightcolorrole READ midlightcolor NOTIFY qcolorChanged) +- Q_PROPERTY(QColor midcolorrole READ midcolor NOTIFY qcolorChanged) +- Q_PROPERTY(QColor shadowcolorrole READ shadowcolor NOTIFY qcolorChanged) +- Q_PROPERTY(QColor alternatebasecolorrole READ alternatebasecolor NOTIFY qcolorChanged) + Q_PROPERTY(QColor linkcolorrole READ linkcolor NOTIFY qcolorChanged) + Q_PROPERTY(QColor linkvisitedcolorrole READ linkvisitedcolor NOTIFY qcolorChanged) ++ Q_PROPERTY(QColor alternatebasecolorrole READ alternatebasecolor NOTIFY qcolorChanged) ++ Q_PROPERTY(QColor tooltipbasecolorrole READ tooltipbasecolor NOTIFY qcolorChanged) ++ Q_PROPERTY(QColor tooltiptextcolorrole READ tooltiptextcolor NOTIFY qcolorChanged) + + Q_PROPERTY( QString buttonType READ buttonType WRITE setbuttonType NOTIFY buttonTypeChanged) + +@@ -80,59 +81,62 @@ public: + } + + /* Get different type of color */ ++ QColor windowtextcolor() { ++ return qApp->palette().windowText().color(); ++ } + QColor buttoncolor() { + return qApp->palette().button().color(); + } +- QColor windowcolor() { +- return qApp->palette().window().color(); ++ QColor lightcolor() { ++ return qApp->palette().light().color(); ++ } ++ QColor midlightcolor() { ++ return qApp->palette().midlight().color(); + } + QColor darkcolor() { + return qApp->palette().dark().color(); + } +- QColor windowtextcolor() { +- return qApp->palette().windowText().color(); +- } +- QColor basecolor() { +- return qApp->palette().base().color(); ++ QColor midcolor() { ++ return qApp->palette().mid().color(); + } + QColor textcolor() { + return qApp->palette().text().color(); + } ++ QColor brighttextcolor() { ++ return qApp->palette().brightText().color(); ++ } + QColor buttontextcolor() { + return qApp->palette().buttonText().color(); + } ++ QColor basecolor() { ++ return qApp->palette().base().color(); ++ } ++ QColor windowcolor() { ++ return qApp->palette().window().color(); ++ } ++ QColor shadowcolor() { ++ return qApp->palette().shadow().color(); ++ } + QColor highlightcolor() { + return qApp->palette().highlight().color(); + } + QColor highlightedtextcolor() { + return qApp->palette().highlightedText().color(); + } +- QColor tooltipbasecolor() { +- return qApp->palette().toolTipBase().color(); +- } +- QColor tooltiptextcolor() { +- return qApp->palette().toolTipText().color(); +- } +- QColor lightcolor() { +- return qApp->palette().light().color(); +- } +- QColor midlightcolor() { +- return qApp->palette().midlight().color(); +- } +- QColor midcolor() { +- return qApp->palette().mid().color(); ++ QColor linkcolor() { ++ return qApp->palette().link().color(); + } +- QColor shadowcolor() { +- return qApp->palette().shadow().color(); ++ QColor linkvisitedcolor() { ++ return qApp->palette().linkVisited().color(); + } + QColor alternatebasecolor() { + return qApp->palette().alternateBase().color(); + } +- QColor linkcolor() { +- return qApp->palette().link().color(); ++ QColor tooltipbasecolor() { ++ return qApp->palette().toolTipBase().color(); + } +- QColor linkvisitedcolor() { +- return qApp->palette().linkVisited().color(); ++ QColor tooltiptextcolor() { ++ return qApp->palette().toolTipText().color(); + } + + +diff --git a/ukui-styles/blur-helper.cpp b/ukui-styles/blur-helper.cpp +index 7028ac9..60c0248 100644 +--- a/ukui-styles/blur-helper.cpp ++++ b/ukui-styles/blur-helper.cpp +@@ -282,8 +282,8 @@ void BlurHelper::delayUpdate(QWidget *w, bool updateBlurRegionOnly) + } + QPainterPath path; + int radius = 8; +- if(widget->property("maxRadius").isValid()) +- radius = widget->property("maxRadius").toInt(); ++ if(widget->property("windowRadius").isValid()) ++ radius = widget->property("windowRadius").toInt(); + path.addRoundedRect(widget->rect(), radius, radius); + KWindowEffects::enableBlurBehind(widget->winId(), true, path.toFillPolygon().toPolygon()); + if (!updateBlurRegionOnly) +diff --git a/ukui-styles/qt5-config-style-ukui/config-shadow-helper.cpp b/ukui-styles/qt5-config-style-ukui/config-shadow-helper.cpp +index c586f7a..e62526d 100644 +--- a/ukui-styles/qt5-config-style-ukui/config-shadow-helper.cpp ++++ b/ukui-styles/qt5-config-style-ukui/config-shadow-helper.cpp +@@ -155,8 +155,8 @@ QPixmap ConfigShadowHelper::getShadowPixmap(QColor color, /*ConfigShadowHelper:: + QPoint currentPos; + + int qAppMaxradius = maxRadius; +- if(widget && widget->property("maxRadius").isValid()){ +- qAppMaxradius = widget->property("maxRadius").toInt(); ++ if(widget && widget->property("windowRadius").isValid()){ ++ qAppMaxradius = widget->property("windowRadius").toInt(); + // qDebug() << "radius...." << qAppMaxradius; + } + // move to top left arc start point +@@ -259,8 +259,8 @@ QPainterPath ConfigShadowHelper::caculateRelativePainterPath(QWidget *widget, qr + QPointF currentPos; + + int qAppMaxradius = maxRadius; +- if(widget && widget->property("maxRadius").isValid()){ +- qAppMaxradius = widget->property("maxRadius").toInt(); ++ if(widget && widget->property("windowRadius").isValid()){ ++ qAppMaxradius = widget->property("windowRadius").toInt(); + //qDebug() << "radius...." << qAppMaxradius; + } + +diff --git a/ukui-styles/qt5-config-style-ukui/themeconfig/classical.json b/ukui-styles/qt5-config-style-ukui/themeconfig/classical.json +index f1c3388..b2587b2 100644 +--- a/ukui-styles/qt5-config-style-ukui/themeconfig/classical.json ++++ b/ukui-styles/qt5-config-style-ukui/themeconfig/classical.json +@@ -1,6 +1,6 @@ + { + "Radius":{ +- "Max_Radius" : {"value": "0", "type": "int"}, ++ "Window_Radius" : {"value": "0", "type": "int"}, + "Normal_Radius" : {"value": "0", "type": "int"}, + "Min_Radius" : {"value": "0", "type": "int"} + }, +diff --git a/ukui-styles/qt5-config-style-ukui/themeconfig/default.json b/ukui-styles/qt5-config-style-ukui/themeconfig/default.json +index ed9e456..f72a3dc 100644 +--- a/ukui-styles/qt5-config-style-ukui/themeconfig/default.json ++++ b/ukui-styles/qt5-config-style-ukui/themeconfig/default.json +@@ -1,6 +1,6 @@ + { + "Radius":{ +- "Max_Radius" : {"value": "8", "type": "int"}, ++ "Window_Radius" : {"value": "8", "type": "int"}, + "Normal_Radius" : {"value": "6", "type": "int"}, + "Min_Radius" : {"value": "4", "type": "int"} + }, +diff --git a/ukui-styles/qt5-config-style-ukui/themeconfig/fashion.json b/ukui-styles/qt5-config-style-ukui/themeconfig/fashion.json +index 44da586..141b63f 100644 +--- a/ukui-styles/qt5-config-style-ukui/themeconfig/fashion.json ++++ b/ukui-styles/qt5-config-style-ukui/themeconfig/fashion.json +@@ -1,6 +1,6 @@ + { + "Radius":{ +- "Max_Radius" : {"value": "8", "type": "int"}, ++ "Window_Radius" : {"value": "8", "type": "int"}, + "Normal_Radius" : {"value": "6", "type": "int"}, + "Min_Radius" : {"value": "4", "type": "int"} + }, +diff --git a/ukui-styles/qt5-config-style-ukui/ukui-config-style-parameters.cpp b/ukui-styles/qt5-config-style-ukui/ukui-config-style-parameters.cpp +index 285918f..213ca36 100644 +--- a/ukui-styles/qt5-config-style-ukui/ukui-config-style-parameters.cpp ++++ b/ukui-styles/qt5-config-style-ukui/ukui-config-style-parameters.cpp +@@ -258,8 +258,6 @@ void UKUIConfigStyleParameters::initRadiusCfg() + m_adjustColorRules = m_readCfg->getColorValueAdjustRules() == "HSL" ? AdjustColorRules::HSL : AdjustColorRules::DefaultRGB; + } + m_radiusStruct = m_readCfg->getRadiusStruct(UKUI_Radius); +- radius = m_radiusStruct.normalRadius; +- cDebug << "min:" << m_radiusStruct.minRadius << "normal:" << m_radiusStruct.normalRadius << "max:" << m_radiusStruct.maxRadius; + } + + QPalette UKUIConfigStyleParameters::setPalette(QPalette &palette) +@@ -708,7 +706,7 @@ void UKUIConfigStyleParameters::initConfigPushButtonBevelParameters(bool isDark, + if (isImportant) + buttonColorCfg = readCfg()->buttonColorCfg(option->palette, C_Button_ImportButton); + +- int radius = m_radiusStruct.normalRadius; ++ int radius = (widget && widget->property("normalRadius").isValid()) ? widget->property("normalRadius").toInt() : m_radiusStruct.normalRadius; + + QBrush defaultBrush = QBrush(buttonColorCfg.defaultBrush); + QBrush disableBrush = QBrush(buttonColorCfg.disableBrush); +@@ -905,6 +903,28 @@ void UKUIConfigStyleParameters::initConfigPushButtonBevelParameters(bool isDark, + checkClickBrush = clickBrush; + checkDisableBrush = option->palette.brush(QPalette::Disabled, QPalette::NoRole); + ++ auto *w = const_cast(widget); ++ if(w){ ++ w->setProperty("ukui_radius", radius); ++ w->setProperty("ukui_defaultBrush", defaultBrush); ++ w->setProperty("ukui_clickBrush", clickBrush); ++ w->setProperty("ukui_hoverBrush", hoverBrush); ++ w->setProperty("ukui_disableBrush", disableBrush); ++ w->setProperty("ukui_checkBrush", checkBrush); ++ w->setProperty("ukui_checkHoverBrush", checkHoverBrush); ++ w->setProperty("ukui_checkClickBrush", checkClickBrush); ++ w->setProperty("ukui_checkDisableBrush", checkDisableBrush); ++ w->setProperty("ukui_defaultPen", defaultPen); ++ w->setProperty("ukui_clickPen", clickPen); ++ w->setProperty("ukui_hoverPen", hoverPen); ++ w->setProperty("ukui_disablePen", disablePen); ++ w->setProperty("ukui_checkPen", checkPen); ++ w->setProperty("ukui_checkHoverPen", checkHoverPen); ++ w->setProperty("ukui_checkClickPen", checkClickPen); ++ w->setProperty("ukui_checkDisablePen", checkDisablePen); ++ w->setProperty("ukui_focusPen", focusPen); ++ } ++ + if (widget) { + if (widget->property("setRadius").isValid() && widget->property("setRadius").canConvert()) { + radius = widget->property("setRadius").value(); +@@ -1051,6 +1071,13 @@ void UKUIConfigStyleParameters::initConfigPushButtonLabelParameters(bool isDark, + textColor = buttonColorCfg.textHoverColor; + } + ++ auto *w = const_cast(widget); ++ if(w){ ++ w->setProperty("ukui_iconHighlight", iconHighlight); ++ w->setProperty("ukui_textHighlight", textHighlight); ++ w->setProperty("ukui_textColor", textColor); ++ } ++ + if (widget) { + if(!widget->isEnabled()) + textColor = option->palette.color(QPalette::Disabled, QPalette::ButtonText); +@@ -1114,7 +1141,8 @@ void UKUIConfigStyleParameters::initConfigToolButtonPanelParameters(bool isDark, + if (isImportant) + buttonColorCfg = readCfg()->toolButtonColorCfg(option->palette, C_Button_ImportButton); + +- int radius = m_radiusStruct.normalRadius; ++ int radius = (widget && widget->property("normalRadius").isValid()) ? widget->property("normalRadius").toInt() : m_radiusStruct.normalRadius; ++ + QBrush defaultBrush = QBrush(buttonColorCfg.defaultBrush); + QBrush disableBrush = QBrush(buttonColorCfg.disableBrush); + QBrush clickBrush = QBrush(buttonColorCfg.clickBrush); +@@ -1308,6 +1336,28 @@ void UKUIConfigStyleParameters::initConfigToolButtonPanelParameters(bool isDark, + checkClickBrush = clickBrush; + checkDisableBrush = option->palette.brush(QPalette::Disabled, QPalette::NoRole); + ++ auto *w = const_cast(widget); ++ if(w){ ++ w->setProperty("ukui_radius", radius); ++ w->setProperty("ukui_defaultBrush", defaultBrush); ++ w->setProperty("ukui_clickBrush", clickBrush); ++ w->setProperty("ukui_hoverBrush", hoverBrush); ++ w->setProperty("ukui_disableBrush", disableBrush); ++ w->setProperty("ukui_checkBrush", checkBrush); ++ w->setProperty("ukui_checkHoverBrush", checkHoverBrush); ++ w->setProperty("ukui_checkClickBrush", checkClickBrush); ++ w->setProperty("ukui_checkDisableBrush", checkDisableBrush); ++ w->setProperty("ukui_defaultPen", defaultPen); ++ w->setProperty("ukui_clickPen", clickPen); ++ w->setProperty("ukui_hoverPen", hoverPen); ++ w->setProperty("ukui_disablePen", disablePen); ++ w->setProperty("ukui_checkPen", checkPen); ++ w->setProperty("ukui_checkHoverPen", checkHoverPen); ++ w->setProperty("ukui_checkClickPen", checkClickPen); ++ w->setProperty("ukui_checkDisablePen", checkDisablePen); ++ w->setProperty("ukui_focusPen", focusPen); ++ } ++ + if (widget) { + if (widget->property("setRadius").isValid() && widget->property("setRadius").canConvert()) { + radius = widget->property("setRadius").value(); +@@ -1453,6 +1503,12 @@ void UKUIConfigStyleParameters::initConfigToolButtonLabelParameters(bool isDark, + textColor = buttonColorCfg.textHoverColor; + } + ++ auto *w = const_cast(widget); ++ if(w){ ++ w->setProperty("ukui_iconHighlight", iconHighlight); ++ w->setProperty("ukui_textHighlight", textHighlight); ++ w->setProperty("ukui_textColor", textColor); ++ } + if (widget) { + if(!widget->isEnabled()) + textColor = option->palette.color(QPalette::Disabled, QPalette::ButtonText); +@@ -1475,7 +1531,8 @@ void UKUIConfigStyleParameters::initConfigToolButtonLabelParameters(bool isDark, + + void UKUIConfigStyleParameters::initConfigLineEditParameters(bool isDark, const QStyleOption *option, const QWidget *widget) + { +- int radius = m_radiusStruct.normalRadius; ++ int radius = (widget && widget->property("normalRadius").isValid()) ? widget->property("normalRadius").toInt() : m_radiusStruct.normalRadius; ++ qDebug() << "initConfigLineEditParameters....." << widget->property("normalRadius").isValid() << radius; + bool needTranslucent = false; + if (widget && widget->property("needTranslucent").isValid()) { + needTranslucent = widget->property("needTranslucent").toBool(); +@@ -1560,6 +1617,19 @@ void UKUIConfigStyleParameters::initConfigLineEditParameters(bool isDark, const + break; + } + ++ auto *w = const_cast(widget); ++ if(w){ ++ w->setProperty("ukui_radius", radius); ++ w->setProperty("ukui_defaultBrush", defaultBrush); ++ w->setProperty("ukui_focusBrush", focusBrush); ++ w->setProperty("ukui_hoverBrush", hoverBrush); ++ w->setProperty("ukui_disableBrush", disableBrush); ++ w->setProperty("ukui_defaultPen", defaultPen); ++ w->setProperty("ukui_hoverPen", hoverPen); ++ w->setProperty("ukui_disablePen", disablePen); ++ w->setProperty("ukui_focusPen", focusPen); ++ } ++ + if (widget) { + if (widget->property("setRadius").isValid() && widget->property("setRadius").canConvert()) { + radius = widget->property("setRadius").value(); +@@ -1603,7 +1673,8 @@ void UKUIConfigStyleParameters::initConfigLineEditParameters(bool isDark, const + + void UKUIConfigStyleParameters::initConfigSpinBoxParameters(bool isDark, const QStyleOption *option, const QWidget *widget, bool isHorizonLayout) + { +- int radius = m_radiusStruct.normalRadius; ++ int radius = (widget && widget->property("normalRadius").isValid()) ? widget->property("normalRadius").toInt() : m_radiusStruct.normalRadius; ++ + + UKUIColorTheme::SpinBoxColorCfg spinBoxColorCfg = + readCfg()->spinBoxColorCfg(option->palette, C_SpinBox_Default, isHorizonLayout ? C_SpinBox_HorizonLayout : C_SpinBox_DefaultLayout); +@@ -1906,6 +1977,36 @@ void UKUIConfigStyleParameters::initConfigSpinBoxParameters(bool isDark, const Q + break; + } + ++ auto *w = const_cast(widget); ++ if(w){ ++ w->setProperty("ukui_radius", radius); ++ w->setProperty("ukui_defaultBrush", defaultBrush); ++ w->setProperty("ukui_focusBrush", focusBrush); ++ w->setProperty("ukui_hoverBrush", hoverBrush); ++ w->setProperty("ukui_disableBrush", disableBrush); ++ w->setProperty("ukui_defaultPen", defaultPen); ++ w->setProperty("ukui_hoverPen", hoverPen); ++ w->setProperty("ukui_disablePen", disablePen); ++ w->setProperty("ukui_focusPen", focusPen); ++ w->setProperty("ukui_upDefaultBrush", upDefaultBrush); ++ w->setProperty("ukui_upFocusHoverBrush", upFocusHoverBrush); ++ w->setProperty("ukui_upClickBrush", upClickBrush); ++ w->setProperty("ukui_upHoverBrush", upHoverBrush); ++ w->setProperty("ukui_downDefaultBrush", downDefaultBrush); ++ w->setProperty("ukui_downHoverBrush", downHoverBrush); ++ w->setProperty("ukui_downFocusHoverBrush", downFocusHoverBrush); ++ w->setProperty("ukui_downClickBrush", downClickBrush); ++ w->setProperty("ukui_upDefaultPen", upDefaultPen); ++ w->setProperty("ukui_upHoverPen", upHoverPen); ++ w->setProperty("ukui_upFocusHoverPen", upFocusHoverPen); ++ w->setProperty("ukui_upClickPen", upClickPen); ++ w->setProperty("ukui_upDisablePen", upDisablePen); ++ w->setProperty("ukui_downDefaultPen", downDefaultPen); ++ w->setProperty("ukui_downHoverPen", downHoverPen); ++ w->setProperty("ukui_downFocusHoverPen", downFocusHoverPen); ++ w->setProperty("ukui_downClickPen", downClickPen); ++ w->setProperty("ukui_downDisablePen", downDisablePen); ++ } + if (widget) { + if (widget->property("setRadius").isValid() && widget->property("setRadius").canConvert()) { + radius = widget->property("setRadius").value(); +@@ -2028,7 +2129,8 @@ void UKUIConfigStyleParameters::initConfigSpinBoxParameters(bool isDark, const Q + + void UKUIConfigStyleParameters::initConfigComboBoxParameters(bool isDark, const QStyleOption *option, const QWidget *widget) + { +- int radius = m_radiusStruct.normalRadius; ++ int radius = (widget && widget->property("normalRadius").isValid()) ? widget->property("normalRadius").toInt() : m_radiusStruct.normalRadius; ++ + + UKUIColorTheme::ComboBoxColorCfg comboBoxColorCfg = readCfg()->comboBoxColorCfg(option->palette, C_ComboBox_Default); + +@@ -2065,6 +2167,21 @@ void UKUIConfigStyleParameters::initConfigComboBoxParameters(bool isDark, const + break; + } + ++ auto *w = const_cast(widget); ++ if(w){ ++ w->setProperty("ukui_radius", radius); ++ w->setProperty("ukui_defaultBrush", defaultBrush); ++ w->setProperty("ukui_onBrush", onBrush); ++ w->setProperty("ukui_hoverBrush", hoverBrush); ++ w->setProperty("ukui_disableBrush", disableBrush); ++ w->setProperty("ukui_editBrush", editBrush); ++ w->setProperty("ukui_defaultPen", defaultPen); ++ w->setProperty("ukui_hoverPen", hoverPen); ++ w->setProperty("ukui_disablePen", disablePen); ++ w->setProperty("ukui_onPen", onPen); ++ w->setProperty("ukui_editPen", editPen); ++ } ++ + if (widget) { + if (widget->property("setRadius").isValid() && widget->property("setRadius").canConvert()) { + radius = widget->property("setRadius").value(); +@@ -2118,7 +2235,8 @@ void UKUIConfigStyleParameters::initConfigComboBoxParameters(bool isDark, const + + void UKUIConfigStyleParameters::initConfigListParameters(bool isDark, const QStyleOption *option, const QWidget *widget) + { +- int radius = m_radiusStruct.normalRadius; ++ int radius = (widget && widget->property("normalRadius").isValid()) ? widget->property("normalRadius").toInt() : m_radiusStruct.normalRadius; ++ + + bool needTranslucent = false; + bool highlightMode = false; +@@ -2216,6 +2334,18 @@ void UKUIConfigStyleParameters::initConfigListParameters(bool isDark, const QSty + break; + } + ++ auto *w = const_cast(widget); ++ if(w){ ++ w->setProperty("ukui_radius", radius); ++ w->setProperty("ukui_defaultBrush", defaultBrush); ++ w->setProperty("ukui_hoverBrush", hoverBrush); ++ w->setProperty("ukui_disableBrush", disableBrush); ++ w->setProperty("ukui_selectBrush", selectBrush); ++ w->setProperty("ukui_textHoverPen", textHoverPen); ++ w->setProperty("ukui_textSelectPen", textSelectPen); ++ w->setProperty("ukui_hoverPen", hoverPen); ++ w->setProperty("ukui_selectPen", selectPen); ++ } + if (widget) { + if (widget->property("setRadius").isValid() && widget->property("setRadius").canConvert()) { + radius = widget->property("setRadius").value(); +@@ -2259,7 +2389,8 @@ void UKUIConfigStyleParameters::initConfigListParameters(bool isDark, const QSty + + void UKUIConfigStyleParameters::initConfigTreeParameters(bool isDark, const QStyleOption *option, const QWidget *widget) + { +- int radius = m_radiusStruct.normalRadius;; ++ int radius = (widget && widget->property("normalRadius").isValid()) ? widget->property("normalRadius").toInt() : m_radiusStruct.normalRadius; ++; + + bool highlightMode = false; + if (widget && widget->property("highlightMode").isValid()) { +@@ -2342,8 +2473,23 @@ void UKUIConfigStyleParameters::initConfigTreeParameters(bool isDark, const QSty + branchSelectBrush = selectBrush; + branchDisableBrush = disableBrush; + ++ auto *w = const_cast(widget); ++ if(w){ ++ w->setProperty("ukui_radius", radius); ++ w->setProperty("ukui_defaultBrush", defaultBrush); ++ w->setProperty("ukui_hoverBrush", hoverBrush); ++ w->setProperty("ukui_disableBrush", disableBrush); ++ w->setProperty("ukui_selectBrush", selectBrush); ++ w->setProperty("ukui_branchDefaultBrush", branchDefaultBrush); ++ w->setProperty("ukui_branchHoverBrush", branchHoverBrush); ++ w->setProperty("ukui_branchSelectBrush", branchSelectBrush); ++ w->setProperty("ukui_branchDisableBrush", branchDisableBrush); ++ w->setProperty("ukui_textHoverPen", textHoverPen); ++ w->setProperty("ukui_textSelectPen", textSelectPen); ++ w->setProperty("ukui_hoverPen", hoverPen); ++ w->setProperty("ukui_selectPen", selectPen); ++ } + if (widget) { +- + if (widget->property("setRadius").isValid() && widget->property("setRadius").canConvert()) { + radius = widget->property("setRadius").value(); + } +@@ -2404,7 +2550,8 @@ void UKUIConfigStyleParameters::initConfigTreeParameters(bool isDark, const QSty + + void UKUIConfigStyleParameters::initConfigTableParameters(bool isDark, const QStyleOption *option, const QWidget *widget) + { +- int radius = m_radiusStruct.normalRadius; ++ int radius = (widget && widget->property("normalRadius").isValid()) ? widget->property("normalRadius").toInt() : m_radiusStruct.normalRadius; ++ + + bool highlightMode = false; + if (widget && widget->property("highlightMode").isValid()) { +@@ -2473,6 +2620,19 @@ void UKUIConfigStyleParameters::initConfigTableParameters(bool isDark, const QSt + default: + break; + } ++ ++ auto *w = const_cast(widget); ++ if(w){ ++ w->setProperty("ukui_radius", radius); ++ w->setProperty("ukui_defaultBrush", defaultBrush); ++ w->setProperty("ukui_hoverBrush", hoverBrush); ++ w->setProperty("ukui_disableBrush", disableBrush); ++ w->setProperty("ukui_selectBrush", selectBrush); ++ w->setProperty("ukui_textHoverPen", textHoverPen); ++ w->setProperty("ukui_textSelectPen", textSelectPen); ++ w->setProperty("ukui_hoverPen", hoverPen); ++ w->setProperty("ukui_selectPen", selectPen); ++ } + if (widget) { + if (widget->property("setRadius").isValid() && widget->property("setRadius").canConvert()) { + radius = widget->property("setRadius").value(); +@@ -2524,7 +2684,7 @@ void UKUIConfigStyleParameters::initConfigCheckBoxParameters(bool isDark, const + + UKUIColorTheme::CheckBoxColorCfg checkboxColorCfg = readCfg()->checkBoxColorCfg(option->palette, needTranslucent ? C_CheckBox_Translucent : C_CheckBox_Default); + +- int radius = m_radiusStruct.minRadius; ++ int radius = (widget && widget->property("minRadius").isValid()) ? widget->property("minRadius").toInt() : m_radiusStruct.minRadius; + + QPen defaultPen = QPen(checkboxColorCfg.defaultPen, 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin); + QPen hoverPen = QPen(checkboxColorCfg.hoverPen, 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin); +@@ -2710,6 +2870,29 @@ void UKUIConfigStyleParameters::initConfigCheckBoxParameters(bool isDark, const + break; + } + ++ auto *w = const_cast(widget); ++ if(w){ ++ w->setProperty("ukui_radius", radius); ++ w->setProperty("ukui_defaultBrush", defaultBrush); ++ w->setProperty("ukui_hoverBrush", hoverBrush); ++ w->setProperty("ukui_clickBrush", clickBrush); ++ w->setProperty("ukui_disableBrush", disableBrush); ++ w->setProperty("ukui_onDefaultBrush", onDefaultBrush); ++ w->setProperty("ukui_onHoverBrush", onHoverBrush); ++ w->setProperty("ukui_onClickBrush", onClickBrush); ++ w->setProperty("ukui_pathDisableBrush", pathDisableBrush); ++ w->setProperty("ukui_pathBrush", pathBrush); ++ w->setProperty("ukui_contentPen", contentPen); ++ w->setProperty("ukui_defaultPen", defaultPen); ++ w->setProperty("ukui_disablePen", disablePen); ++ w->setProperty("ukui_hoverPen", hoverPen); ++ w->setProperty("ukui_clickPen", clickPen); ++ w->setProperty("ukui_onDefaultPen", onDefaultPen); ++ w->setProperty("ukui_onHoverPen", onHoverPen); ++ w->setProperty("ukui_onClickPen", onClickPen); ++ w->setProperty("ukui_onHoverBrushIslinearGradient", onHoverBrushIslinearGradient); ++ } ++ + if (widget) { + if (widget->property("setRadius").isValid() && widget->property("setRadius").canConvert()) { + radius = widget->property("setRadius").value(); +@@ -2770,6 +2953,9 @@ void UKUIConfigStyleParameters::initConfigCheckBoxParameters(bool isDark, const + } + } + ++// qDebug() << "defaultpen..." << defaultPen.color().red() << defaultPen.color().green() << defaultPen.color().blue(); ++ ++// qDebug() << "defaultbrush..." << defaultBrush.color().red() << defaultBrush.color().green() << defaultBrush.color().blue(); + m_CheckBoxParameters.radius = radius; + m_CheckBoxParameters.checkBoxDefaultPen = defaultPen; + m_CheckBoxParameters.checkBoxHoverPen = hoverPen; +@@ -2795,7 +2981,7 @@ void UKUIConfigStyleParameters::initConfigCheckBoxParameters(bool isDark, const + + void UKUIConfigStyleParameters::initConfigRadioButtonParameters(bool isDark, const QStyleOption *option, const QWidget *widget) + { +- m_RadioButtonParameters.radius = m_radiusStruct.normalRadius; ++ m_RadioButtonParameters.radius = (widget && widget->property("normalRadius").isValid()) ? widget->property("normalRadius").toInt() : m_radiusStruct.normalRadius; + + UKUIColorTheme::RadioButtonColorCfg radioButtonColorCfg = readCfg()->radioButtonColorCfg(option->palette, C_RadioButton_Default); + QPen defaultPen = QPen(radioButtonColorCfg.defaultPen, 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin); +@@ -2911,6 +3097,29 @@ void UKUIConfigStyleParameters::initConfigRadioButtonParameters(bool isDark, con + break; + } + ++ auto *w = const_cast(widget); ++ if(w){ ++ w->setProperty("ukui_radius", radius); ++ w->setProperty("ukui_defaultBrush", defaultBrush); ++ w->setProperty("ukui_hoverBrush", hoverBrush); ++ w->setProperty("ukui_clickBrush", clickBrush); ++ w->setProperty("ukui_disableBrush", disableBrush); ++ w->setProperty("ukui_onDefaultBrush", onDefaultBrush); ++ w->setProperty("ukui_onHoverBrush", onHoverBrush); ++ w->setProperty("ukui_onClickBrush", onClickBrush); ++ w->setProperty("ukui_childrenOnDefaultBrush", childrenOnDefaultBrush); ++ w->setProperty("ukui_childrenOnHoverBrush", childrenOnHoverBrush); ++ w->setProperty("ukui_childrenOnClickBrush", childrenOnClickBrush); ++ w->setProperty("ukui_childrenOnDisableBrush", childrenOnDisableBrush); ++ w->setProperty("ukui_defaultPen", defaultPen); ++ w->setProperty("ukui_disablePen", disablePen); ++ w->setProperty("ukui_hoverPen", hoverPen); ++ w->setProperty("ukui_clickPen", clickPen); ++ w->setProperty("ukui_onDefaultPen", onDefaultPen); ++ w->setProperty("ukui_onHoverPen", onHoverPen); ++ w->setProperty("ukui_onClickPen", onClickPen); ++ } ++ + //if set property + if (widget) { + if (widget->property("setDefaultPen").isValid() && widget->property("setDefaultPen").canConvert()) { +@@ -3160,6 +3369,26 @@ void UKUIConfigStyleParameters::initConfigSliderParameters(bool isDark, const QS + break; + } + ++ auto *w = const_cast(widget); ++ if(w){ ++ w->setProperty("ukui_grooveRadius", grooveRadius); ++ w->setProperty("ukui_handleDefaultBrush", handleDefaultBrush); ++ w->setProperty("ukui_handleHoverBrush", handleHoverBrush); ++ w->setProperty("ukui_handleClickBrush", handleClickBrush); ++ w->setProperty("ukui_handleDisableBrush", handleDisableBrush); ++ w->setProperty("ukui_grooveValueDefaultBrush", grooveValueDefaultBrush); ++ w->setProperty("ukui_grooveValueHoverBrush", grooveValueHoverBrush); ++ w->setProperty("ukui_grooveValueDisableBrush", grooveValueDisableBrush); ++ w->setProperty("ukui_grooveUnvalueDefaultBrush", grooveUnvalueDefaultBrush); ++ w->setProperty("ukui_grooveUnvalueHoverBrush", grooveUnvalueHoverBrush); ++ w->setProperty("ukui_grooveUnvalueDisableBrush", grooveUnvalueDisableBrush); ++ w->setProperty("ukui_handleDefaultPen", handleDefaultPen); ++ w->setProperty("ukui_handleHoverPen", handleHoverPen); ++ w->setProperty("ukui_handleClickPen", handleClickPen); ++ w->setProperty("ukui_handleDisablePen", handleDisablePen); ++ w->setProperty("ukui_sliderGroovePen; ", sliderGroovePen); ++ } ++ + if (widget) { + if (widget->property("setGrooveRadius").isValid() && widget->property("setGrooveRadius").canConvert()) { + grooveRadius = widget->property("setGrooveRadius").value(); +@@ -3220,25 +3449,26 @@ void UKUIConfigStyleParameters::initConfigSliderParameters(bool isDark, const QS + m_SliderParameters.sliderHandleDisableBrush = handleDisableBrush; + + m_SliderParameters.sliderGrooveValueDefaultBrush = grooveValueDefaultBrush; +- m_SliderParameters.sliderGrooveValueHoverBrush = grooveValueHoverBrush; ++ m_SliderParameters.sliderGrooveValueHoverBrush = grooveValueHoverBrush; + m_SliderParameters.sliderGrooveValueDisableBrush = grooveValueDisableBrush; + + m_SliderParameters.sliderGrooveUnvalueDefaultBrush = grooveUnvalueDefaultBrush; +- m_SliderParameters.sliderGrooveUnvalueHoverBrush = grooveUnvalueHoverBrush; ++ m_SliderParameters.sliderGrooveUnvalueHoverBrush = grooveUnvalueHoverBrush; + m_SliderParameters.sliderGrooveUnvalueDisableBrush = grooveUnvalueDisableBrush; + + m_SliderParameters.sliderHandleDefaultPen = handleDefaultPen; +- m_SliderParameters.sliderHandleHoverPen = handleHoverPen; +- m_SliderParameters.sliderHandleClickPen = handleClickPen; ++ m_SliderParameters.sliderHandleHoverPen = handleHoverPen; ++ m_SliderParameters.sliderHandleClickPen = handleClickPen; + m_SliderParameters.sliderHandleDisablePen = handleDisablePen; +- m_SliderParameters.sliderGroovePen = sliderGroovePen; ++ m_SliderParameters.sliderGroovePen = sliderGroovePen; + + m_SliderParameters.sliderHandlePath = handlePath; + } + + void UKUIConfigStyleParameters::initConfigProgressBarParameters(bool isDark, const QStyleOption *option, const QWidget *widget) + { +- int radius = widget ? (widget->height() / 2 > m_radiusStruct.normalRadius ? m_radiusStruct.normalRadius : widget->height() / 2) : m_radiusStruct.normalRadius; ++ int normalRadius = (widget && widget->property("normalRadius").isValid()) ? widget->property("normalRadius").toInt() : m_radiusStruct.normalRadius; ++ int radius = widget ? (widget->height() / 2 > normalRadius ? normalRadius : widget->height() / 2) : normalRadius; + + bool needTranslucent = false; + if (widget && widget->property("needTranslucent").isValid()) { +@@ -3318,6 +3548,19 @@ void UKUIConfigStyleParameters::initConfigProgressBarParameters(bool isDark, con + break; + } + ++ auto *w = const_cast(widget); ++ if(w){ ++ w->setProperty("ukui_radius", radius); ++ w->setProperty("ukui_contentPen", contentPen); ++ w->setProperty("ukui_grooveDefaultPen", grooveDefaultPen); ++ w->setProperty("ukui_grooveDisablePen", grooveDisablePen); ++ w->setProperty("ukui_contentBrush", contentBrush); ++ w->setProperty("ukui_grooveDefaultBrush", grooveDefaultBrush); ++ w->setProperty("ukui_grooveDisableBrush", grooveDisableBrush); ++ w->setProperty("ukui_endColor", endColor); ++ w->setProperty("ukui_= startColor", startColor); ++ } ++ + if(widget){ + if (widget->property("setRadius").isValid() && widget->property("setRadius").canConvert()) { + radius = widget->property("setRadius").value(); +@@ -3379,7 +3622,8 @@ void UKUIConfigStyleParameters::initConfigScrollBarParameters(bool isDark, const + const QStyleOptionSlider *bar = qstyleoption_cast(option); + + //radius +- if(m_radiusStruct.normalRadius != 0){ ++ int normalRadius = (widget && widget->property("normalRadius").isValid()) ? widget->property("normalRadius").toInt() : m_radiusStruct.normalRadius; ++ if(normalRadius != 0){ + if (bar->orientation == Qt::Horizontal) { + sliderRadius = (bar->rect.height()) / 4; + } else { +@@ -3390,7 +3634,8 @@ void UKUIConfigStyleParameters::initConfigScrollBarParameters(bool isDark, const + ScroolBar_LineLength = 0; + } + else{ +- sliderRadius = m_radiusStruct.normalRadius; ++ int normalRadius = (widget && widget->property("normalRadius").isValid()) ? widget->property("normalRadius").toInt() : m_radiusStruct.normalRadius; ++ sliderRadius = normalRadius; + m_ScrollBarParameters.grooveWidthAnimation = false; + ScrooBar_ShowLine = true; + ScroolBar_LineLength = 16; +@@ -3462,6 +3707,16 @@ void UKUIConfigStyleParameters::initConfigScrollBarParameters(bool isDark, const + break; + } + ++ auto *w = const_cast(widget); ++ if(w){ ++ w->setProperty("ukui_radius", sliderRadius); ++ w->setProperty("ukui_grooveDefaultBrush", grooveDefaultBrush); ++ w->setProperty("ukui_grooveInactiveBrush", grooveInactiveBrush); ++ w->setProperty("ukui_sliderDefaultBrush", sliderDefaultBrush); ++ w->setProperty("ukui_sliderHoverBrush", sliderHoverBrush); ++ w->setProperty("ukui_sliderClickBrush", sliderClickBrush); ++ w->setProperty("ukui_sliderDisableBrush", sliderDisableBrush); ++ } + if(widget){ + if (widget->property("setRadius").isValid() && widget->property("setRadius").canConvert()) { + radius = widget->property("setRadius").value(); +@@ -3525,7 +3780,7 @@ void UKUIConfigStyleParameters::initConfigToolTipParameters(bool isDark, const Q + } + QBrush backgroundBrush = color; + +- int radius = m_radiusStruct.normalRadius; ++ int radius = (widget && widget->property("normalRadius").isValid()) ? widget->property("normalRadius").toInt() : m_radiusStruct.normalRadius; + + if(widget){ + if (widget->property("setRadius").isValid() && widget->property("setRadius").canConvert()) { +@@ -3539,6 +3794,12 @@ void UKUIConfigStyleParameters::initConfigToolTipParameters(bool isDark, const Q + } + } + ++ auto *w = const_cast(widget); ++ if(w){ ++ w->setProperty("ukui_radius", radius); ++ w->setProperty("ukui_backgroundBrush", backgroundBrush); ++ w->setProperty("ukui_backgroundPen", backgroundPen); ++ } + m_ToolTipParameters.radius = radius; + m_ToolTipParameters.toolTipBackgroundBrush = backgroundBrush; + m_ToolTipParameters.toolTipBackgroundPen = backgroundPen; +@@ -3546,7 +3807,7 @@ void UKUIConfigStyleParameters::initConfigToolTipParameters(bool isDark, const Q + + void UKUIConfigStyleParameters::initConfigTabWidgetParameters(bool isDark, const QStyleOption *option, const QWidget *widget) + { +- int tabradius = m_radiusStruct.normalRadius; ++ int tabradius = (widget && widget->property("normalRadius").isValid()) ? widget->property("normalRadius").toInt() : m_radiusStruct.normalRadius; + UKUIColorTheme::TabWidgetColorCfg tabWidgetColorCfg = readCfg()->tabWidgetColorCfg(option->palette, C_TabWidget_Default); + + QBrush widgetBackgroundBrush = tabWidgetColorCfg.widgetBackgroundBrush; +@@ -3624,6 +3885,17 @@ void UKUIConfigStyleParameters::initConfigTabWidgetParameters(bool isDark, const + break; + } + ++ auto *w = const_cast(widget); ++ if(w){ ++ w->setProperty("ukui_radius", tabradius); ++ w->setProperty("ukui_widgetBackgroundBrush", widgetBackgroundBrush); ++ w->setProperty("ukui_tabBarBackgroundBrush", tabBarBackgroundBrush); ++ w->setProperty("ukui_tabBarDefaultBrush", tabBarDefaultBrush); ++ w->setProperty("ukui_tabBarHoverBrush", tabBarHoverBrush); ++ w->setProperty("ukui_tabBarClickBrush", tabBarClickBrush); ++ w->setProperty("ukui_tabBarSelectBrush", tabBarSelectBrush); ++ w->setProperty("ukui_tabBarPen", tabBarPen); ++ } + if(widget){ + if (widget->property("setRadius").isValid() && widget->property("setRadius").canConvert()) { + tabradius = widget->property("setRadius").value(); +@@ -3663,8 +3935,8 @@ void UKUIConfigStyleParameters::initConfigTabWidgetParameters(bool isDark, const + + void UKUIConfigStyleParameters::initConfigMenuParameters(bool isDark, const QStyleOption *option, const QWidget *widget) + { +- int frameradius = m_radiusStruct.maxRadius; +- int itemradius = m_radiusStruct.normalRadius; ++ int frameradius = (widget && widget->property("windowRadius").isValid()) ? widget->property("windowRadius").toInt() : m_radiusStruct.maxRadius; ++ int itemradius = (widget && widget->property("normalRadius").isValid()) ? widget->property("normalRadius").toInt() : m_radiusStruct.normalRadius; + // QPixmap framePixmap(option->rect.size()); + UKUIColorTheme::MenuColorCfg menuColorCfg = readCfg()->menuColorCfg(C_Menu_Default); + +@@ -3708,6 +3980,15 @@ void UKUIConfigStyleParameters::initConfigMenuParameters(bool isDark, const QSty + } + QBrush menuBackgroundBrush = color; + ++ auto *w = const_cast(widget); ++ if(w){ ++ w->setProperty("ukui_frameradius", frameradius); ++ w->setProperty("ukui_itemradius", itemradius); ++ w->setProperty("ukui_menuBackgroundBrush", menuBackgroundBrush); ++ w->setProperty("ukui_menuBackgroundPen", menuBackgroundPen); ++ w->setProperty("ukui_itemSelectBrush", itemSelectBrush); ++ w->setProperty("ukui_menuHoverPen", menuHoverPen); ++ } + + if(widget){ + if (widget->property("setFrameRadius").isValid() && widget->property("setFrameRadius").canConvert()) { +diff --git a/ukui-styles/qt5-config-style-ukui/ukui-config-style-parameters.h b/ukui-styles/qt5-config-style-ukui/ukui-config-style-parameters.h +index 585c166..7f90729 100644 +--- a/ukui-styles/qt5-config-style-ukui/ukui-config-style-parameters.h ++++ b/ukui-styles/qt5-config-style-ukui/ukui-config-style-parameters.h +@@ -284,7 +284,7 @@ public: + bool TabBar_SplitLine = true; + + // tooltip +- int ToolTip_DefaultMargin = 8; ++ int ToolTip_DefaultMargin = 10; + int ToolTip_Height = 36; + int ToolTip_Height_origin = 36; + +diff --git a/ukui-styles/qt5-config-style-ukui/ukui-config-style.cpp b/ukui-styles/qt5-config-style-ukui/ukui-config-style.cpp +index d07001e..e5150a9 100644 +--- a/ukui-styles/qt5-config-style-ukui/ukui-config-style.cpp ++++ b/ukui-styles/qt5-config-style-ukui/ukui-config-style.cpp +@@ -202,8 +202,8 @@ UKUIConfigStyle::UKUIConfigStyle(bool dark, bool useDefault, QString type) : QPr + } else { + qWarning("org.ukui.peripherals-mouse no doubleClick keys!"); + } +- settings->deleteLater(); +- settings = nullptr; ++// settings->deleteLater(); ++// settings = nullptr; + } else { + qWarning("org.ukui.peripherals-mouse is null!"); + } +@@ -265,7 +265,13 @@ UKUIConfigStyle::UKUIConfigStyle(bool dark, bool useDefault, QString type) : QPr + + sp = new UKUIConfigStyleParameters(this, isUseDarkPalette(), m_widget_theme); + +- setProperty("maxRadius", sp->radiusProperty().maxRadius); ++ if (UKUIStyleSettings::isSchemaInstalled("org.ukui.style")) { ++ auto settings = UKUIStyleSettings::globalInstance(); ++ if(settings->keys().contains("windowRadius")) ++ setProperty("windowRadius", settings->get("windowRadius").toInt()); ++ else ++ setProperty("windowRadius", sp->radiusProperty().maxRadius); ++ } + setProperty("normalRadius", sp->radiusProperty().normalRadius); + setProperty("minRadius", sp->radiusProperty().minRadius); + } +@@ -362,6 +368,7 @@ bool UKUIConfigStyle::eventFilter(QObject *obj, QEvent *e) + // } + // return false; + // } ++ + if (obj != nullptr && obj->inherits("QTipLabel")) + { + auto label = qobject_cast(obj); +@@ -635,6 +642,16 @@ bool UKUIConfigStyle::eventFilter(QObject *obj, QEvent *e) + + } + ++ ++ if (qobject_cast(obj)) { ++ if (e->type() == QEvent::Show) { ++ if (QMenu *w = qobject_cast(obj)) { ++ if (!KWindowSystem::compositingActive()) { ++ w->setProperty("useSystemStyleBlur", false); ++ } ++ } ++ } ++ } + return false; + } + +@@ -718,7 +735,61 @@ QPalette UKUIConfigStyle::standardPalette() const + if (auto settings = UKUIStyleSettings::globalInstance()) { + QString themeColor = settings->get("themeColor").toString(); + themeColor = settings->get("theme-color").toString(); +- setThemeColor(themeColor, palette); ++ ++ QColor color = palette.color(QPalette::Active, QPalette::Highlight); ++ if (themeColor == "default") { ++ ++ } else if (themeColor == "daybreakBlue") { ++ color = QColor(55, 144, 250); ++ } else if (themeColor == "jamPurple") { ++ color = QColor(120, 115, 245); ++ } else if (themeColor == "magenta") { ++ color = QColor(235, 48, 150); ++ } else if (themeColor == "sunRed") { ++ color = QColor(243, 34, 45); ++ } else if (themeColor == "sunsetOrange") { ++ color = QColor(246, 140, 39); ++ } else if (themeColor == "dustGold") { ++ color = QColor(249, 197, 61); ++ } else if (themeColor == "polarGreen") { ++ color = QColor(82, 196, 41); ++ } ++ else if(!themeColor.isEmpty() && themeColor.startsWith("(") && themeColor.endsWith(")")){ ++ QColor c = color; ++ QString colorStr = themeColor; ++ colorStr = colorStr.remove(colorStr.length() - 1, 1); ++ colorStr = colorStr.remove(0, 1); ++ QStringList list = colorStr.split(","); ++ if (list.length() == 3 || list.length() == 4) { ++ c.setRed(list[0].toInt()); ++ c.setGreen(list[1].toInt()); ++ c.setBlue(list[2].toInt()); ++ if (list.length() == 4) { ++ QStringList alphaList = QString(list[3]).split("*"); ++ if (alphaList.length() == 2) { ++ if (alphaList[0].toFloat() == 255.0) ++ c.setAlphaF(alphaList[1].toFloat()); ++ else if (alphaList[1].toFloat() == 255.0) ++ c.setAlphaF(alphaList[0].toFloat()); ++ else ++ c.setAlphaF(alphaList[0].toFloat() * alphaList[1].toFloat() / 255.0); ++ ++ } else if (alphaList.length() == 1) { ++ if(alphaList[0].toFloat() <= 1.0) ++ c.setAlphaF(alphaList[0].toFloat()); ++ else ++ c.setAlpha(alphaList[0].toInt()); ++ } else ++ c.setAlphaF(1.0); ++ } ++ }/* else if (list.length() == 1 && list[0].startsWith("#")) { ++ c = list[0]; ++ }*/ ++ ++ color = c; ++ } ++ ++ setThemeColor(color, palette); + sp->setUKUIThemeColor(themeColor); + } + +@@ -817,32 +888,10 @@ QColor UKUIConfigStyle::highLight_Hover(const QStyleOption *option) const + + + +-void UKUIConfigStyle::setThemeColor(QString themeColor, QPalette &palette) const ++void UKUIConfigStyle::setThemeColor(QColor color, QPalette &palette) const + { +- 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(120, 115, 245)); +- palette.setColor(QPalette::Inactive, QPalette::Highlight, QColor(120, 115, 245)); +- } else if (themeColor == "magenta") { +- palette.setColor(QPalette::Active, QPalette::Highlight, QColor(235, 48, 150)); +- palette.setColor(QPalette::Inactive, QPalette::Highlight, QColor(235, 48, 150)); +- } else if (themeColor == "sunRed") { +- palette.setColor(QPalette::Active, QPalette::Highlight, QColor(243, 34, 45)); +- palette.setColor(QPalette::Inactive, QPalette::Highlight, QColor(243, 34, 45)); +- } else if (themeColor == "sunsetOrange") { +- palette.setColor(QPalette::Active, QPalette::Highlight, QColor(246, 140, 39)); +- palette.setColor(QPalette::Inactive, QPalette::Highlight, QColor(246, 140, 39)); +- } else if (themeColor == "dustGold") { +- palette.setColor(QPalette::Active, QPalette::Highlight, QColor(249, 197, 61)); +- palette.setColor(QPalette::Inactive, QPalette::Highlight, QColor(249, 197, 61)); +- } else if (themeColor == "polarGreen") { +- palette.setColor(QPalette::Active, QPalette::Highlight, QColor(82, 196, 41)); +- palette.setColor(QPalette::Inactive, QPalette::Highlight, QColor(82, 196, 41)); +- } ++ palette.setColor(QPalette::Active, QPalette::Highlight, color); ++ palette.setColor(QPalette::Inactive, QPalette::Highlight, color); + } + + void UKUIConfigStyle::updateTabletModeValue(bool isTabletMode) +@@ -921,9 +970,28 @@ void UKUIConfigStyle::polish(QWidget *widget) + if(!widget) + return; + +- widget->setProperty("maxRadius", sp->radiusProperty().maxRadius); +- widget->setProperty("normalRadius", sp->radiusProperty().normalRadius); +- widget->setProperty("minRadius", sp->radiusProperty().minRadius); ++ if (UKUIStyleSettings::isSchemaInstalled("org.ukui.style")) { ++ auto settings = UKUIStyleSettings::globalInstance(); ++ if(settings->keys().contains("windowRadius")) ++ widget->setProperty("windowRadius", settings->get("windowRadius").toInt()); ++ else ++ widget->setProperty("windowRadius", sp->radiusProperty().maxRadius); ++ } ++ ++// if(settings->keys().contains("normalRadius")) ++// widget->setProperty("normalRadius", settings->get("normalRadius").toInt()); ++// else ++// widget->setProperty("normalRadius", sp->radiusProperty().normalRadius); ++ ++// if(settings->keys().contains("minRadius")) ++// widget->setProperty("minRadius", settings->get("minRadius").toInt()); ++// else ++// widget->setProperty("minRadius", sp->radiusProperty().minRadius); ++// } ++// else{ ++ widget->setProperty("normalRadius", sp->radiusProperty().normalRadius); ++ widget->setProperty("minRadius", sp->radiusProperty().minRadius); ++// } + + + Style::polish(widget); +@@ -5391,15 +5459,17 @@ void UKUIConfigStyle::drawControl(QStyle::ControlElement element, const QStyleOp + bool hasIcon = false; + if(isComboBox) + { +- auto *comboBox = qobject_cast(widget); +- int column = comboBox->count(); +- for(int i = 0; i < column; i++) +- { +- if(!comboBox->itemIcon(i).isNull()){ +- hasIcon = true; +- break; +- } +- } ++ if(!menuItem->icon.isNull()) ++ hasIcon = true; ++// auto *comboBox = qobject_cast(widget); ++// int column = comboBox->count(); ++// for(int i = 0; i < column; i++) ++// { ++// if(!comboBox->itemIcon(i).isNull()){ ++// hasIcon = true; ++// break; ++// } ++// } + } + else if(menuItem->maxIconWidth != 0) + hasIcon = true; +@@ -7167,15 +7237,17 @@ QSize UKUIConfigStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt + bool hasIcon = false; + if(isComboBox) + { +- auto *comboBox = qobject_cast(widget); +- int column = comboBox->count(); +- for(int i = 0; i < column; i++) +- { +- if(!comboBox->itemIcon(i).isNull()){ +- hasIcon = true; +- break; +- } +- } ++ if(!menuItem->icon.isNull()) ++ hasIcon = true; ++// auto *comboBox = qobject_cast(widget); ++// int column = comboBox->count(); ++// for(int i = 0; i < column; i++) ++// { ++// if(!comboBox->itemIcon(i).isNull()){ ++// hasIcon = true; ++// break; ++// } ++// } + } + else if(menuItem->maxIconWidth != 0) + { +diff --git a/ukui-styles/qt5-config-style-ukui/ukui-config-style.h b/ukui-styles/qt5-config-style-ukui/ukui-config-style.h +index dbf330b..18f4c11 100644 +--- a/ukui-styles/qt5-config-style-ukui/ukui-config-style.h ++++ b/ukui-styles/qt5-config-style-ukui/ukui-config-style.h +@@ -159,7 +159,7 @@ private: + QColor highLight_Click(const QStyleOption *option) const; + QColor highLight_Hover(const QStyleOption *option) const; + +- void setThemeColor(QString themeColor, QPalette &palette) const; ++ void setThemeColor(QColor color, QPalette &palette) const; + + // view + QString calculateElidedText(const QString &text, const QTextOption &textOption, +diff --git a/ukui-styles/qt5-style-ukui/kabstract-style-parameters.cpp b/ukui-styles/qt5-style-ukui/kabstract-style-parameters.cpp +deleted file mode 100644 +index ccbdebb..0000000 +--- a/ukui-styles/qt5-style-ukui/kabstract-style-parameters.cpp ++++ /dev/null +@@ -1,3953 +0,0 @@ +-/* +- * Qt5-UKUI's Library +- * +- * Copyright (C) 2023, KylinSoft Co., Ltd. +- * +- * This library is free software; you can redistribute it and/or +- * modify it under the terms of the GNU Lesser General Public +- * License as published by the Free Software Foundation; either +- * version 3 of the License, or (at your option) any later version. +- * +- * This library is distributed in the hope that it will be useful, +- * but WITHOUT ANY WARRANTY; without even the implied warranty of +- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +- * Lesser General Public License for more details. +- * +- * You should have received a copy of the GNU General Public License +- * along with this library. If not, see . +- * +- * Authors: xibowen +- * +- */ +- +- +-#include +-#include +-#include +-#include +-#include +-#include +-#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) +-{ +- QDBusMessage message = QDBusMessage::createMethodCall("com.kylin.statusmanager.interface", +- "/", +- "com.kylin.statusmanager.interface", +- "get_current_tabletmode"); +- QDBusMessage ret = QDBusConnection::sessionBus().call(message); +- if (ret.type() != QDBusMessage::ReplyMessage) +- { +- //从返回参数获取返回值 +- qDebug() << "complex type failed!"; +- } +- else +- { +- m_isTableMode = ret.arguments()[0].value(); +- } +- +- updateParameters(m_isTableMode); +- auto settings = UKUIStyleSettings::globalInstance(); +- auto styleName = settings->get("styleName").toString(); +- +-} +- +-QPalette KAbstractStyleParameters::setPalette(QPalette &palette) +-{ +- palette.setColor(QPalette::Active, QPalette::WindowText, defaultPalette.color(QPalette::Active, QPalette::WindowText)); +- palette.setColor(QPalette::Inactive, QPalette::WindowText, defaultPalette.color(QPalette::Inactive, QPalette::WindowText)); +- palette.setColor(QPalette::Disabled, QPalette::WindowText, defaultPalette.color(QPalette::Disabled, QPalette::WindowText)); +- +- palette.setColor(QPalette::Active, QPalette::Button, defaultPalette.color(QPalette::Active, QPalette::Button)); +- palette.setColor(QPalette::Inactive, QPalette::Button, defaultPalette.color(QPalette::Inactive, QPalette::Button)); +- palette.setColor(QPalette::Disabled, QPalette::Button, defaultPalette.color(QPalette::Disabled, QPalette::Button)); +- +- palette.setColor(QPalette::Active, QPalette::Light, defaultPalette.color(QPalette::Active, QPalette::Light)); +- palette.setColor(QPalette::Inactive, QPalette::Light, defaultPalette.color(QPalette::Inactive, QPalette::Light)); +- palette.setColor(QPalette::Disabled, QPalette::Light, defaultPalette.color(QPalette::Disabled, QPalette::Light)); +- +- palette.setColor(QPalette::Active, QPalette::Midlight, defaultPalette.color(QPalette::Active, QPalette::Midlight)); +- palette.setColor(QPalette::Inactive, QPalette::Midlight, defaultPalette.color(QPalette::Inactive, QPalette::Midlight)); +- palette.setColor(QPalette::Disabled, QPalette::Midlight, defaultPalette.color(QPalette::Disabled, QPalette::Midlight)); +- +- palette.setColor(QPalette::Active, QPalette::Dark, defaultPalette.color(QPalette::Active, QPalette::Dark)); +- palette.setColor(QPalette::Inactive, QPalette::Dark, defaultPalette.color(QPalette::Inactive, QPalette::Dark)); +- palette.setColor(QPalette::Disabled, QPalette::Dark, defaultPalette.color(QPalette::Disabled, QPalette::Dark)); +- +- palette.setColor(QPalette::Active, QPalette::Mid, defaultPalette.color(QPalette::Active, QPalette::Mid)); +- palette.setColor(QPalette::Inactive, QPalette::Mid, defaultPalette.color(QPalette::Inactive, QPalette::Mid)); +- palette.setColor(QPalette::Disabled, QPalette::Mid, defaultPalette.color(QPalette::Disabled, QPalette::Mid)); +- +- palette.setColor(QPalette::Active, QPalette::Text, defaultPalette.color(QPalette::Active, QPalette::Text)); +- palette.setColor(QPalette::Inactive, QPalette::Text, defaultPalette.color(QPalette::Inactive, QPalette::Text)); +- palette.setColor(QPalette::Disabled, QPalette::Text, defaultPalette.color(QPalette::Disabled, QPalette::Text)); +- +- palette.setColor(QPalette::Active, QPalette::BrightText, defaultPalette.color(QPalette::Active, QPalette::BrightText)); +- palette.setColor(QPalette::Inactive, QPalette::BrightText, defaultPalette.color(QPalette::Inactive, QPalette::BrightText)); +- palette.setColor(QPalette::Disabled, QPalette::BrightText, defaultPalette.color(QPalette::Disabled, QPalette::BrightText)); +- +- palette.setColor(QPalette::Active, QPalette::ButtonText, defaultPalette.color(QPalette::Active, QPalette::ButtonText)); +- palette.setColor(QPalette::Inactive, QPalette::ButtonText, defaultPalette.color(QPalette::Inactive, QPalette::ButtonText)); +- palette.setColor(QPalette::Disabled, QPalette::ButtonText, defaultPalette.color(QPalette::Disabled, QPalette::ButtonText)); +- +- palette.setColor(QPalette::Active, QPalette::Base, defaultPalette.color(QPalette::Active, QPalette::Base)); +- palette.setColor(QPalette::Inactive, QPalette::Base, defaultPalette.color(QPalette::Inactive, QPalette::Base)); +- palette.setColor(QPalette::Disabled, QPalette::Base, defaultPalette.color(QPalette::Disabled, QPalette::Base)); +- +- palette.setColor(QPalette::Active, QPalette::Window, defaultPalette.color(QPalette::Active, QPalette::Window)); +- palette.setColor(QPalette::Inactive, QPalette::Window, defaultPalette.color(QPalette::Inactive, QPalette::Window)); +- palette.setColor(QPalette::Disabled, QPalette::Window, defaultPalette.color(QPalette::Disabled, QPalette::Window)); +- +- palette.setColor(QPalette::Active, QPalette::Shadow, defaultPalette.color(QPalette::Active, QPalette::Shadow)); +- palette.setColor(QPalette::Inactive, QPalette::Shadow, defaultPalette.color(QPalette::Inactive, QPalette::Shadow)); +- palette.setColor(QPalette::Disabled, QPalette::Shadow, defaultPalette.color(QPalette::Disabled, QPalette::Shadow)); +- +- palette.setColor(QPalette::Active, QPalette::Highlight, defaultPalette.color(QPalette::Active, QPalette::Highlight)); +- palette.setColor(QPalette::Inactive, QPalette::Highlight, defaultPalette.color(QPalette::Inactive, QPalette::Highlight)); +- palette.setColor(QPalette::Disabled, QPalette::Highlight, defaultPalette.color(QPalette::Disabled, QPalette::Highlight)); +- +- palette.setColor(QPalette::Active, QPalette::HighlightedText, defaultPalette.color(QPalette::Active, QPalette::HighlightedText)); +- palette.setColor(QPalette::Inactive, QPalette::HighlightedText, defaultPalette.color(QPalette::Inactive, QPalette::HighlightedText)); +- palette.setColor(QPalette::Disabled, QPalette::HighlightedText, defaultPalette.color(QPalette::Disabled, QPalette::HighlightedText)); +- +- palette.setColor(QPalette::Active, QPalette::Link, defaultPalette.color(QPalette::Active, QPalette::Link)); +- palette.setColor(QPalette::Inactive, QPalette::Link, defaultPalette.color(QPalette::Inactive, QPalette::Link)); +- palette.setColor(QPalette::Disabled, QPalette::Link, defaultPalette.color(QPalette::Disabled, QPalette::Link)); +- +- palette.setColor(QPalette::Active, QPalette::LinkVisited, defaultPalette.color(QPalette::Active, QPalette::LinkVisited)); +- palette.setColor(QPalette::Inactive, QPalette::LinkVisited, defaultPalette.color(QPalette::Inactive, QPalette::LinkVisited)); +- palette.setColor(QPalette::Disabled, QPalette::LinkVisited, defaultPalette.color(QPalette::Disabled, QPalette::LinkVisited)); +- +- palette.setColor(QPalette::Active, QPalette::AlternateBase, defaultPalette.color(QPalette::Active, QPalette::AlternateBase)); +- palette.setColor(QPalette::Inactive, QPalette::AlternateBase, defaultPalette.color(QPalette::Inactive, QPalette::AlternateBase)); +- palette.setColor(QPalette::Disabled, QPalette::AlternateBase, defaultPalette.color(QPalette::Disabled, QPalette::AlternateBase)); +- +- palette.setColor(QPalette::Active, QPalette::NoRole, defaultPalette.color(QPalette::Active, QPalette::NoRole)); +- palette.setColor(QPalette::Inactive, QPalette::NoRole, defaultPalette.color(QPalette::Inactive, QPalette::NoRole)); +- palette.setColor(QPalette::Disabled, QPalette::NoRole, defaultPalette.color(QPalette::Disabled, QPalette::NoRole)); +- +- palette.setColor(QPalette::Active, QPalette::ToolTipBase, defaultPalette.color(QPalette::Active, QPalette::ToolTipBase)); +- palette.setColor(QPalette::Inactive, QPalette::ToolTipBase, defaultPalette.color(QPalette::Inactive, QPalette::ToolTipBase)); +- palette.setColor(QPalette::Disabled, QPalette::ToolTipBase, defaultPalette.color(QPalette::Disabled, QPalette::ToolTipBase)); +- +- palette.setColor(QPalette::Active, QPalette::ToolTipText, defaultPalette.color(QPalette::Active, QPalette::ToolTipText)); +- palette.setColor(QPalette::Inactive, QPalette::ToolTipText, defaultPalette.color(QPalette::Inactive, QPalette::ToolTipText)); +- palette.setColor(QPalette::Disabled, QPalette::ToolTipText, defaultPalette.color(QPalette::Disabled, QPalette::ToolTipText)); +- +-#if (QT_VERSION >= QT_VERSION_CHECK(5,12,0)) +- palette.setColor(QPalette::Active, QPalette::PlaceholderText, defaultPalette.color(QPalette::Active, QPalette::PlaceholderText)); +- palette.setColor(QPalette::Inactive, QPalette::PlaceholderText, defaultPalette.color(QPalette::Inactive, QPalette::PlaceholderText)); +- palette.setColor(QPalette::Disabled, QPalette::PlaceholderText, defaultPalette.color(QPalette::Disabled, QPalette::PlaceholderText)); +-#endif +- +- return palette; +-} +- +-int KAbstractStyleParameters::getSpinBoxControlLayout() +-{ +- return m_spinBoxControlLayout; +-} +- +-void KAbstractStyleParameters::updateParameters(bool isTabletMode) +-{ +- if(isTabletMode){//styleName == "ukui-dark"){// +- m_scaleRatio4_3 = (4 * 1.0) / 3.0; +- m_scaleRatio3_2 = (3 * 1.0) / 2.0; +- m_scaleRatio2_1 = (2 * 1.0) / 1.0; +- m_scaleSliderDefaultLength = (241 * 1.0) / (94 * 1.0); +- m_ScaleComboBoxDefaultLength = (49 * 1.0) / (40 * 1.0); +- m_ScaleLineEditDefaultLength = (49 * 1.0) / (40 * 1.0); +- m_scaleTabBarHeight6_5 = (6 *1.0) / (5 * 1.0); +- +- m_isTableMode = true; +- m_spinBoxControlLayout = SpinBoxControlLayout::Horizontal; +- m_headerDefaultSectionSizeVertical = m_headerDefaultSectionSizeVertical4_3; +- } +- else{ +- m_scaleRatio4_3 = 1.0; +- m_scaleRatio3_2 = 1.0; +- m_scaleRatio2_1 = 1.0; +- m_scaleSliderDefaultLength = 1.0; +- m_ScaleComboBoxDefaultLength = 1.0; +- m_ScaleLineEditDefaultLength = 1.0; +- m_scaleTabBarHeight6_5 = 1.0; +- +- m_isTableMode = false; +- m_spinBoxControlLayout = SpinBoxControlLayout::Vertical; +- m_headerDefaultSectionSizeVertical = m_headerDefaultSectionSizeVertical1_1; +- } +- +- ComboBox_DefaultMenuItemHeight = ComboBox_DefaultMenuItemHeight_original * m_scaleRatio4_3; +- MenuItem_DefaultHeight = MenuItem_DefaultHeight_origin * m_scaleRatio4_3; +- MenuItemSeparator_MarginHeight = MenuItemSeparator_MarginHeight_origin * m_scaleRatio4_3; +- LineEdit_DefaultHeight = LineEdit_DefaultHeight_origin * m_scaleRatio4_3; +- IconButton_DefaultWidth = IconButton_DefaultWidth_origin * m_scaleRatio4_3; +- Button_DefaultHeight = Button_DefaultHeight_origin * m_scaleRatio4_3; +- SpinBox_DefaultHeight = SpinBox_DefaultHeight_origin * m_scaleRatio4_3; +- ComboBox_DefaultHeight = ComboBox_DefaultHeight_origin * m_scaleRatio4_3; +- RadioButton_DefaultHeight = RadioButton_DefaultHeight_origin * m_scaleRatio4_3; +- CheckBox_DefaultHeight = CheckBox_DefaultHeight_origin * m_scaleRatio4_3; +- Table_HeaderHeight = Table_HeaderHeight_origin * m_scaleRatio4_3; +- ScroolBar_Width = ScroolBar_Width_origin * m_scaleRatio3_2; +- Slider_Length = Slider_Length_origin * m_scaleRatio2_1; +- Slider_GrooveLength = Slider_GrooveLength_origin * m_scaleRatio2_1; +- Slider_DefaultLength = Slider_DefaultLength_origin * m_scaleSliderDefaultLength; +- LineEdit_DefaultWidth = LineEdit_DefaultWidth_origin * m_ScaleLineEditDefaultLength; +- TabBar_DefaultHeight = TabBar_DefaultHeight_origin * m_scaleTabBarHeight6_5; +- ViewItem_DefaultHeight = ViewItem_DefaultHeight_origin * m_scaleRatio4_3; +- ToolTip_Height = ToolTip_Height_origin * m_scaleRatio4_3; +- qDebug() << "updateParameters......... "; +-} +- +-//Default widget theme +-KDefaultStyleParameters::KDefaultStyleParameters(QObject *parent, bool isDark) : KAbstractStyleParameters(parent, isDark) +-{ +- radius = 6; +- +- ColoseButtonColor = QColor(204, 18, 34); +- +- +- initPalette(isDark); +-} +- +-void KDefaultStyleParameters::initPalette(bool isDark) +-{ +- //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(38, 38, 38), +- buttonText_iat(38, 38, 38), +- buttonText_dis(0, 0, 0, 255 * 0.3), +- 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(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, 46); +- 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(217, 217, 217); +- buttonText_iat.setRgb(217, 217, 217); +- buttonText_dis.setRgb(255, 255, 255, 255 * 0.3); +- 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); +- defaultPalette.setColor(QPalette::Inactive, QPalette::WindowText, windowText_iat); +- defaultPalette.setColor(QPalette::Disabled, QPalette::WindowText, windowText_dis); +- +- defaultPalette.setColor(QPalette::Active, QPalette::Button, button_at); +- defaultPalette.setColor(QPalette::Inactive, QPalette::Button, button_iat); +- defaultPalette.setColor(QPalette::Disabled, QPalette::Button, button_dis); +- +- defaultPalette.setColor(QPalette::Active, QPalette::Light, light_at); +- defaultPalette.setColor(QPalette::Inactive, QPalette::Light, light_iat); +- defaultPalette.setColor(QPalette::Disabled, QPalette::Light, light_dis); +- +- defaultPalette.setColor(QPalette::Active, QPalette::Midlight, midlight_at); +- defaultPalette.setColor(QPalette::Inactive, QPalette::Midlight, midlight_iat); +- defaultPalette.setColor(QPalette::Disabled, QPalette::Midlight, midlight_dis); +- +- defaultPalette.setColor(QPalette::Active, QPalette::Dark, dark_at); +- defaultPalette.setColor(QPalette::Inactive, QPalette::Dark, dark_iat); +- defaultPalette.setColor(QPalette::Disabled, QPalette::Dark, dark_dis); +- +- defaultPalette.setColor(QPalette::Active, QPalette::Mid, mid_at); +- defaultPalette.setColor(QPalette::Inactive, QPalette::Mid, mid_iat); +- defaultPalette.setColor(QPalette::Disabled, QPalette::Mid, mid_dis); +- +- defaultPalette.setColor(QPalette::Active, QPalette::Text, text_at); +- defaultPalette.setColor(QPalette::Inactive, QPalette::Text, text_iat); +- defaultPalette.setColor(QPalette::Disabled, QPalette::Text, text_dis); +- +- defaultPalette.setColor(QPalette::Active, QPalette::BrightText, brightText_at); +- defaultPalette.setColor(QPalette::Inactive, QPalette::BrightText, brightText_iat); +- defaultPalette.setColor(QPalette::Disabled, QPalette::BrightText, brightText_dis); +- +- defaultPalette.setColor(QPalette::Active, QPalette::ButtonText, buttonText_at); +- defaultPalette.setColor(QPalette::Inactive, QPalette::ButtonText, buttonText_iat); +- defaultPalette.setColor(QPalette::Disabled, QPalette::ButtonText, buttonText_dis); +- +- defaultPalette.setColor(QPalette::Active, QPalette::Base, base_at); +- defaultPalette.setColor(QPalette::Inactive, QPalette::Base, base_iat); +- defaultPalette.setColor(QPalette::Disabled, QPalette::Base, base_dis); +- +- defaultPalette.setColor(QPalette::Active, QPalette::Window, window_at); +- defaultPalette.setColor(QPalette::Inactive, QPalette::Window, window_iat); +- defaultPalette.setColor(QPalette::Disabled, QPalette::Window, window_dis); +- +- defaultPalette.setColor(QPalette::Active, QPalette::Shadow, shadow_at); +- defaultPalette.setColor(QPalette::Inactive, QPalette::Shadow, shadow_iat); +- defaultPalette.setColor(QPalette::Disabled, QPalette::Shadow, shadow_dis); +- +- defaultPalette.setColor(QPalette::Active, QPalette::Highlight, highLight_at); +- defaultPalette.setColor(QPalette::Inactive, QPalette::Highlight, highLight_iat); +- defaultPalette.setColor(QPalette::Disabled, QPalette::Highlight, highLight_dis); +- +- defaultPalette.setColor(QPalette::Active, QPalette::HighlightedText, highLightText_at); +- defaultPalette.setColor(QPalette::Inactive, QPalette::HighlightedText, highLightText_iat); +- defaultPalette.setColor(QPalette::Disabled, QPalette::HighlightedText, highLightText_dis); +- +- defaultPalette.setColor(QPalette::Active, QPalette::Link, link_at); +- defaultPalette.setColor(QPalette::Inactive, QPalette::Link, link_iat); +- defaultPalette.setColor(QPalette::Disabled, QPalette::Link, link_dis); +- +- defaultPalette.setColor(QPalette::Active, QPalette::LinkVisited, linkVisited_at); +- defaultPalette.setColor(QPalette::Inactive, QPalette::LinkVisited, linkVisited_iat); +- defaultPalette.setColor(QPalette::Disabled, QPalette::LinkVisited, linkVisited_dis); +- +- defaultPalette.setColor(QPalette::Active, QPalette::AlternateBase, alternateBase_at); +- defaultPalette.setColor(QPalette::Inactive, QPalette::AlternateBase, alternateBase_iat); +- defaultPalette.setColor(QPalette::Disabled, QPalette::AlternateBase, alternateBase_dis); +- +- defaultPalette.setColor(QPalette::Active, QPalette::NoRole, noRale_at); +- defaultPalette.setColor(QPalette::Inactive, QPalette::NoRole, noRole_iat); +- defaultPalette.setColor(QPalette::Disabled, QPalette::NoRole, noRole_dis); +- +- 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::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::Active, QPalette::PlaceholderText, placeholderText_at); +- defaultPalette.setColor(QPalette::Inactive, QPalette::PlaceholderText, placeholderText_iat); +- defaultPalette.setColor(QPalette::Disabled, QPalette::PlaceholderText, placeholderText_dis); +-#endif +-} +- +- +-void KDefaultStyleParameters::initPushButtonParameters(bool isDark, const QStyleOption *option, const QWidget *widget) +-{ +- pushButtonParameters.radius = 6; +- +- QBrush defaultBrush; +- QBrush clickBrush; +- QBrush hoverBrush; +- QBrush disableBrush; +- +- QBrush checkBrush; +- QBrush checkHoverBrush; +- QBrush checkClickBrush; +- QBrush checkDisableBrush; +- +- QPen focusPen; +- +- QColor highlight = option->palette.color(QPalette::Active, QPalette::Highlight); +- QColor mix = option->palette.color(QPalette::Active, QPalette::BrightText); +- +- if (isDark) { +- hoverBrush = QBrush(mixColor(highlight, mix, 0.2)); +- } else { +- hoverBrush = QBrush(mixColor(highlight, mix, 0.05)); +- } +- if (isDark) { +- clickBrush = QBrush(mixColor(highlight, mix, 0.05)); +- } else { +- clickBrush = QBrush(mixColor(highlight, mix, 0.2)); +- } +- +- defaultBrush = option->palette.brush(QPalette::Active, QPalette::Button); +- disableBrush = option->palette.brush(QPalette::Disabled, QPalette::Button); +- +- checkBrush = option->palette.color(QPalette::Active, QPalette::Highlight); +- checkHoverBrush = hoverBrush; +- checkClickBrush = clickBrush; +- checkDisableBrush = option->palette.brush(QPalette::Disabled, QPalette::NoRole); +- +- focusPen = QPen(QBrush(mixColor(highlight, mix, 0.2)), 2, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin); +- +- if (widget) { +- bool isWindowButton = false; +- bool isWindowColoseButton = false; +- bool isImportant = false; +- bool useButtonPalette = false; +- bool needTranslucent = false; +- +- if (widget->property("isWindowButton").isValid()) { +- if (widget->property("isWindowButton").toInt() == 0x01) { +- isWindowButton = true; +- } +- if (widget->property("isWindowButton").toInt() == 0x02) { +- isWindowColoseButton = true; +- } +- } +- if (widget->property("isImportant").isValid()) { +- isImportant = widget->property("isImportant").toBool(); +- } +- +- if (widget->property("useButtonPalette").isValid()) { +- useButtonPalette = widget->property("useButtonPalette").toBool(); +- } +- +- if (widget->property("needTranslucent").isValid()) { +- needTranslucent = widget->property("needTranslucent").toBool(); +- } +- +- if (isWindowColoseButton) { +- QColor ColoseButton = ColoseButtonColor; +- +- hoverBrush = QBrush(QColor(243, 34, 45)); +- clickBrush = QBrush(ColoseButton); +- +- focusPen = QPen(QBrush(mixColor(ColoseButton, mix, 0.2)), 2, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin); +- +- } else if (isWindowButton && useTransparentButtonList().contains(qAppName())) { +- if (isDark) { +- mix.setAlphaF(0.28); +- hoverBrush = QBrush(mix); +- mix.setAlphaF(0.15); +- clickBrush = QBrush(mix); +- } else { +- mix.setAlphaF(0.15); +- hoverBrush = QBrush(mix); +- mix.setAlphaF(0.28); +- clickBrush = QBrush(mix); +- } +- } else if (useButtonPalette || isWindowButton) { +- if (needTranslucent) +- { +- QColor hoverColor = option->palette.color(QPalette::Active, QPalette::BrightText); +- hoverColor.setAlphaF(isDark ? 0.20 : 0.16); +- hoverBrush.setColor(hoverColor); +- +- QColor clickColor = option->palette.color(QPalette::Active, QPalette::BrightText); +- clickColor.setAlphaF(isDark ? 0.30 : 0.21); +- clickBrush.setColor(clickColor); +- } +- else +- { +- QColor button = option->palette.color(QPalette::Active, QPalette::Button); +- +- if (isDark) { +- hoverBrush = QBrush(mixColor(button, mix, 0.2)); +- clickBrush = QBrush(mixColor(button, mix, 0.05)); +- } else { +- hoverBrush = QBrush(mixColor(button, mix, 0.05)); +- clickBrush = QBrush(mixColor(button, mix, 0.2)); +- } +- } +- } +- +- if (needTranslucent) { +- QColor defaultColor = option->palette.color(QPalette::Active, QPalette::BrightText); +- defaultColor.setAlphaF(0.1); +- defaultBrush.setColor(defaultColor); +- +- QColor disableColor = option->palette.color(QPalette::Disabled, QPalette::BrightText); +- disableColor.setAlphaF(0.1); +- disableBrush.setColor(disableColor); +- } +- +- if (isImportant) { +- defaultBrush = highlight; +- } +- } +- +- pushButtonParameters.pushButtonDefaultBrush = defaultBrush; +- pushButtonParameters.pushButtonClickBrush = clickBrush; +- pushButtonParameters.pushButtonHoverBrush = hoverBrush; +- pushButtonParameters.pushButtonDisableBrush = disableBrush; +- pushButtonParameters.pushButtonCheckBrush = checkBrush; +- pushButtonParameters.pushButtonCheckHoverBrush = checkHoverBrush; +- pushButtonParameters.pushButtonCheckClickBrush = checkClickBrush; +- pushButtonParameters.pushButtonCheckDisableBrush = checkDisableBrush; +- pushButtonParameters.pushButtonFocusPen = focusPen; +-} +- +-void KDefaultStyleParameters::initToolButtonParameters(bool isDark, const QStyleOption *option, const QWidget *widget) +-{ +- toolButtonParameters.radius = 6; +- +- QBrush defaultBrush; +- QBrush clickBrush; +- QBrush hoverBrush; +- QBrush disableBrush; +- +- QBrush checkBrush; +- QBrush checkHoverBrush; +- QBrush checkClickBrush; +- QBrush checkDisableBrush; +- +- QPen focusPen; +- +- +- QColor highlight = option->palette.color(QPalette::Active, QPalette::Highlight); +- QColor mix = option->palette.color(QPalette::Active, QPalette::BrightText); +- if (isDark) { +- hoverBrush = QBrush(mixColor(highlight, mix, 0.2)); +- clickBrush = QBrush(mixColor(highlight, mix, 0.05)); +- } else { +- hoverBrush = QBrush(mixColor(highlight, mix, 0.05)); +- clickBrush = QBrush(mixColor(highlight, mix, 0.2)); +- } +- defaultBrush = option->palette.brush(QPalette::Active, QPalette::Button); +- disableBrush = option->palette.brush(QPalette::Disabled, QPalette::Button); +- +- checkBrush = option->palette.color(QPalette::Active, QPalette::Highlight); +- checkHoverBrush = hoverBrush; +- checkClickBrush = clickBrush; +- checkDisableBrush = option->palette.brush(QPalette::Disabled, QPalette::NoRole); +- +- focusPen = QPen(QBrush(mixColor(highlight, mix, 0.2)), 2, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin); +- +- if (widget) { +- bool isWindowButton = false; +- bool isWindowColoseButton = false; +- bool useButtonPalette = false; +- bool needTranslucent = false; +- +- if (widget->property("isWindowButton").isValid()) { +- if (widget->property("isWindowButton").toInt() == 0x01) { +- isWindowButton = true; +- } +- if (widget->property("isWindowButton").toInt() == 0x02) { +- isWindowColoseButton = true; +- } +- } +- +- if (widget->property("useButtonPalette").isValid()) { +- useButtonPalette = widget->property("useButtonPalette").toBool(); +- } +- +- if (widget->property("needTranslucent").isValid()) { +- needTranslucent = widget->property("needTranslucent").toBool(); +- } +- +- if (isWindowColoseButton) { +- QColor ColoseButton = ColoseButtonColor; +- +- hoverBrush = QBrush(QColor(243, 34, 45)); +- clickBrush = QBrush(ColoseButton); +- +- focusPen = QPen(QBrush(mixColor(ColoseButton, mix, 0.2)), 2, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin); +- +- } else if (isWindowButton && useTransparentButtonList().contains(qAppName())) { +- if (isDark) { +- mix.setAlphaF(0.28); +- hoverBrush = QBrush(mix); +- mix.setAlphaF(0.15); +- clickBrush = QBrush(mix); +- } else { +- mix.setAlphaF(0.15); +- hoverBrush = QBrush(mix); +- mix.setAlphaF(0.28); +- clickBrush = QBrush(mix); +- } +- } else if (useButtonPalette || isWindowButton) { +- if(needTranslucent) +- { +- QColor hoverColor = option->palette.color(QPalette::Active, QPalette::BrightText); +- hoverColor.setAlphaF(isDark ? 0.20 : 0.16); +- hoverBrush.setColor(hoverColor); +- +- QColor clickColor = option->palette.color(QPalette::Active, QPalette::BrightText); +- clickColor.setAlphaF(isDark ? 0.30 : 0.21); +- clickBrush.setColor(clickColor); +- } +- else +- { +- QColor button = option->palette.color(QPalette::Active, QPalette::Button); +- +- if (isDark) { +- hoverBrush = QBrush(mixColor(button, mix, 0.2)); +- clickBrush = QBrush(mixColor(button, mix, 0.05)); +- } else { +- hoverBrush = QBrush(mixColor(button, mix, 0.05)); +- clickBrush = QBrush(mixColor(button, mix, 0.2)); +- } +- } +- } +- +- if (needTranslucent) { +- QColor defaultColor = option->palette.color(QPalette::Active, QPalette::BrightText); +- defaultColor.setAlphaF(0.1); +- defaultBrush.setColor(defaultColor); +- +- QColor disableColor = option->palette.color(QPalette::Disabled, QPalette::BrightText); +- disableColor.setAlphaF(0.1); +- disableBrush.setColor(disableColor); +- } +- } +- +- toolButtonParameters.toolButtonDefaultBrush = defaultBrush; +- toolButtonParameters.toolButtonClickBrush = clickBrush; +- toolButtonParameters.toolButtonHoverBrush = hoverBrush; +- toolButtonParameters.toolButtonDisableBrush = disableBrush; +- toolButtonParameters.toolButtonCheckBrush = checkBrush; +- toolButtonParameters.toolButtonCheckHoverBrush = checkHoverBrush; +- toolButtonParameters.toolButtonCheckClickBrush = checkClickBrush; +- toolButtonParameters.toolButtonCheckDisableBrush = checkDisableBrush; +- toolButtonParameters.toolButtonFocusPen = focusPen; +-} +- +-void KDefaultStyleParameters::initLineEditParameters(bool isDark, const QStyleOption *option, const QWidget *widget) +-{ +- lineEditParameters.radius = 6; +- +- QBrush defaultBrush; +- QBrush hoverBrush; +- QBrush focusBrush; +- QBrush disableBrush; +- +- QPen defaultPen; +- QPen hoverPen; +- QPen focusPen; +- QPen disablePen; +- +- bool needTranslucent = false; +- +- if (widget && widget->property("needTranslucent").isValid()) { +- needTranslucent = widget->property("needTranslucent").toBool(); +- } +- +- //default state +- defaultBrush = option->palette.brush(QPalette::Disabled, QPalette::Button); +- defaultPen = QPen(Qt::NoPen); +- defaultPen.setWidth(0); +- +- //hover state +- hoverBrush = defaultBrush; +- hoverPen = defaultPen; +- +- //focus state +- focusBrush = option->palette.brush(QPalette::Active, QPalette::Base); +- focusPen = QPen(option->palette.brush(QPalette::Active, QPalette::Highlight), +- 2, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin); +- +- //disable state +- disableBrush = option->palette.brush(QPalette::Disabled, QPalette::Button); +- disablePen = QPen(Qt::NoPen); +- disablePen.setWidth(0); +- +- if(needTranslucent) +- { +- QColor defaultColor = option->palette.color(QPalette::Active, QPalette::BrightText); +- defaultColor.setAlphaF(isDark ? 0.08 : 0.04); +- defaultBrush.setColor(defaultColor); +- +- QColor focusColor = option->palette.color(QPalette::Active, QPalette::Base); +- focusColor.setAlphaF(isDark ? 0.45 : 0.65); +- focusBrush.setColor(focusColor); +- QColor hoverColor = option->palette.color(QPalette::Active, QPalette::BrightText); +- hoverColor.setAlphaF(isDark ? 0.20 : 0.10); +- hoverBrush.setColor(hoverColor); +- } +- +- lineEditParameters.lineEditDefaultBrush = defaultBrush; +- lineEditParameters.lineEditHoverBrush = hoverBrush; +- lineEditParameters.lineEditFocusBrush = focusBrush; +- lineEditParameters.lineEditDisableBrush = disableBrush; +- +- lineEditParameters.lineEditDefaultPen = defaultPen; +- lineEditParameters.lineEditHoverPen = hoverPen; +- lineEditParameters.lineEditFocusPen = focusPen; +- lineEditParameters.lineEditDisablePen = disablePen; +-} +- +-void KDefaultStyleParameters::initSpinBoxParameters(bool isDark, const QStyleOption *option, const QWidget *widget, bool isHorizonLayout) +-{ +- spinBoxParameters.radius = 6; +- +- QBrush defaultBrush; +- QBrush hoverBrush; +- QBrush focusBrush; +- QBrush disableBrush; +- +- QPen defaultPen; +- QPen hoverPen; +- QPen focusPen; +- QPen disablePen; +- +- QBrush upHoverBrush; +- QBrush upFocusHoverBrush; +- QBrush upClickBrush; +- QBrush upDefaultBrush; +- QBrush downHoverBrush; +- QBrush downFocusHoverBrush; +- QBrush downClickBrush; +- QBrush downDefaultBrush; +- +- +- //default state +- if(!isHorizonLayout) +- defaultBrush = option->palette.brush(QPalette::Disabled, QPalette::Button); +- else +- defaultBrush = option->palette.brush(QPalette::Active, QPalette::Button); +- defaultPen = QPen(Qt::NoPen); +- defaultPen.setWidth(0); +- +- //hover state +- hoverBrush = defaultBrush; +- hoverPen = defaultPen; +- if(isHorizonLayout) +- hoverPen.setWidth(2); +- +- //focus state +- focusBrush = option->palette.brush(QPalette::Active, QPalette::Base); +- focusPen = QPen(option->palette.brush(QPalette::Active, QPalette::Highlight), +- 2, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin); +- +- //disable state +- disableBrush = option->palette.brush(QPalette::Disabled, QPalette::Button); +- disablePen = QPen(Qt::NoPen); +- defaultPen.setWidth(0); +- +- if(isHorizonLayout) +- { +- upDefaultBrush = option->palette.brush(QPalette::Active, QPalette::Button); +- downDefaultBrush = option->palette.brush(QPalette::Active, QPalette::Button); +- } +- else +- { +- upDefaultBrush = QBrush(Qt::NoBrush); +- downDefaultBrush = QBrush(Qt::NoBrush); +- } +- +- QColor highlight = option->palette.color(QPalette::Active, QPalette::Highlight); +- QColor button = option->palette.color(QPalette::Active, QPalette::Button); +- QColor mix = option->palette.color(QPalette::Active, QPalette::BrightText); +- //up hover +- if (isDark) { +- upHoverBrush = QBrush(mixColor(button, mix, 0.2)); +- } else { +- upHoverBrush = QBrush(mixColor(button, mix, 0.05)); +- } +- +- //up focus hover +- if (isDark) { +- upFocusHoverBrush = QBrush(mixColor(highlight, mix, 0.2)); +- } else { +- upFocusHoverBrush = QBrush(mixColor(highlight, mix, 0.05)); +- } +- +- //up click +- if (isDark) { +- if(isHorizonLayout) +- upClickBrush = QBrush(mixColor(button, mix, 0.05)); +- else +- upClickBrush = QBrush(mixColor(highlight, mix, 0.05)); +- } else { +- if(isHorizonLayout) +- upClickBrush = QBrush(mixColor(button, mix, 0.2)); +- else +- upClickBrush = QBrush(mixColor(highlight, mix, 0.2)); +- } +- +- //down hover +- if (isDark) { +- downHoverBrush = QBrush(mixColor(button, mix, 0.2)); +- } else { +- downHoverBrush = QBrush(mixColor(button, mix, 0.05)); +- } +- +- //down focus hover +- if (isDark) { +- downFocusHoverBrush = QBrush(mixColor(highlight, mix, 0.2)); +- } else { +- downFocusHoverBrush = QBrush(mixColor(highlight, mix, 0.05)); +- } +- +- //down click +- if (isDark) { +- if(isHorizonLayout) +- downClickBrush = QBrush(mixColor(button, mix, 0.05)); +- else +- downClickBrush = QBrush(mixColor(highlight, mix, 0.05)); +- } else { +- if(isHorizonLayout) +- downClickBrush = QBrush(mixColor(button, mix, 0.2)); +- else +- downClickBrush = QBrush(mixColor(highlight, mix, 0.2)); +- } +- +- +- spinBoxParameters.spinBoxDefaultBrush = defaultBrush; +- spinBoxParameters.spinBoxHoverBrush = hoverBrush; +- spinBoxParameters.spinBoxFocusBrush = focusBrush; +- spinBoxParameters.spinBoxDisableBrush = disableBrush; +- +- spinBoxParameters.spinBoxDefaultPen = defaultPen; +- spinBoxParameters.spinBoxHoverPen = hoverPen; +- spinBoxParameters.spinBoxFocusPen = focusPen; +- spinBoxParameters.spinBoxDisablePen = disablePen; +- +- spinBoxParameters.spinBoxUpHoverBrush = upHoverBrush; +- spinBoxParameters.spinBoxUpFocusHoverBrush = upFocusHoverBrush; +- spinBoxParameters.spinBoxUpClickBrush = upClickBrush; +- spinBoxParameters.spinBoxUpDefaultBrush = upDefaultBrush; +- +- spinBoxParameters.spinBoxDownHoverBrush = downHoverBrush; +- spinBoxParameters.spinBoxDownFocusHoverBrush = downFocusHoverBrush; +- spinBoxParameters.spinBoxDownClickBrush = downClickBrush; +- spinBoxParameters.spinBoxDownDefaultBrush = downDefaultBrush; +- +-} +- +-void KDefaultStyleParameters::initComboBoxParameters(bool isDark, const QStyleOption *option, const QWidget *widget) +-{ +- comboBoxParameters.radius = 6; +- +- QBrush defaultBrush; +- QBrush hoverBrush; +- QBrush onBrush; +- QBrush editBrush; +- QBrush disableBrush; +- +- QPen defaultPen; +- QPen hoverPen; +- QPen onPen; +- QPen editPen; +- QPen disablePen; +- +- QColor button = option->palette.color(QPalette::Active, QPalette::Button); +- QColor mix = option->palette.color(QPalette::Active, QPalette::BrightText); +- +- //default state +- defaultBrush = option->palette.brush(QPalette::Disabled, QPalette::Button); +- defaultPen = QPen(Qt::NoPen); +- defaultPen.setWidth(0); +- +- //hover state +- if (isDark) { +- hoverBrush = QBrush(mixColor(button, mix, 0.2)); +- } else { +- hoverBrush = QBrush(mixColor(button, mix, 0.05)); +- } +- hoverPen = QPen(Qt::NoPen); +- hoverPen.setWidth(0); +- +- //on state +- if (isDark) { +- onBrush = QBrush(mixColor(button, mix, 0.05)); +- } else { +- onBrush = QBrush(mixColor(button, mix, 0.2)); +- } +- onPen = QPen(Qt::NoPen); +- onPen.setWidth(0); +- +- //focus and on state,edit mode +- editBrush = option->palette.brush(QPalette::Active, QPalette::Base); +- editPen = QPen(option->palette.brush(QPalette::Active, QPalette::Highlight), +- 2, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin); +- +- //disable state +- disableBrush = option->palette.brush(QPalette::Disabled, QPalette::Button); +- disablePen = QPen(Qt::NoPen); +- disablePen.setWidth(0); +- +- comboBoxParameters.comboBoxDefaultBrush = defaultBrush; +- comboBoxParameters.comboBoxHoverBrush = hoverBrush; +- comboBoxParameters.comboBoxOnBrush = onBrush; +- comboBoxParameters.comboBoxEditBrush = editBrush; +- comboBoxParameters.comboBoxDisableBrush = disableBrush; +- +- comboBoxParameters.comboBoxDefaultPen = defaultPen; +- comboBoxParameters.comboBoxHoverPen = hoverPen; +- comboBoxParameters.comboBoxOnPen = onPen; +- comboBoxParameters.comboBoxEditPen = editPen; +- comboBoxParameters.comboBoxDisablePen = disablePen; +-} +- +-void KDefaultStyleParameters::initListParameters(bool isDark, const QStyleOption *option, const QWidget *widget) +-{ +- listParameters.radius = 6; +- +- QBrush defaultBrush; +- QBrush hoverBrush; +- QBrush selectBrush; +- QBrush disableBrush; +- QPen textHoverPen = QPen(Qt::NoPen); +- QPen textSelectPen = QPen(Qt::NoPen); +- bool needTranslucent = false; +- if (widget && widget->property("needTranslucent").isValid()) { +- needTranslucent = widget->property("needTranslucent").toBool(); +- } +- +- //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); +- +- const QStyleOptionViewItem *vi = qstyleoption_cast(option); +- QPalette::ColorGroup cg = vi->state & QStyle::State_Enabled +- ? QPalette::Normal : QPalette::Disabled; +- if (cg == QPalette::Normal && !(vi->state & QStyle::State_Active)) +- cg = QPalette::Inactive; +- +- if(needTranslucent) +- { +- QColor hoverColor = option->palette.color(QPalette::Active, QPalette::BrightText); +- hoverColor.setAlphaF(isDark ? 0.1 : 0.05); +- hoverBrush.setColor(hoverColor); +- +- QColor selectColor = option->palette.color(QPalette::Active, QPalette::BrightText); +- selectColor.setAlphaF(isDark ? 0.20 : 0.15); +- selectBrush.setColor(selectColor); +- +- +- textSelectPen = option->palette.color(cg, QPalette::Text); +- textHoverPen = option->palette.color(cg, QPalette::BrightText); +- } +- else +- { +- textSelectPen = option->palette.color(cg, QPalette::HighlightedText); +- textHoverPen = option->palette.color(cg, QPalette::Text); +- } +- +- listParameters.listDefaultBrush = defaultBrush; +- listParameters.listHoverBrush = hoverBrush; +- listParameters.listSelectBrush = selectBrush; +- listParameters.listDisableBrush = disableBrush; +- listParameters.listTextHoverPen = textHoverPen; +- listParameters.listTextSelectPen = textSelectPen; +-} +- +-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 = 0; +- +- 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; +- +- bool needTranslucent = false; +- if (widget && widget->property("needTranslucent").isValid()) { +- needTranslucent = widget->property("needTranslucent").toBool(); +- } +- +- QColor mix = option->palette.color(QPalette::Active, QPalette::BrightText); +- +- //default +- if (isDark) { +- QColor col = option->palette.color(QPalette::Active, QPalette::BrightText); +- col.setAlphaF(0.15); +- defaultPen = QPen(col, 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)); +- } +- +- +- if(needTranslucent) +- { +- QColor defaultColor = option->palette.color(QPalette::Active, QPalette::BrightText); +- defaultColor.setAlphaF(isDark ? 0.04 : 0.05); +- defaultBrush.setColor(defaultColor); +- QColor defaultPenColor = option->palette.color(QPalette::Active, QPalette::BrightText); +- defaultPenColor.setAlphaF(0.35); +- defaultPen = QPen(QBrush(defaultPenColor), 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin); +- +- QColor hoverColor = option->palette.color(QPalette::Active, QPalette::BrightText); +- hoverColor.setAlphaF(isDark ? 0.10 : 0.10); +- hoverBrush.setColor(hoverColor); +- QColor hoverPenColor = option->palette.color(QPalette::Active, QPalette::BrightText); +- hoverPenColor.setAlphaF(0.3); +- hoverPen = QPen(QBrush(hoverPenColor), 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin); +- +- +- QColor clickColor = option->palette.color(QPalette::Active, QPalette::BrightText); +- clickColor.setAlphaF(isDark ? 0.20 : 0.16); +- clickBrush.setColor(clickColor); +- QColor clickPenColor = option->palette.color(QPalette::Active, QPalette::BrightText); +- if(!isDark) +- clickPenColor = option->palette.color(QPalette::Active, QPalette::Mid); +- clickPenColor.setAlphaF(isDark ? 0.25 : 0.65); +- clickPen = QPen(QBrush(clickPenColor), 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin); +- +- } +- +- //disable +- disablePen = defaultPen; +- disableBrush = option->palette.brush(QPalette::Disabled, QPalette::Button); +- +- //on default +- onDefaultPen = QPen(Qt::NoPen); +- onDefaultPen.setWidth(0); +- onDefaultBrush = option->palette.brush(QPalette::Active, QPalette::Highlight); +- if(needTranslucent) +- { +- QColor onDefaultPenColor = option->palette.color(QPalette::Active, QPalette::BrightText); +- onDefaultPenColor.setAlphaF(0.1); +- onDefaultPen = QPen(QBrush(onDefaultPenColor), 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin); +- } +- +- //on hover +- onHoverPen = QPen(Qt::NoPen); +- onHoverPen.setWidth(0); +- if (isDark) { +- onHoverBrush = QBrush(mixColor(onDefaultBrush.color(), mix, 0.2)); +- } else { +- onHoverBrush = QBrush(mixColor(onDefaultBrush.color(), mix, 0.05)); +- } +- if(needTranslucent) +- { +- QColor onHoverPenColor = option->palette.color(QPalette::Active, QPalette::BrightText); +- onHoverPenColor.setAlphaF(0.15); +- onHoverPen = QPen(QBrush(onHoverPenColor), 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin); +- } +- +- //on click +- onClickPen = QPen(Qt::NoPen); +- onClickPen.setWidth(0); +- if (isDark) { +- onClickBrush = QBrush(mixColor(onDefaultBrush.color(), mix, 0.05)); +- } else { +- onClickBrush = QBrush(mixColor(onDefaultBrush.color(), mix, 0.2)); +- } +- if(needTranslucent) +- { +- QColor onClickPenColor = option->palette.color(QPalette::Active, QPalette::BrightText); +- onClickPenColor.setAlphaF(0.1); +- onClickPen = QPen(QBrush(onClickPenColor), 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin); +- } +- +- 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) { +- QColor col = option->palette.color(QPalette::Active, QPalette::BrightText); +- col.setAlphaF(0.15); +- defaultPen = QPen(col, 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::Button); +- +- //on default +- onDefaultPen = QPen(Qt::NoPen); +- onDefaultPen.setWidth(0); +- onDefaultBrush = option->palette.brush(QPalette::Active, QPalette::Highlight); +- +- //on hover +- onHoverPen = QPen(Qt::NoPen); +- onHoverPen.setWidth(0); +- 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); +- onClickPen.setWidth(0); +- 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); +- +- bool needTranslucent = false; +- +- if (widget && widget->property("needTranslucent").isValid()) { +- needTranslucent = widget->property("needTranslucent").toBool(); +- } +- +- //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 +- if (isDark) { +- grooveValueDefaultBrush = QBrush(mixColor(highlight, mix, 0.05)); +- } else { +- grooveValueDefaultBrush = QBrush(mixColor(highlight, mix, 0.2)); +- } +- +- //groove value hover +- grooveValueHoverBrush = grooveValueDefaultBrush; +- +- //groove value disable +- grooveValueDisableBrush = handleDisableBrush; +- +- //groove unvalue default +- grooveUnvalueDefaultBrush = option->palette.color(QPalette::Active, QPalette::Button); +- if(needTranslucent) +- { +- QColor color = option->palette.color(QPalette::Active, QPalette::BrightText); +- color.setAlphaF(0.1); +- grooveUnvalueDefaultBrush.setColor(color); +- } +- +- //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; +- +- bool needTranslucent = false; +- +- if (widget && widget->property("needTranslucent").isValid()) { +- needTranslucent = widget->property("needTranslucent").toBool(); +- } +- +- 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); +- if(needTranslucent) +- { +- QColor grooveDefaultColor = pb->palette.color(QPalette::Active, QPalette::BrightText); +- grooveDefaultColor.setAlphaF(0.10); +- grooveDefaultBrush.setColor(grooveDefaultColor); +- } +- +- //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; +- bool needTranslucent = false; +- +- if (widget && widget->property("needTranslucent").isValid()) { +- needTranslucent = widget->property("needTranslucent").toBool(); +- } +- +- 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); +- +- +- if(needTranslucent) +- { +- QColor grooveDefaultColor = option->palette.color(QPalette::Active, QPalette::BrightText); +- grooveDefaultColor.setAlphaF(isDark ? 0.08 : 0.06); +- grooveDefaultBrush.setColor(grooveDefaultColor); +- +- QColor grooveInactiveColor = option->palette.color(QPalette::Active, QPalette::BrightText); +- grooveInactiveColor.setAlphaF(isDark ? 0.08 : 0.06); +- grooveInactiveBrush.setColor(grooveInactiveColor); +- +- QColor sliderDefaultColor = option->palette.color(QPalette::Active, QPalette::BrightText); +- sliderDefaultColor.setAlphaF(isDark ? 0.10 : 0.10); +- sliderDefaultBrush.setColor(sliderDefaultColor); +- +- QColor sliderHoverColor = option->palette.color(QPalette::Active, QPalette::BrightText); +- sliderHoverColor.setAlphaF(isDark ? 0.20 : 0.18); +- sliderHoverBrush.setColor(sliderHoverColor); +- +- QColor sliderClickColor = option->palette.color(QPalette::Active, QPalette::BrightText); +- sliderClickColor.setAlphaF(isDark ? 0.30 : 0.28); +- sliderClickBrush.setColor(sliderClickColor); +- } +- +- +- 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(180)); +- pixmapPainter.setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform); +- pixmapPainter.drawRoundedRect(option->rect, frameradius, frameradius); +- } else { +- int rander = 2; +- +- // Draw a black floor +- QPainter pixmapPainter(&framePixmap); +- pixmapPainter.setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform); +- pixmapPainter.setPen(Qt::transparent); +- pixmapPainter.setBrush(option->palette.color(QPalette::Active, QPalette::BrightText)); +- pixmapPainter.drawRoundedRect(option->rect.adjusted(+rander, +rander+6, -rander, -rander-6), 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.setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform); +- pixmapPainter2.setCompositionMode(QPainter::CompositionMode_Clear); +- pixmapPainter2.setPen(Qt::transparent); +- pixmapPainter2.setBrush(Qt::transparent); +- pixmapPainter2.drawRoundedRect(option->rect.adjusted(+rander, +rander+6, -rander, -rander-6), 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+6, -rander, -rander-6), frameradius, frameradius); +- } else { +- path.addRegion(region); +- } +- +- //draw blur background +- QPainter pixmapPainter3(&framePixmap); +- pixmapPainter3.setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform); +- 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 widget theme +-KClassicalStyleParameters::KClassicalStyleParameters(QObject *parent, bool isDark) : KAbstractStyleParameters(parent, isDark) +-{ +- radius = 0; +- CheckBox_Radius = 0; +- +- initPalette(isDark); +-} +- +-void KClassicalStyleParameters::initPalette(bool isDark) +-{ +- +- QColor windowText_at(38, 38, 38), +- windowText_iat(38, 38, 38), +- windowText_dis(166, 166, 166), +- 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(217, 217, 217), +- midlight_iat(217, 217, 217), +- 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(140, 140, 140), +- brightText_at(89, 89, 89), +- brightText_iat(89, 89, 89), +- brightText_dis(77, 77, 77), +- 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(214, 214, 214), +- shadow_iat(214, 214, 214), +- shadow_dis(201, 201, 201), +- highLight_at(55, 144, 250), +- highLight_iat(55, 144, 250), +- hightight_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(244, 245, 245), +- noRale_at(240, 240, 240), +- noRole_iat(240, 240, 240), +- noRole_dis(217, 217, 217), +- toolTipBase(255, 255, 255), +- toolTipText(38, 38, 38), +- placeholderText(38, 38, 38); +- +- if (isDark) { +- windowText_at.setRgb(217, 217, 217); +- windowText_iat.setRgb(217, 217, 217); +- windowText_dis.setRgb(77, 77, 77); +- button_at.setRgb(55, 55, 59); +- button_iat.setRgb(55, 55, 59); +- button_dis.setRgb(46, 46, 48); +- midlight_at.setRgb(77, 77, 77); +- midlight_iat.setRgb(77, 77, 77); +- midlight_dis.setRgb(64, 64, 64); +- dark_at.setRgb(38, 38, 38); +- dark_iat.setRgb(38, 38, 38); +- dark_dis.setRgb(26, 26, 26); +- text_at.setRgb(217, 217, 217); +- text_iat.setRgb(217, 217, 217); +- text_dis.setRgb(77, 77, 77); +- brightText_at.setRgb(255, 255, 255); +- brightText_iat.setRgb(255, 255, 255); +- brightText_dis.setRgb(77, 77, 77); +- 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_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); +- hightight_dis.setRgb(46, 46, 48); +- highLightText_dis.setRgb(77, 77, 77); +- alternateBase_at.setRgb(38, 38, 38); +- noRale_at.setRgb(51, 51, 51); +- noRole_iat.setRgb(51, 51, 51); +- noRole_dis.setRgb(60, 60, 64); +- toolTipBase.setRgb(38, 38, 38); +- toolTipText.setRgb(217, 217, 217); +- placeholderText.setRgb(166, 166, 166); +- } +- +- defaultPalette.setColor(QPalette::Active, QPalette::WindowText, windowText_at); +- defaultPalette.setColor(QPalette::Inactive, QPalette::WindowText, windowText_iat); +- defaultPalette.setColor(QPalette::Disabled, QPalette::WindowText, windowText_dis); +- +- defaultPalette.setColor(QPalette::Active, QPalette::Button, button_at); +- defaultPalette.setColor(QPalette::Inactive, QPalette::Button, button_iat); +- defaultPalette.setColor(QPalette::Disabled, QPalette::Button, button_dis); +- +- defaultPalette.setColor(QPalette::Active, QPalette::Light, light_at); +- defaultPalette.setColor(QPalette::Inactive, QPalette::Light, light_iat); +- defaultPalette.setColor(QPalette::Disabled, QPalette::Light, light_dis); +- +- defaultPalette.setColor(QPalette::Active, QPalette::Midlight, midlight_at); +- defaultPalette.setColor(QPalette::Inactive, QPalette::Midlight, midlight_iat); +- defaultPalette.setColor(QPalette::Disabled, QPalette::Midlight, midlight_dis); +- +- defaultPalette.setColor(QPalette::Active, QPalette::Dark, dark_at); +- defaultPalette.setColor(QPalette::Inactive, QPalette::Dark, dark_iat); +- defaultPalette.setColor(QPalette::Disabled, QPalette::Dark, dark_dis); +- +- defaultPalette.setColor(QPalette::Active, QPalette::Mid, mid_at); +- defaultPalette.setColor(QPalette::Inactive, QPalette::Mid, mid_iat); +- defaultPalette.setColor(QPalette::Disabled, QPalette::Mid, mid_dis); +- +- defaultPalette.setColor(QPalette::Active, QPalette::Text, text_at); +- defaultPalette.setColor(QPalette::Inactive, QPalette::Text, text_iat); +- defaultPalette.setColor(QPalette::Disabled, QPalette::Text, text_dis); +- +- defaultPalette.setColor(QPalette::Active, QPalette::BrightText, brightText_at); +- defaultPalette.setColor(QPalette::Inactive, QPalette::BrightText, brightText_iat); +- defaultPalette.setColor(QPalette::Disabled, QPalette::BrightText, brightText_dis); +- +- defaultPalette.setColor(QPalette::Active, QPalette::ButtonText, buttonText_at); +- defaultPalette.setColor(QPalette::Inactive, QPalette::ButtonText, buttonText_iat); +- defaultPalette.setColor(QPalette::Disabled, QPalette::ButtonText, buttonText_dis); +- +- defaultPalette.setColor(QPalette::Active, QPalette::Base, base_at); +- defaultPalette.setColor(QPalette::Inactive, QPalette::Base, base_iat); +- defaultPalette.setColor(QPalette::Disabled, QPalette::Base, base_dis); +- +- defaultPalette.setColor(QPalette::Active, QPalette::Window, window_at); +- defaultPalette.setColor(QPalette::Inactive, QPalette::Window, window_iat); +- defaultPalette.setColor(QPalette::Disabled, QPalette::Window, window_dis); +- +- defaultPalette.setColor(QPalette::Active, QPalette::Shadow, shadow_at); +- defaultPalette.setColor(QPalette::Inactive, QPalette::Shadow, shadow_iat); +- defaultPalette.setColor(QPalette::Disabled, QPalette::Shadow, shadow_dis); +- +- 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::Active, QPalette::HighlightedText, highLightText_at); +- defaultPalette.setColor(QPalette::Inactive, QPalette::HighlightedText, highLightText_iat); +- defaultPalette.setColor(QPalette::Disabled, QPalette::HighlightedText, highLightText_dis); +- +- defaultPalette.setColor(QPalette::Active, QPalette::Link, link_at); +- defaultPalette.setColor(QPalette::Inactive, QPalette::Link, link_iat); +- defaultPalette.setColor(QPalette::Disabled, QPalette::Link, link_dis); +- +- defaultPalette.setColor(QPalette::Active, QPalette::LinkVisited, linkVisited_at); +- defaultPalette.setColor(QPalette::Inactive, QPalette::LinkVisited, linkVisited_iat); +- defaultPalette.setColor(QPalette::Disabled, QPalette::LinkVisited, linkVisited_dis); +- +- defaultPalette.setColor(QPalette::AlternateBase, alternateBase_at); +- +- defaultPalette.setColor(QPalette::Active, QPalette::NoRole, noRale_at); +- defaultPalette.setColor(QPalette::Inactive, QPalette::NoRole, noRole_iat); +- defaultPalette.setColor(QPalette::Disabled, QPalette::NoRole, noRole_dis); +- +- defaultPalette.setColor(QPalette::ToolTipBase, toolTipBase); +- +- defaultPalette.setColor(QPalette::ToolTipText, toolTipText); +- +-#if (QT_VERSION >= QT_VERSION_CHECK(5,12,0)) +- defaultPalette.setColor(QPalette::PlaceholderText, placeholderText); +-#endif +-} +- +-void KClassicalStyleParameters::initPushButtonParameters(bool isDark, const QStyleOption *option, const QWidget *widget) +-{ +- +-} +- +-void KClassicalStyleParameters::initToolButtonParameters(bool isDark, const QStyleOption *option, const QWidget *widget) +-{ +- +-} +- +-void KClassicalStyleParameters::initLineEditParameters(bool isDark, const QStyleOption *option, const QWidget *widget) +-{ +- +-} +- +-void KClassicalStyleParameters::initSpinBoxParameters(bool isDark, const QStyleOption *option, const QWidget *widget, bool isHorizonLayout) +-{ +- +-} +- +-void KClassicalStyleParameters::initComboBoxParameters(bool isDark, const QStyleOption *option, const QWidget *widget) +-{ +- +-} +- +-void KClassicalStyleParameters::initListParameters(bool isDark, const QStyleOption *option, const QWidget *widget) +-{ +- +-} +- +-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 = 6; +- +- ColoseButtonColor = QColor(198, 42, 63); +- +- initPalette(isDark); +-} +- +-void KFashionStyleParameters::initPalette(bool isDark) +-{ +- //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(38, 38, 38), +- buttonText_iat(38, 38, 38), +- buttonText_dis(0, 0, 0, 255 * 0.3), +- 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(120, 115, 245), +- highLight_iat(120, 115, 245), +- highLight_dis(233, 233, 233), +- highLightText_at(255, 255, 255), +- highLightText_iat(255, 255, 255), +- highLightText_dis(179, 179, 179), +- link_at(120, 115, 245), +- link_iat(120, 115, 245), +- link_dis(120, 115, 245), +- linkVisited_at(62, 118, 247), +- linkVisited_iat(62, 118, 247), +- linkVisited_dis(62, 118, 247), +- 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(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, 46); +- 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(217, 217, 217); +- buttonText_iat.setRgb(217, 217, 217); +- buttonText_dis.setRgb(255, 255, 255, 255 * 0.3); +- 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(120, 115, 245); +- highLight_iat.setRgb(120, 115, 245); +- 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(120, 115, 245); +- link_iat.setRgb(120, 115, 245); +- link_dis.setRgb(120, 115, 245); +- linkVisited_at.setRgb(62, 118, 247); +- linkVisited_iat.setRgb(62, 118, 247); +- linkVisited_dis.setRgb(62, 118, 247); +- 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); +- defaultPalette.setColor(QPalette::Inactive, QPalette::WindowText, windowText_iat); +- defaultPalette.setColor(QPalette::Disabled, QPalette::WindowText, windowText_dis); +- +- defaultPalette.setColor(QPalette::Active, QPalette::Button, button_at); +- defaultPalette.setColor(QPalette::Inactive, QPalette::Button, button_iat); +- defaultPalette.setColor(QPalette::Disabled, QPalette::Button, button_dis); +- +- defaultPalette.setColor(QPalette::Active, QPalette::Light, light_at); +- defaultPalette.setColor(QPalette::Inactive, QPalette::Light, light_iat); +- defaultPalette.setColor(QPalette::Disabled, QPalette::Light, light_dis); +- +- defaultPalette.setColor(QPalette::Active, QPalette::Midlight, midlight_at); +- defaultPalette.setColor(QPalette::Inactive, QPalette::Midlight, midlight_iat); +- defaultPalette.setColor(QPalette::Disabled, QPalette::Midlight, midlight_dis); +- +- defaultPalette.setColor(QPalette::Active, QPalette::Dark, dark_at); +- defaultPalette.setColor(QPalette::Inactive, QPalette::Dark, dark_iat); +- defaultPalette.setColor(QPalette::Disabled, QPalette::Dark, dark_dis); +- +- defaultPalette.setColor(QPalette::Active, QPalette::Mid, mid_at); +- defaultPalette.setColor(QPalette::Inactive, QPalette::Mid, mid_iat); +- defaultPalette.setColor(QPalette::Disabled, QPalette::Mid, mid_dis); +- +- defaultPalette.setColor(QPalette::Active, QPalette::Text, text_at); +- defaultPalette.setColor(QPalette::Inactive, QPalette::Text, text_iat); +- defaultPalette.setColor(QPalette::Disabled, QPalette::Text, text_dis); +- +- defaultPalette.setColor(QPalette::Active, QPalette::BrightText, brightText_at); +- defaultPalette.setColor(QPalette::Inactive, QPalette::BrightText, brightText_iat); +- defaultPalette.setColor(QPalette::Disabled, QPalette::BrightText, brightText_dis); +- +- defaultPalette.setColor(QPalette::Active, QPalette::ButtonText, buttonText_at); +- defaultPalette.setColor(QPalette::Inactive, QPalette::ButtonText, buttonText_iat); +- defaultPalette.setColor(QPalette::Disabled, QPalette::ButtonText, buttonText_dis); +- +- defaultPalette.setColor(QPalette::Active, QPalette::Base, base_at); +- defaultPalette.setColor(QPalette::Inactive, QPalette::Base, base_iat); +- defaultPalette.setColor(QPalette::Disabled, QPalette::Base, base_dis); +- +- defaultPalette.setColor(QPalette::Active, QPalette::Window, window_at); +- defaultPalette.setColor(QPalette::Inactive, QPalette::Window, window_iat); +- defaultPalette.setColor(QPalette::Disabled, QPalette::Window, window_dis); +- +- defaultPalette.setColor(QPalette::Active, QPalette::Shadow, shadow_at); +- defaultPalette.setColor(QPalette::Inactive, QPalette::Shadow, shadow_iat); +- defaultPalette.setColor(QPalette::Disabled, QPalette::Shadow, shadow_dis); +- +- defaultPalette.setColor(QPalette::Active, QPalette::Highlight, highLight_at); +- defaultPalette.setColor(QPalette::Inactive, QPalette::Highlight, highLight_iat); +- defaultPalette.setColor(QPalette::Disabled, QPalette::Highlight, highLight_dis); +- +- defaultPalette.setColor(QPalette::Active, QPalette::HighlightedText, highLightText_at); +- defaultPalette.setColor(QPalette::Inactive, QPalette::HighlightedText, highLightText_iat); +- defaultPalette.setColor(QPalette::Disabled, QPalette::HighlightedText, highLightText_dis); +- +- defaultPalette.setColor(QPalette::Active, QPalette::Link, link_at); +- defaultPalette.setColor(QPalette::Inactive, QPalette::Link, link_iat); +- defaultPalette.setColor(QPalette::Disabled, QPalette::Link, link_dis); +- +- defaultPalette.setColor(QPalette::Active, QPalette::LinkVisited, linkVisited_at); +- defaultPalette.setColor(QPalette::Inactive, QPalette::LinkVisited, linkVisited_iat); +- defaultPalette.setColor(QPalette::Disabled, QPalette::LinkVisited, linkVisited_dis); +- +- defaultPalette.setColor(QPalette::Active, QPalette::AlternateBase, alternateBase_at); +- defaultPalette.setColor(QPalette::Inactive, QPalette::AlternateBase, alternateBase_iat); +- defaultPalette.setColor(QPalette::Disabled, QPalette::AlternateBase, alternateBase_dis); +- +- defaultPalette.setColor(QPalette::Active, QPalette::NoRole, noRale_at); +- defaultPalette.setColor(QPalette::Inactive, QPalette::NoRole, noRole_iat); +- defaultPalette.setColor(QPalette::Disabled, QPalette::NoRole, noRole_dis); +- +- 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::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::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) +-{ +- pushButtonParameters.radius = 6; +- +- QBrush defaultBrush; +- QBrush clickBrush; +- QBrush hoverBrush; +- QBrush disableBrush; +- +- QBrush checkBrush; +- QBrush checkHoverBrush; +- QBrush checkClickBrush; +- QBrush checkDisableBrush; +- +- QPen focusPen; +- +- +- QColor highlight = option->palette.color(QPalette::Active, QPalette::Highlight); +- QColor mix = option->palette.color(QPalette::Active, QPalette::BrightText); +- +- QColor startColor; +- QColor endColor; +- QLinearGradient linearGradient; +- +- //hover +- 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); +- 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); +- +- checkBrush = option->palette.color(QPalette::Active, QPalette::Highlight); +- checkHoverBrush = hoverBrush; +- checkClickBrush = clickBrush; +- checkDisableBrush = option->palette.brush(QPalette::Disabled, QPalette::NoRole); +- +- focusPen = QPen(QBrush(mixColor(highlight, mix, 0.2)), 2, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin); +- +- if (widget) { +- bool isWindowButton = false; +- bool isWindowColoseButton = false; +- bool isImportant = false; +- bool useButtonPalette = false; +- bool needTranslucent = false; +- +- if (widget->property("isWindowButton").isValid()) { +- if (widget->property("isWindowButton").toInt() == 0x01) { +- isWindowButton = true; +- } +- if (widget->property("isWindowButton").toInt() == 0x02) { +- isWindowColoseButton = true; +- } +- } +- if (widget->property("isImportant").isValid()) { +- isImportant = widget->property("isImportant").toBool(); +- } +- +- if (widget->property("useButtonPalette").isValid()) { +- useButtonPalette = widget->property("useButtonPalette").toBool(); +- } +- +- if (widget->property("needTranslucent").isValid()) { +- needTranslucent = widget->property("needTranslucent").toBool(); +- } +- +- if (isWindowColoseButton) { +- QColor ColoseButton = ColoseButtonColor; +- +- if (isDark) { +- startColor = QColor(242, 116, 133); +- endColor = QColor(221, 44, 68); +- } else { +- startColor = QColor(242, 82, 117); +- endColor = QColor(221, 44, 68); +- } +- linearGradient.setColorAt(0, startColor); +- linearGradient.setColorAt(1, endColor); +- hoverBrush = QBrush(linearGradient); +- +- //click +- clickBrush = QBrush(ColoseButton); +- +- //focus +- focusPen = QPen(QBrush(ColoseButton), 2, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin); +- +- } else if (isWindowButton && useTransparentButtonList().contains(qAppName())) { +- if (isDark) { +- mix.setAlphaF(0.28); +- hoverBrush = QBrush(mix); +- mix.setAlphaF(0.15); +- clickBrush = QBrush(mix); +- } else { +- mix.setAlphaF(0.15); +- hoverBrush = QBrush(mix); +- mix.setAlphaF(0.28); +- clickBrush = QBrush(mix); +- } +- } else if (useButtonPalette || isWindowButton) { +- if(needTranslucent) +- { +- if (isDark) { +- startColor = option->palette.color(QPalette::Active, QPalette::Light); +- endColor = option->palette.color(QPalette::Active, QPalette::Text); +- startColor.setAlphaF(0.2); +- endColor.setAlphaF(0.2); +- } else { +- startColor = option->palette.color(QPalette::Active, QPalette::Mid); +- endColor = option->palette.color(QPalette::Active, QPalette::Dark); +- startColor.setAlphaF(0.2); +- endColor.setAlphaF(0.2); +- } +- linearGradient.setColorAt(0, startColor); +- linearGradient.setColorAt(1, endColor); +- hoverBrush = QBrush(linearGradient); +- +- QColor clickColor = option->palette.color(QPalette::Active, QPalette::Dark); +- if(isDark) +- clickColor = option->palette.color(QPalette::Active, QPalette::Light); +- clickColor.setAlphaF(isDark ? 0.30 : 0.30); +- clickBrush.setColor(clickColor); +- } +- else{ +- QColor button = option->palette.color(QPalette::Active, QPalette::Button); +- +- //hover +- 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); +- +- //click +- clickBrush = QBrush(mixColor(button, mix, 0.2)); +- } +- } +- +- if (needTranslucent) { +- defaultBrush = option->palette.brush(QPalette::Active, QPalette::Mid); +- disableBrush = option->palette.brush(QPalette::Active, QPalette::Mid); +- +- if(isDark){ +- defaultBrush = option->palette.brush(QPalette::Active, QPalette::Text); +- disableBrush = option->palette.brush(QPalette::Active, QPalette::Text); +- } +- QColor defaultColor = defaultBrush.color(); +- defaultColor.setAlphaF(0.15); +- defaultBrush.setColor(defaultColor); +- +- QColor disableColor = disableBrush.color(); +- disableColor.setAlphaF(0.1); +- disableBrush.setColor(disableColor); +- } +- +- if (isImportant) { +- defaultBrush = highlight; +- } +- } +- +- pushButtonParameters.pushButtonDefaultBrush = defaultBrush; +- pushButtonParameters.pushButtonClickBrush = clickBrush; +- pushButtonParameters.pushButtonHoverBrush = hoverBrush; +- pushButtonParameters.pushButtonDisableBrush = disableBrush; +- pushButtonParameters.pushButtonCheckBrush = checkBrush; +- pushButtonParameters.pushButtonCheckHoverBrush = checkHoverBrush; +- pushButtonParameters.pushButtonCheckClickBrush = checkClickBrush; +- pushButtonParameters.pushButtonCheckDisableBrush = checkDisableBrush; +- pushButtonParameters.pushButtonFocusPen = focusPen; +-} +- +-void KFashionStyleParameters::initToolButtonParameters(bool isDark, const QStyleOption *option, const QWidget *widget) +-{ +- toolButtonParameters.radius = 6; +- +- QBrush defaultBrush; +- QBrush clickBrush; +- QBrush hoverBrush; +- QBrush disableBrush; +- +- QBrush checkBrush; +- QBrush checkHoverBrush; +- QBrush checkClickBrush; +- QBrush checkDisableBrush; +- +- QPen focusPen; +- +- +- QColor highlight = option->palette.color(QPalette::Active, QPalette::Highlight); +- QColor mix = option->palette.color(QPalette::Active, QPalette::BrightText); +- +- QColor startColor; +- QColor endColor; +- QLinearGradient linearGradient; +- +- //hover +- 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); +- 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); +- +- checkBrush = option->palette.color(QPalette::Active, QPalette::Highlight); +- checkHoverBrush = hoverBrush; +- checkClickBrush = clickBrush; +- checkDisableBrush = option->palette.brush(QPalette::Disabled, QPalette::NoRole); +- +- focusPen = QPen(QBrush(mixColor(highlight, mix, 0.2)), 2, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin); +- +- if (widget) { +- bool isWindowButton = false; +- bool isWindowColoseButton = false; +- bool useButtonPalette = false; +- bool needTranslucent = false; +- +- if (widget->property("isWindowButton").isValid()) { +- if (widget->property("isWindowButton").toInt() == 0x01) { +- isWindowButton = true; +- } +- if (widget->property("isWindowButton").toInt() == 0x02) { +- isWindowColoseButton = true; +- } +- } +- +- if (widget->property("useButtonPalette").isValid()) { +- useButtonPalette = widget->property("useButtonPalette").toBool(); +- } +- +- if (widget->property("needTranslucent").isValid()) { +- needTranslucent = widget->property("needTranslucent").toBool(); +- } +- +- if (isWindowColoseButton) { +- QColor ColoseButton = ColoseButtonColor; +- if (isDark) { +- startColor = QColor(242, 116, 133); +- endColor = QColor(221, 44, 68); +- } else { +- startColor = QColor(242, 82, 117); +- endColor = QColor(221, 44, 68); +- } +- linearGradient.setColorAt(0, startColor); +- linearGradient.setColorAt(1, endColor); +- hoverBrush = QBrush(linearGradient); +- +- //click +- clickBrush = QBrush(ColoseButton); +- +- //focus +- focusPen = QPen(QBrush(ColoseButton), 2, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin); +- +- } else if (isWindowButton && useTransparentButtonList().contains(qAppName())) { +- if (isDark) { +- mix.setAlphaF(0.28); +- hoverBrush = QBrush(mix); +- mix.setAlphaF(0.15); +- clickBrush = QBrush(mix); +- } else { +- mix.setAlphaF(0.15); +- hoverBrush = QBrush(mix); +- mix.setAlphaF(0.28); +- clickBrush = QBrush(mix); +- } +- } else if (useButtonPalette || isWindowButton) { +- if(needTranslucent) +- { +- if (isDark) { +- startColor = option->palette.color(QPalette::Active, QPalette::Light); +- endColor = option->palette.color(QPalette::Active, QPalette::Text); +- startColor.setAlphaF(0.2); +- endColor.setAlphaF(0.2); +- } else { +- startColor = option->palette.color(QPalette::Active, QPalette::Mid); +- endColor = option->palette.color(QPalette::Active, QPalette::Dark); +- startColor.setAlphaF(0.2); +- endColor.setAlphaF(0.2); +- } +- linearGradient.setColorAt(0, startColor); +- linearGradient.setColorAt(1, endColor); +- hoverBrush = QBrush(linearGradient); +- +- QColor clickColor = option->palette.color(QPalette::Active, QPalette::Dark); +- if(isDark) +- clickColor = option->palette.color(QPalette::Active, QPalette::Light); +- clickColor.setAlphaF(isDark ? 0.30 : 0.30); +- clickBrush.setColor(clickColor); +- } else { +- QColor button = option->palette.color(QPalette::Active, QPalette::Button); +- +- //hover +- 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); +- +- //click +- clickBrush = QBrush(mixColor(button, mix, 0.2)); +- } +- } +- +- if (needTranslucent) { +- defaultBrush = option->palette.brush(QPalette::Active, QPalette::Mid); +- disableBrush = option->palette.brush(QPalette::Active, QPalette::Mid); +- +- if(isDark){ +- defaultBrush = option->palette.brush(QPalette::Active, QPalette::Text); +- disableBrush = option->palette.brush(QPalette::Active, QPalette::Text); +- } +- QColor defaultColor = defaultBrush.color(); +- defaultColor.setAlphaF(0.15); +- defaultBrush.setColor(defaultColor); +- +- QColor disableColor = disableBrush.color(); +- disableColor.setAlphaF(0.1); +- disableBrush.setColor(disableColor); +- } +- } +- +- toolButtonParameters.toolButtonDefaultBrush = defaultBrush; +- toolButtonParameters.toolButtonClickBrush = clickBrush; +- toolButtonParameters.toolButtonHoverBrush = hoverBrush; +- toolButtonParameters.toolButtonDisableBrush = disableBrush; +- toolButtonParameters.toolButtonCheckBrush = checkBrush; +- toolButtonParameters.toolButtonCheckHoverBrush = checkHoverBrush; +- toolButtonParameters.toolButtonCheckClickBrush = checkClickBrush; +- toolButtonParameters.toolButtonCheckDisableBrush = checkDisableBrush; +- toolButtonParameters.toolButtonFocusPen = focusPen; +-} +- +-void KFashionStyleParameters::initLineEditParameters(bool isDark, const QStyleOption *option, const QWidget *widget) +-{ +- lineEditParameters.radius = 6; +- +- QBrush defaultBrush; +- QBrush hoverBrush; +- QBrush focusBrush; +- QBrush disableBrush; +- +- QPen defaultPen; +- QPen hoverPen; +- QPen focusPen; +- QPen disablePen; +- +- bool needTranslucent = false; +- +- if (widget && widget->property("needTranslucent").isValid()) { +- needTranslucent = widget->property("needTranslucent").toBool(); +- } +- +- //default state +- defaultBrush = option->palette.brush(QPalette::Disabled, QPalette::Button); +- defaultPen = QPen(Qt::NoPen); +- defaultPen.setWidth(0); +- +- //hover state +- hoverBrush = defaultBrush; +- hoverPen = defaultPen; +- +- //focus state +- focusBrush = option->palette.brush(QPalette::Active, QPalette::Base); +- focusPen = QPen(option->palette.brush(QPalette::Active, QPalette::Highlight), +- 2, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin); +- +- //disable state +- disableBrush = option->palette.brush(QPalette::Disabled, QPalette::Button); +- disablePen = QPen(Qt::NoPen); +- disablePen.setWidth(0); +- +- if(needTranslucent) +- { +- QColor defaultColor = option->palette.color(QPalette::Active, QPalette::Mid); +- if (isDark) +- defaultColor = option->palette.color(QPalette::Active, QPalette::Text); +- defaultColor.setAlphaF(isDark ? 0.1 : 0.15); +- defaultBrush.setColor(defaultColor); +- +- QColor focusColor = option->palette.color(QPalette::Active, QPalette::Base); +- focusColor.setAlphaF(isDark ? 0.45 : 0.65); +- focusBrush.setColor(focusColor); +- +- QColor startColor; +- QColor endColor; +- QLinearGradient linearGradient; +- if (isDark) { +- startColor = option->palette.color(QPalette::Active, QPalette::Light); +- endColor = option->palette.color(QPalette::Active, QPalette::Text); +- startColor.setAlphaF(0.2); +- endColor.setAlphaF(0.2); +- } else { +- startColor = option->palette.color(QPalette::Active, QPalette::Mid); +- endColor = option->palette.color(QPalette::Active, QPalette::Dark); +- startColor.setAlphaF(0.2); +- endColor.setAlphaF(0.2); +- } +- linearGradient.setColorAt(0, startColor); +- linearGradient.setColorAt(1, endColor); +- hoverBrush = QBrush(linearGradient); +- } +- +- lineEditParameters.lineEditDefaultBrush = defaultBrush; +- lineEditParameters.lineEditHoverBrush = hoverBrush; +- lineEditParameters.lineEditFocusBrush = focusBrush; +- lineEditParameters.lineEditDisableBrush = disableBrush; +- +- lineEditParameters.lineEditDefaultPen = defaultPen; +- lineEditParameters.lineEditHoverPen = hoverPen; +- lineEditParameters.lineEditFocusPen = focusPen; +- lineEditParameters.lineEditDisablePen = disablePen; +-} +- +-void KFashionStyleParameters::initSpinBoxParameters(bool isDark, const QStyleOption *option, const QWidget *widget, bool isHorizonLayout) +-{ +- spinBoxParameters.radius = 6; +- +- QBrush defaultBrush; +- QBrush hoverBrush; +- QBrush focusBrush; +- QBrush disableBrush; +- +- QPen defaultPen; +- QPen hoverPen; +- QPen focusPen; +- QPen disablePen; +- +- QBrush upHoverBrush; +- QBrush upFocusHoverBrush; +- QBrush upClickBrush; +- QBrush upDefaultBrush; +- QBrush downHoverBrush; +- QBrush downFocusHoverBrush; +- QBrush downClickBrush; +- QBrush downDefaultBrush; +- +- //default state +- defaultBrush = option->palette.brush(QPalette::Disabled, QPalette::Button); +- defaultPen = QPen(Qt::NoPen); +- defaultPen.setWidth(0); +- +- //hover state +- hoverPen = defaultPen; +- if(isHorizonLayout) +- hoverPen.setWidth(2); +- {//hoverBrush +- QColor startColor; +- QColor endColor; +- QColor mix = option->palette.color(QPalette::Active, QPalette::BrightText); +- QLinearGradient linearGradient; +- linearGradient.setStart(option->rect.topLeft()); +- linearGradient.setFinalStop(option->rect.bottomLeft()); +- if (isDark) { +- startColor = option->palette.color(QPalette::Active, QPalette::Midlight); +- endColor = option->palette.color(QPalette::Disabled, QPalette::NoRole); +- startColor.setAlphaF(0.5); +- endColor.setAlphaF(0.5); +- } else { +- startColor = option->palette.color(QPalette::Active, QPalette::Midlight); +- endColor = mixColor(startColor, mix, 0.1); +- startColor.setAlphaF(0.5); +- endColor.setAlphaF(0.5); +- } +- linearGradient.setColorAt(0, startColor); +- linearGradient.setColorAt(1, endColor); +- hoverBrush = QBrush(linearGradient); +- } +- +- //focus state +- focusBrush = option->palette.brush(QPalette::Active, QPalette::Base); +- focusPen = QPen(option->palette.brush(QPalette::Active, QPalette::Highlight), +- 2, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin); +- +- //disable state +- disableBrush = option->palette.brush(QPalette::Disabled, QPalette::Button); +- disablePen = QPen(Qt::NoPen); +- disablePen.setWidth(0); +- +- if(isHorizonLayout) +- { +- upDefaultBrush = option->palette.brush(QPalette::Active, QPalette::Button); +- downDefaultBrush = option->palette.brush(QPalette::Active, QPalette::Button); +- } +- else +- { +- upDefaultBrush = QBrush(Qt::NoBrush); +- downDefaultBrush = QBrush(Qt::NoBrush); +- } +- +- QColor highlight = option->palette.color(QPalette::Active, QPalette::Highlight); +- QColor button = option->palette.color(QPalette::Active, QPalette::Button); +- QColor mix = option->palette.color(QPalette::Active, QPalette::BrightText); +- QColor startColor; +- QColor endColor; +- +- QLinearGradient upLinearGradient; +- upLinearGradient.setStart(option->rect.left(), option->rect.top()); +- upLinearGradient.setFinalStop(option->rect.left(), option->rect.center().y()); +- //up hover +- 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); +- } +- upLinearGradient.setColorAt(0, startColor); +- upLinearGradient.setColorAt(1, endColor); +- upHoverBrush = QBrush(upLinearGradient); +- +- //up focus hover +- 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); +- } +- upLinearGradient.setColorAt(0, startColor); +- upLinearGradient.setColorAt(1, endColor); +- upFocusHoverBrush = QBrush(upLinearGradient); +- +- //up click +- upClickBrush = QBrush(mixColor(highlight, mix, 0.1)); +- +- +- QLinearGradient downLinearGradient; +- downLinearGradient.setStart(option->rect.left(), option->rect.center().y()); +- downLinearGradient.setFinalStop(option->rect.left(), option->rect.bottom()); +- //down hover +- 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); +- } +- downLinearGradient.setColorAt(0, startColor); +- downLinearGradient.setColorAt(1, endColor); +- downHoverBrush = QBrush(downLinearGradient); +- +- //down focus hover +- 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); +- } +- downLinearGradient.setColorAt(0, startColor); +- downLinearGradient.setColorAt(1, endColor); +- downFocusHoverBrush = QBrush(downLinearGradient); +- +- //down click +- downClickBrush = QBrush(mixColor(highlight, mix, 0.1)); +- +- +- +- spinBoxParameters.spinBoxDefaultBrush = defaultBrush; +- spinBoxParameters.spinBoxHoverBrush = hoverBrush; +- spinBoxParameters.spinBoxFocusBrush = focusBrush; +- spinBoxParameters.spinBoxDisableBrush = disableBrush; +- +- spinBoxParameters.spinBoxDefaultPen = defaultPen; +- spinBoxParameters.spinBoxHoverPen = hoverPen; +- spinBoxParameters.spinBoxFocusPen = focusPen; +- spinBoxParameters.spinBoxDisablePen = disablePen; +- +- spinBoxParameters.spinBoxUpDefaultBrush = upDefaultBrush; +- spinBoxParameters.spinBoxUpHoverBrush = upHoverBrush; +- spinBoxParameters.spinBoxUpFocusHoverBrush = upFocusHoverBrush; +- spinBoxParameters.spinBoxUpClickBrush = upClickBrush; +- spinBoxParameters.spinBoxDownHoverBrush = downHoverBrush; +- spinBoxParameters.spinBoxDownFocusHoverBrush = downFocusHoverBrush; +- spinBoxParameters.spinBoxDownClickBrush = downClickBrush; +- spinBoxParameters.spinBoxDownDefaultBrush = downDefaultBrush; +-} +- +-void KFashionStyleParameters::initComboBoxParameters(bool isDark, const QStyleOption *option, const QWidget *widget) +-{ +- comboBoxParameters.radius = 6; +- +- QBrush defaultBrush; +- QBrush hoverBrush; +- QBrush onBrush; +- QBrush editBrush; +- QBrush disableBrush; +- +- QPen defaultPen; +- QPen hoverPen; +- QPen onPen; +- QPen editPen; +- QPen disablePen; +- +- QColor button = option->palette.color(QPalette::Active, QPalette::Button); +- QColor mix = option->palette.color(QPalette::Active, QPalette::BrightText); +- +- //default state +- defaultBrush = option->palette.brush(QPalette::Disabled, QPalette::Button); +- defaultPen = QPen(Qt::NoPen); +- defaultPen.setWidth(0); +- +- //hover state +- if (isDark) { +- hoverBrush = QBrush(mixColor(button, mix, 0.2)); +- } else { +- hoverBrush = QBrush(mixColor(button, mix, 0.05)); +- } +- hoverPen = QPen(Qt::NoPen); +- hoverPen.setWidth(0); +- +- //on state +- if (isDark) { +- onBrush = QBrush(mixColor(button, mix, 0.05)); +- } else { +- onBrush = QBrush(mixColor(button, mix, 0.2)); +- } +- onPen = QPen(Qt::NoPen); +- onPen.setWidth(0); +- +- //focus and on state,edit mode +- editBrush = option->palette.brush(QPalette::Active, QPalette::Base); +- editPen = QPen(option->palette.brush(QPalette::Active, QPalette::Highlight), +- 2, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin); +- +- //disable state +- disableBrush = option->palette.brush(QPalette::Disabled, QPalette::Button); +- disablePen = QPen(Qt::NoPen); +- disablePen.setWidth(0); +- +- +- comboBoxParameters.comboBoxDefaultBrush = defaultBrush; +- comboBoxParameters.comboBoxHoverBrush = hoverBrush; +- comboBoxParameters.comboBoxOnBrush = onBrush; +- comboBoxParameters.comboBoxEditBrush = editBrush; +- comboBoxParameters.comboBoxDisableBrush = disableBrush; +- +- comboBoxParameters.comboBoxDefaultPen = defaultPen; +- comboBoxParameters.comboBoxHoverPen = hoverPen; +- comboBoxParameters.comboBoxOnPen = onPen; +- comboBoxParameters.comboBoxEditPen = editPen; +- comboBoxParameters.comboBoxDisablePen = disablePen; +-} +- +-void KFashionStyleParameters::initListParameters(bool isDark, const QStyleOption *option, const QWidget *widget) +-{ +- listParameters.radius = 6; +- +- QBrush defaultBrush; +- QBrush hoverBrush; +- QBrush selectBrush; +- QBrush disableBrush; +- QPen textHoverPen = QPen(Qt::NoPen); +- QPen textSelectPen = QPen(Qt::NoPen); +- bool needTranslucent = false; +- if (widget && widget->property("needTranslucent").isValid()) { +- needTranslucent = widget->property("needTranslucent").toBool(); +- } +- +- //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); +- +- const QStyleOptionViewItem *vi = qstyleoption_cast(option); +- QPalette::ColorGroup cg = vi->state & QStyle::State_Enabled +- ? QPalette::Normal : QPalette::Disabled; +- if (cg == QPalette::Normal && !(vi->state & QStyle::State_Active)) +- cg = QPalette::Inactive; +- +- if(needTranslucent) +- { +- if (isDark) { +- startColor = option->palette.color(QPalette::Active, QPalette::Light); +- endColor = option->palette.color(QPalette::Active, QPalette::Text); +- startColor.setAlphaF(0.15); +- endColor.setAlphaF(0.15); +- } else { +- startColor = option->palette.color(QPalette::Active, QPalette::Mid); +- endColor = option->palette.color(QPalette::Active, QPalette::Dark); +- startColor.setAlphaF(0.1); +- endColor.setAlphaF(0.1); +- } +- linearGradient.setColorAt(0, startColor); +- linearGradient.setColorAt(1, endColor); +- hoverBrush = QBrush(linearGradient); +- +- QColor selectColor = option->palette.color(QPalette::Active, QPalette::Dark); +- if(isDark) +- selectColor = option->palette.color(QPalette::Active, QPalette::Light); +- selectColor.setAlphaF(isDark ? 0.20 : 0.25); +- selectBrush.setColor(selectColor); +- +- textSelectPen = option->palette.color(cg, QPalette::Text); +- textHoverPen = option->palette.color(cg, QPalette::BrightText); +- } +- else +- { +- textSelectPen = option->palette.color(cg, QPalette::HighlightedText); +- textHoverPen = option->palette.color(cg, QPalette::Text); +- } +- +- listParameters.listDefaultBrush = defaultBrush; +- listParameters.listHoverBrush = hoverBrush; +- listParameters.listSelectBrush = selectBrush; +- listParameters.listDisableBrush = disableBrush; +- listParameters.listTextHoverPen = textHoverPen; +- listParameters.listTextSelectPen = textSelectPen; +-} +- +-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 = 0; +- +- 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; +- +- bool needTranslucent = false; +- if (widget && widget->property("needTranslucent").isValid()) { +- needTranslucent = widget->property("needTranslucent").toBool(); +- } +- +- QColor mix = option->palette.color(QPalette::Active, QPalette::BrightText); +- +- //default +- if (isDark) { +- QColor col = option->palette.color(QPalette::Active, QPalette::BrightText); +- col.setAlphaF(0.15); +- defaultPen = QPen(col, 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)); +- } +- +- if(needTranslucent) +- { +- QColor defaultColor = option->palette.color(QPalette::Active, QPalette::Mid); +- if(isDark) +- defaultColor = option->palette.color(QPalette::Active, QPalette::Text); +- defaultColor.setAlphaF(isDark ? 0.15 : 0.20); +- defaultBrush.setColor(defaultColor); +- QColor defaultPenColor = option->palette.color(QPalette::Active, QPalette::BrightText); +- defaultPenColor.setAlphaF(0.3); +- defaultPen = QPen(QBrush(defaultPenColor), 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin); +- +- +- QColor startColor; +- QColor endColor; +- QLinearGradient linearGradient; +- if (isDark) { +- startColor = option->palette.color(QPalette::Active, QPalette::Light); +- endColor = option->palette.color(QPalette::Active, QPalette::Text); +- startColor.setAlphaF(0.2); +- endColor.setAlphaF(0.2); +- } else { +- startColor = option->palette.color(QPalette::Active, QPalette::Mid); +- endColor = option->palette.color(QPalette::Active, QPalette::Dark); +- startColor.setAlphaF(0.2); +- endColor.setAlphaF(0.2); +- } +- linearGradient.setColorAt(0, startColor); +- linearGradient.setColorAt(1, endColor); +- hoverBrush = QBrush(linearGradient); +- hoverPen = defaultPen; +- +- +- QColor clickColor = option->palette.color(QPalette::Active, QPalette::Dark); +- if(isDark) +- clickColor = option->palette.color(QPalette::Active, QPalette::Light); +- clickColor.setAlphaF(0.30); +- clickBrush.setColor(clickColor); +- clickPen = defaultPen; +- } +- +- //disable +- disablePen = defaultPen; +- disableBrush = option->palette.brush(QPalette::Disabled, QPalette::Button); +- +- //on default +- onDefaultPen = QPen(Qt::NoPen); +- onDefaultPen.setWidth(0); +- onDefaultBrush = option->palette.brush(QPalette::Active, QPalette::Highlight); +- if(needTranslucent) +- { +- QColor onDefaultPenColor = option->palette.color(QPalette::Active, QPalette::BrightText); +- onDefaultPenColor.setAlphaF(0.1); +- onDefaultPen = QPen(QBrush(onDefaultPenColor), 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin); +- } +- +- //on hover +- onHoverPen = QPen(Qt::NoPen); +- onHoverPen.setWidth(0); +- 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); +- if(needTranslucent) +- { +- QColor onHoverPenColor = option->palette.color(QPalette::Active, QPalette::BrightText); +- onHoverPenColor.setAlphaF(0.2); +- onHoverPen = QPen(QBrush(onHoverPenColor), 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin); +- } +- +- //on click +- onClickPen = QPen(Qt::NoPen); +- onClickPen.setWidth(0); +- onClickBrush = QBrush(mixColor(onDefaultBrush.color(), mix, 0.1)); +- if(needTranslucent) +- { +- QColor onClickPenColor = option->palette.color(QPalette::Active, QPalette::BrightText); +- onClickPenColor.setAlphaF(0.2); +- onClickPen = QPen(QBrush(onClickPenColor), 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin); +- } +- +- 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) { +- QColor col = option->palette.color(QPalette::Active, QPalette::BrightText); +- col.setAlphaF(0.15); +- defaultPen = QPen(col, 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::Button); +- +- //on default +- onDefaultPen = QPen(Qt::NoPen); +- onDefaultPen.setWidth(0); +- onDefaultBrush = option->palette.brush(QPalette::Active, QPalette::Highlight); +- +- //on hover +- onHoverPen = QPen(Qt::NoPen); +- onHoverPen.setWidth(0); +- 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); +- onClickPen.setWidth(0); +- 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; +- +- bool needTranslucent = false; +- +- if (widget && widget->property("needTranslucent").isValid()) { +- needTranslucent = widget->property("needTranslucent").toBool(); +- } +- +- 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 +- if (isDark) { +- grooveValueDefaultBrush = QBrush(mixColor(highlight, mix, 0.05)); +- } else { +- grooveValueDefaultBrush = QBrush(mixColor(highlight, mix, 0.2)); +- } +- +- //groove value hover +- grooveValueHoverBrush = grooveValueDefaultBrush; +- +- //groove value disable +- grooveValueDisableBrush = handleDisableBrush; +- +- //groove unvalue default +- grooveUnvalueDefaultBrush = option->palette.color(QPalette::Active, QPalette::Button); +- if(needTranslucent) +- { +- QColor color = option->palette.color(QPalette::Active, QPalette::BrightText); +- color.setAlphaF(0.1); +- grooveUnvalueDefaultBrush.setColor(color); +- } +- +- //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; +- +- bool needTranslucent = false; +- +- if (widget && widget->property("needTranslucent").isValid()) { +- needTranslucent = widget->property("needTranslucent").toBool(); +- } +- +- 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); +- if(needTranslucent) +- { +- QColor grooveDefaultColor = pb->palette.color(QPalette::Active, QPalette::BrightText); +- grooveDefaultColor.setAlphaF(0.1); +- grooveDefaultBrush.setColor(grooveDefaultColor); +- } +- +- //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; +- +- bool needTranslucent = false; +- +- if (widget && widget->property("needTranslucent").isValid()) { +- needTranslucent = widget->property("needTranslucent").toBool(); +- } +- +- 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); +- +- +- if(needTranslucent) +- { +- QColor grooveDefaultColor = option->palette.color(QPalette::Active, QPalette::BrightText); +- grooveDefaultColor.setAlphaF(0.05); +- grooveDefaultBrush = QBrush(grooveDefaultColor); +- +- QColor grooveInactiveColor = option->palette.color(QPalette::Active, QPalette::BrightText); +- grooveInactiveColor.setAlphaF(0.05); +- grooveInactiveBrush = QBrush(grooveInactiveColor); +- +- QColor sliderDefaultColor = option->palette.color(QPalette::Active, QPalette::BrightText); +- sliderDefaultColor.setAlphaF(0.10); +- sliderDefaultBrush = QBrush(sliderDefaultColor); +- +- QColor sliderHoverColor = option->palette.color(QPalette::Active, QPalette::BrightText); +- sliderHoverColor.setAlphaF(0.2); +- sliderHoverBrush = QBrush(sliderHoverColor); +- +- QColor sliderClickColor = option->palette.color(QPalette::Active, QPalette::BrightText); +- sliderClickColor.setAlphaF(0.3); +- sliderClickBrush = QBrush(sliderClickColor); +- } +- +- +- 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(180)); +- pixmapPainter.setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform); +- 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.setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform); +- pixmapPainter2.setPen(Qt::transparent); +- pixmapPainter2.setBrush(linearGradient); +- pixmapPainter2.drawPath(drawRightBottomPath); +- } else { +- int rander = 2; +- drawRect = option->rect.adjusted(+rander, +rander+6, -rander, -rander-6); +- +- // Draw a black floor +- QPainter pixmapPainter(&framePixmap); +- pixmapPainter.setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform); +- 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.setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform); +- 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.setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform); +- 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.setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform); +- 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.setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform); +- 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 +deleted file mode 100644 +index 5c8a940..0000000 +--- a/ukui-styles/qt5-style-ukui/kabstract-style-parameters.h ++++ /dev/null +@@ -1,311 +0,0 @@ +-/* +- * Qt5-UKUI's Library +- * +- * Copyright (C) 2023, KylinSoft Co., Ltd. +- * +- * This library is free software; you can redistribute it and/or +- * modify it under the terms of the GNU Lesser General Public +- * License as published by the Free Software Foundation; either +- * version 3 of the License, or (at your option) any later version. +- * +- * This library is distributed in the hope that it will be useful, +- * but WITHOUT ANY WARRANTY; without even the implied warranty of +- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +- * Lesser General Public License for more details. +- * +- * You should have received a copy of the GNU General Public License +- * along with this library. If not, see . +- * +- * Authors: xibowen +- * +- */ +- +-#ifndef KABSTRACTSTYLEPARAMETERS_H +-#define KABSTRACTSTYLEPARAMETERS_H +- +-#include +-#include +-#include +- +-#include "pushbutton-parameters.h" +-#include "toolbutton-parameters.h" +-#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" +- +- +- +-class KAbstractStyleParameters: public QObject +-{ +- Q_OBJECT +-public: +- KAbstractStyleParameters(QObject *parent, bool isDark); +- +- enum SpinBoxControlLayout { +- Horizontal, +- Vertical +- }; +- Q_ENUM(SpinBoxControlLayout) +- +- void updateParameters(bool isTabletMode); +- +- // radius +- int radius = 6; +- +- // common +- int SmallIcon_Size = 16; +- int IconButton_Distance = 8; +- +- // button +- int Button_MarginHeight = 0; +- int ToolButton_MarginWidth = 8; +- int Button_MarginWidth = 8; +- int Button_IconSize = 16; +- int Button_IndicatorSize = 16; +- int Button_DefaultIndicatorSize = 0; +- int Button_DefaultWidth = 96; +- int Button_DefaultHeight = 36; +- int Button_DefaultHeight_origin = 36; +- int ToolButton_DefaultWidth = 60; +- int IconButton_DefaultWidth = 36; +- int IconButton_DefaultWidth_origin = 36; +- QColor ColoseButtonColor; +- +- // menu +- int Menu_MarginHeight = 4 + 8; +- int Menu_Combobox_Popup_MarginHeight = 4; +- int Menu_MarginWidth = 4 + 2; +- int Menu_MarginPanelWidth = 0; +- +- // menu-item +- int MenuItem_MarginHeight = 2; +- int MenuItem_MarginWidth = 12 + 4; +- int MenuItemSeparator_MarginHeight = 4; +- int MenuItemSeparator_MarginHeight_origin = 4; +- int MenuItemSeparator_MarginWidth = 4; +- int MenuItem_DefaultHeight = 36; +- int MenuItem_DefaultHeight_origin = 36; +- int MenuItem_DefaultWidght = 152; +- +- // scrollbar +- int ScroolBar_Width = 16; +- int ScroolBar_Width_origin = 16; +- int ScroolBar_Height = 68; +- +- // progressbar +- int ProgressBar_DefaultLength = 388; +- int ProgressBar_DefaultThick = 16; +- +- // slider +- int Slider_DefaultLength = 94; +- int Slider_DefaultLength_origin = 94; +- int Slider_Length = 20; +- int Slider_Length_origin = 20; +- int Slider_GrooveLength = 4; +- int Slider_GrooveLength_origin = 4; +- int Slider_Margin = 2; +- +- // radiobutton +- int ExclusiveIndicator_Width = 16; +- int ExclusiveIndicator_Height = 16; +- int RadioButtonLabel_Spacing = 8; +- int RadioButton_DefaultHeight = 36; +- int RadioButton_DefaultHeight_origin = 36; +- +- // checkbox +- int Indicator_Width = 16; +- int Indicator_Height = 16; +- int CheckBox_DefaultHeight = 36; +- int CheckBox_DefaultHeight_origin = 36; +- int CheckBox_Radius = 4; +- +- // lineedit +- int LineEdit_DefaultWidth = 160; +- int LineEdit_DefaultWidth_origin = 160; +- int LineEdit_DefaultHeight = 36; +- int LineEdit_DefaultHeight_origin = 36; +- +- // combobox +- int ComboBox_DefaultWidth = 160; +- int ComboBox_DefaultHeight = 36; +- int ComboBox_DefaultHeight_origin = 36; +- int ComboBox_DefaultMenuItemHeight = 36; +- int ComboBox_DefaultMenuItemHeight_original = 36; +- int ComboBox_FrameWidth = 2; +- int ComboBox_VMargin = 1; +- +- // spinbox +- int SpinBox_DefaultWidth = 160; +- int SpinBox_DefaultHeight = 36; +- int SpinBox_DefaultHeight_origin = 36; +- int SpinBox_FrameWidth = 2; +- +- // tabbar +- int TabBar_DefaultMinWidth = 168; +- int TabBar_DefaultMaxWidth = 248; +- int TabBar_DefaultHeight = 40; +- int TabBar_DefaultHeight_origin = 40; +- int TabBar_ScrollButtonWidth = 16; +- int TabBar_ScrollButtonOverlap = 2; +- +- // tooltip +- int ToolTip_DefaultMargin = 8; +- int ToolTip_Height = 36; +- int ToolTip_Height_origin = 36; +- +- //viewitem FIX:Separate to list,tree and table after +- int ViewItem_DefaultHeight = 36; +- int ViewItem_DefaultHeight_origin = 36; +- +- //table +- int Table_HeaderHeight = 36; +- int Table_HeaderHeight_origin = 36; +- +- float m_scaleRatio4_3 = 1.0; +- float m_scaleRatio3_2 = 1.0; +- float m_scaleRatio2_1 = 1.0; +- +- int m_headerDefaultSectionSizeVertical = 36; +- int m_headerDefaultSectionSizeVertical1_1 = 36; +- int m_headerDefaultSectionSizeVertical4_3 = 48; +- bool m_isTableMode = false; +- bool m_isInitial = true; +- +- float m_scaleSliderDefaultLength = 1.0; +- float m_ScaleComboBoxDefaultLength = 1.0; +- float m_ScaleLineEditDefaultLength = 1.0; +- float m_scaleTabBarHeight6_5 = 1.0; +- +- +- QPalette defaultPalette; +- +- PushButtonParameters pushButtonParameters; +- ToolButtonParameters toolButtonParameters; +- 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); +- int getSpinBoxControlLayout(); +- +- virtual void initPalette(bool isDark) = 0; +- virtual void initPushButtonParameters(bool isDark, const QStyleOption *option, const QWidget *widget) = 0; +- virtual void initToolButtonParameters(bool isDark, const QStyleOption *option, const QWidget *widget) = 0; +- virtual void initLineEditParameters(bool isDark, const QStyleOption *option, const QWidget *widget) = 0; +- virtual void initSpinBoxParameters(bool isDark, const QStyleOption *option, const QWidget *widget, bool isHorizonLayout = false) = 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; +- +-private: +- int m_spinBoxControlLayout = SpinBoxControlLayout::Vertical; +-}; +- +- +-class KDefaultStyleParameters : public KAbstractStyleParameters +-{ +-public: +- KDefaultStyleParameters(QObject *parent, bool isDark); +- +- 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, bool isHorizonLayout = false) 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; +-}; +- +- +-class KClassicalStyleParameters : public KAbstractStyleParameters +-{ +-public: +- KClassicalStyleParameters(QObject *parent, bool isDark); +- +- 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, bool isHorizonLayout = false) 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; +-}; +- +- +-class KFashionStyleParameters : public KAbstractStyleParameters +-{ +-public: +- KFashionStyleParameters(QObject *parent, bool isDark); +- +- 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, bool isHorizonLayout = false) 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/qt5-ukui-style.cpp b/ukui-styles/qt5-style-ukui/qt5-ukui-style.cpp +index d63da35..e0bd4bf 100644 +--- a/ukui-styles/qt5-style-ukui/qt5-ukui-style.cpp ++++ b/ukui-styles/qt5-style-ukui/qt5-ukui-style.cpp +@@ -196,8 +196,8 @@ Qt5UKUIStyle::Qt5UKUIStyle(bool dark, bool useDefault, QString type) : QProxySty + } else { + qWarning("org.ukui.peripherals-mouse no doubleClick keys!"); + } +- settings->deleteLater(); +- settings = nullptr; ++// settings->deleteLater(); ++// settings = nullptr; + } else { + qWarning("org.ukui.peripherals-mouse is null!"); + } +@@ -261,7 +261,7 @@ Qt5UKUIStyle::Qt5UKUIStyle(bool dark, bool useDefault, QString type) : QProxySty + sp = new KClassicalStyleParameters(this, isUseDarkPalette()); + + qDebug() << "classical setproperty........" << sp->radiusProperty().maxRadius << sp->radiusProperty().normalRadius << sp->radiusProperty().minRadius; +- setProperty("maxRadius", sp->radiusProperty().maxRadius); ++ setProperty("windowRadius", sp->radiusProperty().maxRadius); + setProperty("normalRadius", sp->radiusProperty().normalRadius); + setProperty("minRadius", sp->radiusProperty().minRadius); + } +@@ -627,6 +627,15 @@ bool Qt5UKUIStyle::eventFilter(QObject *obj, QEvent *e) + + } + ++ if (qobject_cast(obj)) { ++ if (e->type() == QEvent::Show) { ++ if (QMenu *w = qobject_cast(obj)) { ++ if (!KWindowSystem::compositingActive()) { ++ w->setProperty("useSystemStyleBlur", false); ++ } ++ } ++ } ++ } + return false; + } + +@@ -5333,15 +5342,17 @@ void Qt5UKUIStyle::drawControl(QStyle::ControlElement element, const QStyleOptio + bool hasIcon = false; + if(isComboBox) + { +- auto *comboBox = qobject_cast(widget); +- int column = comboBox->count(); +- for(int i = 0; i < column; i++) +- { +- if(!comboBox->itemIcon(i).isNull()){ +- hasIcon = true; +- break; +- } +- } ++ if(!menuItem->icon.isNull()) ++ hasIcon = true; ++// auto *comboBox = qobject_cast(widget); ++// int column = comboBox->count(); ++// for(int i = 0; i < column; i++) ++// { ++// if(!comboBox->itemIcon(i).isNull()){ ++// hasIcon = true; ++// break; ++// } ++// } + } + else if(menuItem->maxIconWidth != 0) + hasIcon = true; +@@ -7086,15 +7097,17 @@ QSize Qt5UKUIStyle::sizeFromContents(ContentsType ct, const QStyleOption *option + bool hasIcon = false; + if(isComboBox) + { +- auto *comboBox = qobject_cast(widget); +- int column = comboBox->count(); +- for(int i = 0; i < column; i++) +- { +- if(!comboBox->itemIcon(i).isNull()){ +- hasIcon = true; +- break; +- } +- } ++ if(!menuItem->icon.isNull()) ++ hasIcon = true; ++// auto *comboBox = qobject_cast(widget); ++// int column = comboBox->count(); ++// for(int i = 0; i < column; i++) ++// { ++// if(!comboBox->itemIcon(i).isNull()){ ++// hasIcon = true; ++// break; ++// } ++// } + } + else if(menuItem->maxIconWidth != 0) + { +diff --git a/ukui-styles/qt5-style-ukui/themeconfig/style-ukui-classical.json b/ukui-styles/qt5-style-ukui/themeconfig/style-ukui-classical.json +index 45be0db..3164a16 100644 +--- a/ukui-styles/qt5-style-ukui/themeconfig/style-ukui-classical.json ++++ b/ukui-styles/qt5-style-ukui/themeconfig/style-ukui-classical.json +@@ -1,6 +1,6 @@ + { + "Radius":{ +- "Max_Radius" : {"value": "0", "type": "int"}, ++ "Window_Radius" : {"value": "0", "type": "int"}, + "Normal_Radius" : {"value": "0", "type": "int"}, + "Min_Radius" : {"value": "0", "type": "int"} + } +diff --git a/ukui-styles/qt5-style-ukui/ukui-style-parameters.h b/ukui-styles/qt5-style-ukui/ukui-style-parameters.h +index 6b838fe..4809481 100644 +--- a/ukui-styles/qt5-style-ukui/ukui-style-parameters.h ++++ b/ukui-styles/qt5-style-ukui/ukui-style-parameters.h +@@ -189,7 +189,7 @@ public: + bool TabBar_BorderLine = false; + + // tooltip +- int ToolTip_DefaultMargin = 8; ++ int ToolTip_DefaultMargin = 10; + int ToolTip_Height = 36; + int ToolTip_Height_origin = 36; + +diff --git a/ukui-styles/readconfig.cpp b/ukui-styles/readconfig.cpp +index 607b7fd..2c51920 100644 +--- a/ukui-styles/readconfig.cpp ++++ b/ukui-styles/readconfig.cpp +@@ -1128,7 +1128,7 @@ UKUIRadiusInformation::UKUIRadiusStruct ReadThemeConfig::getRadiusStruct(QString + if(!m_loadConfig) + return m_radiusStruct; + +- getRadius(Max_Radius, m_radiusStruct.maxRadius); ++ getRadius(Window_Radius, m_radiusStruct.maxRadius); + getRadius(Normal_Radius, m_radiusStruct.normalRadius); + getRadius(Min_Radius, m_radiusStruct.minRadius); + return m_radiusStruct; +diff --git a/ukui-styles/themeinformation.h b/ukui-styles/themeinformation.h +index 5cbe95d..8af8bc8 100644 +--- a/ukui-styles/themeinformation.h ++++ b/ukui-styles/themeinformation.h +@@ -43,7 +43,7 @@ + #define Obj_PaletteRole_Type "paletterole" + + #define UKUI_Radius "Radius" +-#define Max_Radius "Max_Radius" ++#define Window_Radius "Window_Radius" + #define Normal_Radius "Normal_Radius" + #define Min_Radius "Min_Radius" + +diff --git a/ukui-styles/ukui-style-plugin.cpp b/ukui-styles/ukui-style-plugin.cpp +index 9cefa7e..e411b3e 100644 +--- a/ukui-styles/ukui-style-plugin.cpp ++++ b/ukui-styles/ukui-style-plugin.cpp +@@ -65,11 +65,24 @@ UKUIStylePlugin::UKUIStylePlugin(QObject *parent) : + if(qAppName() != blackStyleChangeApp) { + if (widgetThemeName == "classical") { + styleName ="ukui-config"; +- qApp->setStyle(new UKUIConfigStyle(styleName)); + } else { + styleName = "ukui-config"; +- qApp->setStyle(new UKUIConfigStyle(styleName)); + } ++ qApp->setStyle(new UKUIConfigStyle(styleName)); ++ ++// if(key == "widgetThemeName" || key == "widget-theme-name"){ ++// qDebug() << "qApp style....." << qApp->style(); ++// auto configStyle = qobject_cast(qApp->style()); ++// if(configStyle){ ++// int max, normal, min; ++// max = configStyle->property("windowRadius").isValid() ? configStyle->property("windowRadius").toInt() : settings->get("windowRadius").toInt(); ++// normal = configStyle->property("normalRadius").isValid() ? configStyle->property("normalRadius").toInt() : settings->get("normalRadius").toInt(); ++// min = configStyle->property("minRadius").isValid() ? configStyle->property("minRadius").toInt() : settings->get("minRadius").toInt(); ++// settings->trySet("max-radius", max); ++// settings->trySet("normal-radius", normal); ++// settings->trySet("min-radius", min); ++// } ++// } + } + + return; +@@ -95,6 +108,31 @@ UKUIStylePlugin::UKUIStylePlugin(QObject *parent) : + if (key == "useSystemPalette") { + onSystemPaletteChanged(); + } ++ ++ /* ++ if(key == "window-radius" || key == "windowRadius"){ ++ auto radius = settings->get("windowRadius").toInt(); ++ foreach (QWidget *widget, qApp->allWidgets()) { ++ widget->setProperty("windowRadius", radius); ++ widget->repaint(); ++ } ++ } ++ if(key == "normal-radius" || key == "normalRadius"){ ++ auto radius = settings->get("normalRadius").toInt(); ++ //qDebug() << "normalRadius.........." << radius; ++ foreach (QWidget *widget, qApp->allWidgets()) { ++ widget->setProperty("normalRadius", radius); ++ widget->repaint(); ++ } ++ } ++ if(key == "min-radius" || key == "minRadius"){ ++ auto radius = settings->get("minRadius").toInt(); ++ foreach (QWidget *widget, qApp->allWidgets()) { ++ widget->setProperty("minRadius", radius); ++ widget->repaint(); ++ } ++ } ++ */ + }); + } + +diff --git a/ukui-styles/window-manager.cpp b/ukui-styles/window-manager.cpp +index e3efd8e..44903ee 100644 +--- a/ukui-styles/window-manager.cpp ++++ b/ukui-styles/window-manager.cpp +@@ -34,6 +34,7 @@ + #include + + #include ++#include "black-list.h" + + WindowManager::WindowManager(QObject *parent) : QObject(parent) + { +@@ -122,6 +123,10 @@ bool WindowManager::eventFilter(QObject *obj, QEvent *e) + } + case QEvent::MouseMove: { + //if (QWidget::mouseGrabber()) return false; ++ //fixbug#182587 ++ if(windowManageBlackList().contains(qApp->applicationName()) || windowManageBlackList().contains(qAppName())){ ++ return false; ++ } + QMouseEvent *event = static_cast(e); + + /*! \note In x11, accuracy of the MouseEvent translated from TouchEvent is not diff --git a/debian/patches/series b/debian/patches/series index 2c87209..72d5524 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -5,3 +5,4 @@ 0005-menu-tooltip.patch 0006-Add-a-changelog-2023.10.13-4.1.0.0-0k6.patch 0007-Add-a-changelog-2023.10.16-4.1.0.0-0k7.patch +0008-commit-2c7dbff6-fixbug145709.patch