From 49d85bf83b19b66d44213cc367bba4a859f0b656 Mon Sep 17 00:00:00 2001 From: xujin Date: Mon, 10 Aug 2026 18:46:03 +0800 Subject: [PATCH] fix(dde-license-dialog): correct disabled-state button color in disclaimer dialog MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bug 360973: 控制中心开启开发者模式免责声明框"确定"按钮活动色状态有误 Root cause: Content::updateAcceptBtnPalette() set QPalette::Disabled ButtonText to the highlight (active) color, so the confirm button appeared active even before the user checked the agreement checkbox. The QSS also lacked a :disabled pseudo-state, so the disabled background was identical to the normal background. Fix: - Disabled ButtonText now uses the standard DTK disabled text color (QPalette::Disabled, QPalette::WindowText) instead of highlight. - Added QPushButton:disabled rule to the accept-button QSS with a lighter background so the disabled state is visually distinct. - Kept the Normal ButtonText as highlight color (active state after checking the agreement) so the enabled/disabled contrast is clear. --- dde-license-dialog/src/content.cpp | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/dde-license-dialog/src/content.cpp b/dde-license-dialog/src/content.cpp index 1f1b7cd7..6e00d63e 100644 --- a/dde-license-dialog/src/content.cpp +++ b/dde-license-dialog/src/content.cpp @@ -292,20 +292,19 @@ void Content::updateWindowHeight() void Content::updateAcceptBtnPalette() { - const QString btnStyle = "QPushButton { background-color: rgba(0, 0, 0, 0.15); border: none; border-radius: 6px; }" + const QString cancelBtnStyle = "QPushButton { background-color: rgba(0, 0, 0, 0.15); border: none; border-radius: 6px; }" "QPushButton:hover { background-color: rgba(0, 0, 0, 0.2); }" "QPushButton:pressed { background-color: rgba(0, 0, 0, 0.25); }"; - m_cancelBtn->setStyleSheet(btnStyle); - m_acceptBtn->setStyleSheet(btnStyle); + m_cancelBtn->setStyleSheet(cancelBtnStyle); + + const QString acceptBtnStyle = "QPushButton { background-color: rgba(0, 0, 0, 0.15); border: none; border-radius: 6px; }" + "QPushButton:hover { background-color: rgba(0, 0, 0, 0.2); }" + "QPushButton:pressed { background-color: rgba(0, 0, 0, 0.25); }" + "QPushButton:disabled { background-color: rgba(0, 0, 0, 0.05); }"; + m_acceptBtn->setStyleSheet(acceptBtnStyle); DPalette pa = m_acceptBtn->palette(); - QColor highlightColor = pa.highlight().color(); - if (DGuiApplicationHelper::instance()->themeType() == DGuiApplicationHelper::DarkType) { - highlightColor.setAlphaF(0.7); - } else { - highlightColor.setAlphaF(0.6); - } - pa.setColor(QPalette::Disabled, QPalette::ButtonText, highlightColor); pa.setColor(QPalette::Normal, QPalette::ButtonText, pa.highlight().color()); + pa.setColor(QPalette::Disabled, QPalette::ButtonText, pa.color(QPalette::Disabled, QPalette::WindowText)); m_acceptBtn->setPalette(pa); }