From 9a6901fa0079a00787c20d60827dc5c04ba17b1a Mon Sep 17 00:00:00 2001 From: deepin-ci-robot Date: Mon, 22 Sep 2025 09:56:16 +0000 Subject: [PATCH] sync: from linuxdeepin/dtkdeclarative Synchronize source files from linuxdeepin/dtkdeclarative. Source-pull-request: https://github.com/linuxdeepin/dtkdeclarative/pull/530 --- src/private/dquickcontrolpalette.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/private/dquickcontrolpalette.cpp b/src/private/dquickcontrolpalette.cpp index 62f7355..c1f83c9 100644 --- a/src/private/dquickcontrolpalette.cpp +++ b/src/private/dquickcontrolpalette.cpp @@ -842,6 +842,17 @@ QColor DQuickControlColorSelector::getColorOf(const DQuickControlPalette *palett colorValue = QColor(255 - r, 255 - g, 255 - b, a); } + // items with inactive state should use inactive color, it likes dtkgui's generatePaletteColor_helper. + static const auto useInactiveColor = DGuiApplicationHelper::testAttribute(DGuiApplicationHelper::UseInactiveColorGroup); + if (useInactiveColor && state->controlState == DQMLGlobalObject::InactiveState) { + const auto &palette = DGuiApplicationHelper::standardPalette(state->controlTheme); + const auto &windowColor = palette.color(QPalette::Window); + + QColor inactiveMaskColor = windowColor; + inactiveMaskColor.setAlphaF(state->controlTheme == DGuiApplicationHelper::DarkType ? 0.6 : 0.4); + colorValue = DGuiApplicationHelper::blendColor(colorValue, inactiveMaskColor); + } + return colorValue; }