Skip to content

Commit

Permalink
sync: from linuxdeepin/dtkgui
Browse files Browse the repository at this point in the history
Synchronize source files from linuxdeepin/dtkgui.

Source-pull-request: linuxdeepin/dtkgui#231
  • Loading branch information
deepin-ci-robot committed Mar 21, 2024
1 parent 0b458e1 commit 4892da2
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
1 change: 1 addition & 0 deletions include/kernel/dguiapplicationhelper.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
13 changes: 9 additions & 4 deletions src/kernel/dguiapplicationhelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
// 处理半透明色
Expand Down Expand Up @@ -1197,15 +1195,15 @@ 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);

if (d->appPalette) {
return *d->appPalette;
}

ColorType type = d->paletteType;
ColorType type = paletteType;
bool aa_setPalette = qGuiApp && qGuiApp->testAttribute(Qt::AA_SetPalette);
// 此时appTheme可能还未初始化, 因此先使用systemTheme, 待appTheme初始化之后会
// 通知程序调色板发生改变
Expand Down Expand Up @@ -1240,6 +1238,13 @@ DPalette DGuiApplicationHelper::applicationPalette() const
return pa;
}

DPalette DGuiApplicationHelper::applicationPalette() const
{
D_DC(DGuiApplicationHelper);

return applicationPalette(d->paletteType);
}

/*!
\brief DGuiApplicationHelper::setApplicationPalette.
Expand Down

0 comments on commit 4892da2

Please sign in to comment.