Skip to content

fix: correct license dialog button disabled style - #454

Open
xujin177 wants to merge 1 commit into
linuxdeepin:masterfrom
xujin177:master
Open

xujin177 wants to merge 1 commit into
linuxdeepin:masterfrom
xujin177:master

Conversation

@xujin177

@xujin177 xujin177 commented Sep 17, 2026

Copy link
Copy Markdown
  1. Change the default background opacity for the custom push button from 0.15 to 0.05 when the button is disabled, so the disabled state renders as a lighter, flatter surface
  2. Extract the QStyle::State_Enabled check into a named enabled const and only apply the 0.15/0.25/0.35 opacities for enabled, sunken and hover states respectively
  3. Apply palette colors to QPalette::All color groups (Button and ButtonText) instead of only the Active group, otherwise the Disabled color group was ignored and the wrong color was painted
  4. When the button is highlighted (i.e. the license agreement checkbox is unchecked and the button is disabled), use QPalette::Disabled/ WindowText for the text instead of the highlight color; once the checkbox is checked and the button becomes enabled, the text switches to the Active/Highlight color, making the two states clearly distinguishable

Log: Adjusted the license dialog button styling so the disabled and enabled states are visually distinguishable

Influence:

  1. Open the license dialog with the agreement checkbox unchecked and verify the confirm button uses the disabled text color and the lighter 0.05 background
  2. Check the agreement checkbox and verify the button text switches to the active highlight color and the background becomes 0.15 opacity
  3. Verify hover and pressed states of the enabled button use 0.25 and 0.35 opacity respectively
  4. Verify the button renders correctly under light, dark and high- contrast themes
  5. Verify disabled buttons remain non-clickable and enabled buttons trigger the expected action
  6. Verify the button also renders correctly when the style is applied outside of the dialog context (e.g. other windows using the same button class)

fix: 修正许可协议对话框按钮禁用态样式

  1. 将自定义按钮的默认背景透明度从 0.15 改为 0.05,使按钮在禁用状态下呈现 更浅、更平的视觉效果
  2. 将 QStyle::State_Enabled 判断提取为具名常量 enabled,仅在启用状态下分 别应用 0.15、0.25、0.35 的透明度对应普通、按下和悬停状态
  3. 将调色板颜色应用到 QPalette::All 所有颜色组(Button 与 ButtonText), 而不是仅应用到 Active 组,否则 Disabled 颜色组会被忽略,导致绘制颜色不
    正确
  4. 当按钮处于高亮状态时(即未勾选许可协议、按钮不可用),文字使用 QPalette::Disabled/WindowText 而非高亮色;勾选协议后按钮变为可用,文字才 切换到 Active/Highlight 高亮色,使两种状态清晰可区分

Log: 调整许可协议对话框按钮样式,使禁用态与可用态可明显区分

Influence:

  1. 打开许可协议对话框,保持协议复选框未勾选,验证确认按钮使用禁用态文字 色以及更浅的 0.05 背景
  2. 勾选协议复选框,验证按钮文字切换为活动高亮色、背景透明度变为 0.15
  3. 验证可用按钮的悬停态与按下态分别使用 0.25 与 0.35 的透明度
  4. 验证按钮在浅色、深色及高对比度主题下的渲染效果
  5. 验证禁用按钮仍不可点击,可用按钮能触发预期操作
  6. 验证在对话框之外的场景(例如使用同一按钮类的其他窗口)中按钮渲染同样 正确

PMS: BUG-360973

Summary by Sourcery

Fix license dialog button rendering to clearly distinguish disabled, enabled, hover, and pressed states across themes.

Bug Fixes:

  • Correct the license dialog button styling so disabled and enabled states use clearly distinguishable backgrounds and text colors.

Enhancements:

  • Apply button palette colors consistently across all color groups and preserve distinct hover and pressed appearances for enabled buttons.

1. Change the default background opacity for the custom push button from
0.15 to 0.05 when the button is disabled, so the disabled state renders
as a lighter, flatter surface
2. Extract the QStyle::State_Enabled check into a named `enabled` const
and only apply the 0.15/0.25/0.35 opacities for enabled, sunken and
hover states respectively
3. Apply palette colors to QPalette::All color groups (Button and
ButtonText) instead of only the Active group, otherwise the Disabled
color group was ignored and the wrong color was painted
4. When the button is highlighted (i.e. the license agreement checkbox
is unchecked and the button is disabled), use QPalette::Disabled/
WindowText for the text instead of the highlight color; once
the checkbox is checked and the button becomes enabled, the text
switches to the Active/Highlight color, making the two states clearly
distinguishable

Log: Adjusted the license dialog button styling so the disabled and
enabled states are visually distinguishable

Influence:
1. Open the license dialog with the agreement checkbox unchecked and
verify the confirm button uses the disabled text color and the lighter
0.05 background
2. Check the agreement checkbox and verify the button text switches to
the active highlight color and the background becomes 0.15 opacity
3. Verify hover and pressed states of the enabled button use 0.25 and
0.35 opacity respectively
4. Verify the button renders correctly under light, dark and high-
contrast themes
5. Verify disabled buttons remain non-clickable and enabled buttons
trigger the expected action
6. Verify the button also renders correctly when the style is applied
outside of the dialog context (e.g. other windows using the same button
class)

fix: 修正许可协议对话框按钮禁用态样式

1. 将自定义按钮的默认背景透明度从 0.15 改为 0.05,使按钮在禁用状态下呈现
更浅、更平的视觉效果
2. 将 QStyle::State_Enabled 判断提取为具名常量 enabled,仅在启用状态下分
别应用 0.15、0.25、0.35 的透明度对应普通、按下和悬停状态
3. 将调色板颜色应用到 QPalette::All 所有颜色组(Button 与 ButtonText),
而不是仅应用到 Active 组,否则 Disabled 颜色组会被忽略,导致绘制颜色不
正确
4. 当按钮处于高亮状态时(即未勾选许可协议、按钮不可用),文字使用
QPalette::Disabled/WindowText 而非高亮色;勾选协议后按钮变为可用,文字才
切换到 Active/Highlight 高亮色,使两种状态清晰可区分

Log: 调整许可协议对话框按钮样式,使禁用态与可用态可明显区分

Influence:
1. 打开许可协议对话框,保持协议复选框未勾选,验证确认按钮使用禁用态文字
色以及更浅的 0.05 背景
2. 勾选协议复选框,验证按钮文字切换为活动高亮色、背景透明度变为 0.15
3. 验证可用按钮的悬停态与按下态分别使用 0.25 与 0.35 的透明度
4. 验证按钮在浅色、深色及高对比度主题下的渲染效果
5. 验证禁用按钮仍不可点击,可用按钮能触发预期操作
6. 验证在对话框之外的场景(例如使用同一按钮类的其他窗口)中按钮渲染同样
正确

PMS: BUG-360973
@sourcery-ai

sourcery-ai Bot commented Sep 17, 2026

Copy link
Copy Markdown
Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Updates the custom license dialog button’s style-option palette and state handling so disabled buttons render with a lighter background and disabled text, while enabled, hovered, and pressed states retain distinct visual feedback across palette groups and themes.

State diagram for license button visual states

stateDiagram-v2
    [*] --> Disabled
    Disabled: background opacity 0.05
    Disabled: text Disabled/WindowText
    Disabled --> Enabled: agreement checkbox checked
    Enabled: background opacity 0.15
    Enabled: text Active/Highlight
    Enabled --> Hovered: State_MouseOver
    Hovered: background opacity 0.25
    Hovered --> Enabled: pointer leaves
    Enabled --> Pressed: State_Sunken
    Pressed: background opacity 0.35
    Pressed --> Enabled: button released
Loading

File-Level Changes

Change Details Files
Differentiate disabled, enabled, hover, and pressed button backgrounds through state-aware opacity handling.
  • Default disabled opacity is reduced to 0.05.
  • Enabled buttons use 0.15 normally, 0.25 when pressed, and 0.35 on hover.
  • The enabled state is cached in a named boolean for consistent branching.
dde-license-dialog/src/content.cpp
Apply button palette overrides across all color groups and select highlighted text based on availability.
  • Button and ButtonText colors are set for QPalette::All so disabled rendering receives the intended colors.
  • Highlighted disabled buttons use Disabled/WindowText, while enabled highlighted buttons use Active/Highlight.
  • Hover state is removed before the base style draws the customized button.
dde-license-dialog/src/content.cpp

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@deepin-ci-robot

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: xujin177

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@deepin-ci-robot

Copy link
Copy Markdown

Hi @xujin177. Thanks for your PR.

I'm waiting for a linuxdeepin member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've reviewed your changes and they look great!


Sourcery is free for open source - if you like our reviews please consider sharing them ✨

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants