Skip to content

feat: add theme-aware progress bar background color#505

Merged
18202781743 merged 1 commit into
linuxdeepin:masterfrom
18202781743:master
Jul 24, 2025
Merged

feat: add theme-aware progress bar background color#505
18202781743 merged 1 commit into
linuxdeepin:masterfrom
18202781743:master

Conversation

@18202781743
Copy link
Copy Markdown
Contributor

@18202781743 18202781743 commented Jul 23, 2025

  1. Added background color property to progressBar style in FlowStyle.qml
  2. Modified ProgressBarPanel.qml to use theme-aware background color
  3. Implemented separate colors for normal and dark themes (rgba values)
  4. Uses ColorSelector for dynamic theme switching support

The changes ensure progress bar background colors properly adapt to both
light and dark themes, improving visual consistency across different
theme settings. The implementation provides better theming support by
using the DTK color system.

feat: 添加主题感知的进度条背景色

  1. 在FlowStyle.qml中为progressBar样式添加背景色属性
  2. 修改ProgressBarPanel.qml以使用主题感知的背景色
  3. 为普通和暗色主题实现不同的颜色值(rgba)
  4. 使用ColorSelector支持动态主题切换

这些更改确保进度条背景色能正确适配亮色和暗色主题,提升不同主题设置下的视
觉一致性。该实现通过使用DTK颜色系统提供了更好的主题支持。

pms: BUG-320479

Summary by Sourcery

Add theme-aware background color support to progress bars by defining a background property in FlowStyle.qml, specifying distinct RGBA values for light and dark themes, and applying it in ProgressBarPanel.qml with ColorSelector for dynamic theme switching.

New Features:

  • Add theme-aware background property to progressBar style in FlowStyle.qml
  • Use DS.Style.progressBar.background in ProgressBarPanel.qml for progress bar backgrounds

Enhancements:

  • Define separate RGBA values for light (normal) and dark (normalDark) themes
  • Leverage ColorSelector for dynamic theme switching

@18202781743 18202781743 requested review from BLumia and mhduiy July 23, 2025 03:46
deepin-ci-robot added a commit to linuxdeepin/dtk6declarative that referenced this pull request Jul 23, 2025
Synchronize source files from linuxdeepin/dtkdeclarative.

Source-pull-request: linuxdeepin/dtkdeclarative#505
@deepin-ci-robot
Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: 18202781743

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

@sourcery-ai
Copy link
Copy Markdown

sourcery-ai Bot commented Jul 23, 2025

Reviewer's Guide

This PR enhances the progress bar’s background styling by defining theme-aware palettes in FlowStyle.qml and updating ProgressBarPanel.qml to use dynamic theme bindings via the DTK ColorSelector.

Class diagram for theme-aware progress bar background color

classDiagram
    class FlowStyle {
        +D.Palette progressBar.background : D.Palette
        +D.Palette embeddedProgressBar.background : D.Palette
    }
    class D.Palette {
        +normal : color
        +normalDark : color
    }
    class ProgressBarPanel {
        +backgroundColor : Palette (from DS.Style.progressBar.background)
    }
    class ColorSelector {
        +backgroundColor
    }
    FlowStyle --> D.Palette : uses
    ProgressBarPanel --> ColorSelector : uses
    ProgressBarPanel --> FlowStyle : references DS.Style.progressBar.background
    ColorSelector --> FlowStyle : gets backgroundColor
Loading

File-Level Changes

Change Details Files
Define theme-aware background palettes for the progress bar
  • Add D.Palette.background property with normal and normalDark entries
  • Set rgba values for light and dark themes
  • Adjust embeddedProgressBar backgroundDark value
qt6/src/qml/FlowStyle.qml
Swap hard-coded background for dynamic theme binding in ProgressBarPanel.qml
  • Introduce backgroundColor property referencing DS.Style.progressBar.background
  • Bind Rectangle.color to ColorSelector.backgroundColor for runtime theme switching
qt6/src/qml/private/ProgressBarPanel.qml

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

Copy link
Copy Markdown

@sourcery-ai sourcery-ai Bot left a comment

Choose a reason for hiding this comment

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

Hey @18202781743 - I've reviewed your changes - here's some feedback:

  • The two ‘background’ palette definitions in FlowStyle.qml look nearly identical—consider consolidating them into a single style entry to avoid duplication.
  • Rather than hard-coding Qt.rgba values, derive your light/dark variants from an existing DTK color role (e.g. D.Color.Background) with color adjustments for better theme consistency.
  • In ProgressBarPanel.qml you can simplify the Rectangle color binding by using DS.Style.progressBar.background directly in ColorSelector and removing the extra backgroundColor alias.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- The two ‘background’ palette definitions in FlowStyle.qml look nearly identical—consider consolidating them into a single style entry to avoid duplication.
- Rather than hard-coding Qt.rgba values, derive your light/dark variants from an existing DTK color role (e.g. D.Color.Background) with color adjustments for better theme consistency.
- In ProgressBarPanel.qml you can simplify the Rectangle color binding by using DS.Style.progressBar.background directly in ColorSelector and removing the extra backgroundColor alias.

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.

1. Added background color property to progressBar style in FlowStyle.qml
2. Modified ProgressBarPanel.qml to use theme-aware background color
3. Implemented separate colors for normal and dark themes (rgba values)
4. Uses ColorSelector for dynamic theme switching support

The changes ensure progress bar background colors properly adapt to both
light and dark themes, improving visual consistency across different
theme settings. The implementation provides better theming support by
using the DTK color system.

feat: 添加主题感知的进度条背景色

1. 在FlowStyle.qml中为progressBar样式添加背景色属性
2. 修改ProgressBarPanel.qml以使用主题感知的背景色
3. 为普通和暗色主题实现不同的颜色值(rgba)
4. 使用ColorSelector支持动态主题切换

这些更改确保进度条背景色能正确适配亮色和暗色主题,提升不同主题设置下的视
觉一致性。该实现通过使用DTK颜色系统提供了更好的主题支持。

pms: BUG-320479
deepin-ci-robot added a commit to linuxdeepin/dtk6declarative that referenced this pull request Jul 23, 2025
Synchronize source files from linuxdeepin/dtkdeclarative.

Source-pull-request: linuxdeepin/dtkdeclarative#505
@18202781743 18202781743 merged commit eaf6a79 into linuxdeepin:master Jul 24, 2025
15 of 16 checks passed
18202781743 pushed a commit to linuxdeepin/dtk6declarative that referenced this pull request Jul 24, 2025
Synchronize source files from linuxdeepin/dtkdeclarative.

Source-pull-request: linuxdeepin/dtkdeclarative#505
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants