From 4892da277141e6b093b1f250688ba430e8b94e04 Mon Sep 17 00:00:00 2001 From: deepin-ci-robot Date: Thu, 21 Mar 2024 06:30:09 +0000 Subject: [PATCH] sync: from linuxdeepin/dtkgui Synchronize source files from linuxdeepin/dtkgui. Source-pull-request: https://github.com/linuxdeepin/dtkgui/pull/231 --- include/kernel/dguiapplicationhelper.h | 1 + src/kernel/dguiapplicationhelper.cpp | 13 +++++++++---- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/include/kernel/dguiapplicationhelper.h b/include/kernel/dguiapplicationhelper.h index 1ac7b1d..5b82017 100644 --- a/include/kernel/dguiapplicationhelper.h +++ b/include/kernel/dguiapplicationhelper.h @@ -98,6 +98,7 @@ class DGuiApplicationHelper : public QObject, public DCORE_NAMESPACE::DObject #endif DPalette applicationPalette() const; + DPalette applicationPalette(ColorType paletteType) const; void setApplicationPalette(const DPalette &palette); #if DTK_VERSION < DTK_VERSION_CHECK(6, 0, 0, 0) D_DECL_DEPRECATED DPalette windowPalette(QWindow *window) const; diff --git a/src/kernel/dguiapplicationhelper.cpp b/src/kernel/dguiapplicationhelper.cpp index 115e774..e26e735 100644 --- a/src/kernel/dguiapplicationhelper.cpp +++ b/src/kernel/dguiapplicationhelper.cpp @@ -855,9 +855,7 @@ DPalette DGuiApplicationHelper::standardPalette(DGuiApplicationHelper::ColorType #if QT_VERSION >= QT_VERSION_CHECK(5, 12, 0) if (role == QPalette::PlaceholderText) { - // 5.15新添加此颜色 这里使用5.11的颜色保证效果与5.11对齐 color = dcolor_list[DPalette::PlaceholderText]; - continue; } #endif // 处理半透明色 @@ -1197,7 +1195,7 @@ DPlatformTheme *DGuiApplicationHelper::windowTheme(QWindow *window) const \warning 不应该在DTK程序中使用QGuiApplication/QApplication::setPalette \return 应用程序调色板 */ -DPalette DGuiApplicationHelper::applicationPalette() const +DPalette DGuiApplicationHelper::applicationPalette(ColorType paletteType) const { D_DC(DGuiApplicationHelper); @@ -1205,7 +1203,7 @@ DPalette DGuiApplicationHelper::applicationPalette() const return *d->appPalette; } - ColorType type = d->paletteType; + ColorType type = paletteType; bool aa_setPalette = qGuiApp && qGuiApp->testAttribute(Qt::AA_SetPalette); // 此时appTheme可能还未初始化, 因此先使用systemTheme, 待appTheme初始化之后会 // 通知程序调色板发生改变 @@ -1240,6 +1238,13 @@ DPalette DGuiApplicationHelper::applicationPalette() const return pa; } +DPalette DGuiApplicationHelper::applicationPalette() const +{ + D_DC(DGuiApplicationHelper); + + return applicationPalette(d->paletteType); +} + /*! \brief DGuiApplicationHelper::setApplicationPalette.