Skip to content

fix(dde-license-dialog): correct disabled-state button color in disclaimer dialog (bug 360973) - #446

Open
xujin177 wants to merge 1 commit into
linuxdeepin:masterfrom
xujin177:fix/license-dialog-btn-color-360973
Open

fix(dde-license-dialog): correct disabled-state button color in disclaimer dialog (bug 360973)#446
xujin177 wants to merge 1 commit into
linuxdeepin:masterfrom
xujin177:fix/license-dialog-btn-color-360973

Conversation

@xujin177

@xujin177 xujin177 commented Aug 10, 2026

Copy link
Copy Markdown

Bug 360973

控制中心开启开发者模式免责声明框"确定"按钮活动色状态有误

Root Cause

Content::updateAcceptBtnPalette() in dde-license-dialog/src/content.cpp 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.

Testing

  • Verified compilation with g++ -std=c++17 -fsyntax-only.
  • Both light and dark themes handled via QPalette::Disabled, QPalette::WindowText which adapts to the DTK theme.

Related: DDE-65 / bug 360973

Summary by Sourcery

Correct the visual disabled state of the disclaimer dialog’s confirm button to avoid it appearing active before agreement.

Bug Fixes:

  • Separate cancel and confirm button styles and add a disabled-state style for the confirm button with a distinct background.
  • Use the standard DTK disabled text color for the confirm button instead of the highlight color when the button is disabled.

…aimer dialog

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.
@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. 😃

@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 commented Aug 10, 2026

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

Reviewer's Guide

Adjusts the accept/confirm button’s palette and styles so its disabled state uses DTK’s standard disabled text color and a distinct disabled background, while keeping the normal/active state highlight color for clarity between enabled and disabled states.

Flow diagram for updated accept button palette handling

flowchart TD
    A["Content::updateAcceptBtnPalette"] --> B["Set cancelBtnStyle on m_cancelBtn"]
    A --> C["Set acceptBtnStyle on m_acceptBtn"]
    C --> D["Get DPalette pa from m_acceptBtn"]
    D --> E["Set QPalette::Normal ButtonText to pa.highlight().color()"]
    E --> F["Set QPalette::Disabled ButtonText to pa.color(QPalette::Disabled, QPalette::WindowText)"]
    F --> G["Apply palette pa to m_acceptBtn"]
Loading

File-Level Changes

Change Details Files
Make the accept button’s disabled state visually distinct while preserving the active highlight styling when enabled.
  • Split shared button style into separate cancel and accept styles so the accept button can define a disabled-specific background.
  • Add a QPushButton:disabled rule to the accept button stylesheet with a lighter background color to differentiate the disabled state.
  • Remove custom highlight-based color for disabled ButtonText and instead use the palette’s standard disabled WindowText color.
  • Keep Normal ButtonText mapped to the highlight color so the enabled state remains visually prominent.
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

@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 left some high level feedback:

  • Consider factoring the duplicated QPushButton base style (background/border/radius/hover/pressed) into a shared helper or constant so that future visual changes don’t need to be updated in multiple QStrings.
  • To avoid potential theme inconsistencies, you may want to drive the disabled background RGBA color through the palette/theme utilities rather than hard-coding rgba(0, 0, 0, 0.05).
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- Consider factoring the duplicated QPushButton base style (background/border/radius/hover/pressed) into a shared helper or constant so that future visual changes don’t need to be updated in multiple QStrings.
- To avoid potential theme inconsistencies, you may want to drive the disabled background RGBA color through the palette/theme utilities rather than hard-coding `rgba(0, 0, 0, 0.05)`.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

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