Skip to content

Conversation

@18202781743
Copy link
Contributor

@18202781743 18202781743 commented Sep 19, 2025

Updated placeholder text color palette in FlowStyle.qml to improve
visibility and contrast. Changed normal mode from semi-transparent dark
gray to more opaque black, and dark mode from semi-transparent white to
more opaque white. This addresses the search box text color issue where
placeholder text was not clearly visible.

Added objectName property to TitleBar.qml to support special handling in
color selector logic. Modified DQuickControlColorSelector to check for
special object names when finding control parent, ensuring proper color
inheritance for components with specific object names.

Enhanced signal connection safety in DQuickControlColorSelector
by checking if signals exist before connecting to them, preventing
potential runtime errors when signals are not available on certain
control items.

Log: Improved search box placeholder text visibility

Influence:

  1. Test search box placeholder text visibility in both light and dark
    themes
  2. Verify color consistency across different UI components
  3. Test color inheritance for components with special object names
  4. Verify no runtime errors occur during palette updates
  5. Check hover and press state changes work correctly

fix: 调整搜索框占位符文字颜色

更新了 FlowStyle.qml 中的占位符文字颜色调色板以提高可见性和对比度。将普
通模式从半透明深灰色改为更不透明的黑色,暗黑模式从半透明白色改为更不透明
的白色。这解决了搜索框文字颜色问题,之前占位符文字不够清晰可见。

在 TitleBar.qml 中添加了 objectName 属性以支持颜色选择器逻辑中的特殊处
理。修改了 DQuickControlColorSelector 在查找控件父级时检查特殊对象名称,
确保具有特定对象名称的组件能够正确继承颜色。

增强了 DQuickControlColorSelector 中的信号连接安全性,在连接信号前检查信
号是否存在,防止在某些控件项上信号不可用时出现运行时错误。

Log: 改进了搜索框占位符文字的可见性

Influence:

  1. 测试浅色和深色主题下搜索框占位符文字的可见性
  2. 验证不同UI组件间的颜色一致性
  3. 测试具有特殊对象名称的组件的颜色继承
  4. 验证调色板更新时不会出现运行时错误
  5. 检查悬停和按下状态变化是否正常工作

PMS: BUG-271269

Summary by Sourcery

Improve placeholder text contrast and reinforce color selector logic by handling special object names and ensuring safe signal connections

Bug Fixes:

  • Update FlowStyle.qml to use more opaque placeholder text colors in both light and dark modes for better visibility

Enhancements:

  • Add objectName "ColorSelectorMaster" to TitleBar.qml and extend DQuickControlColorSelector to recognize special object names for proper color inheritance
  • Guard connections to paletteChanged and hoveredChanged signals in DQuickControlColorSelector by checking their existence to prevent runtime errors

Updated placeholder text color palette in FlowStyle.qml to improve
visibility and contrast. Changed normal mode from semi-transparent dark
gray to more opaque black, and dark mode from semi-transparent white to
more opaque white. This addresses the search box text color issue where
placeholder text was not clearly visible.

Added objectName property to TitleBar.qml to support special handling in
color selector logic. Modified DQuickControlColorSelector to check for
special object names when finding control parent, ensuring proper color
inheritance for components with specific object names.

Enhanced signal connection safety in DQuickControlColorSelector
by checking if signals exist before connecting to them, preventing
potential runtime errors when signals are not available on certain
control items.

Log: Improved search box placeholder text visibility

Influence:
1. Test search box placeholder text visibility in both light and dark
themes
2. Verify color consistency across different UI components
3. Test color inheritance for components with special object names
4. Verify no runtime errors occur during palette updates
5. Check hover and press state changes work correctly

fix: 调整搜索框占位符文字颜色

更新了 FlowStyle.qml 中的占位符文字颜色调色板以提高可见性和对比度。将普
通模式从半透明深灰色改为更不透明的黑色,暗黑模式从半透明白色改为更不透明
的白色。这解决了搜索框文字颜色问题,之前占位符文字不够清晰可见。

在 TitleBar.qml 中添加了 objectName 属性以支持颜色选择器逻辑中的特殊处
理。修改了 DQuickControlColorSelector 在查找控件父级时检查特殊对象名称,
确保具有特定对象名称的组件能够正确继承颜色。

增强了 DQuickControlColorSelector 中的信号连接安全性,在连接信号前检查信
号是否存在,防止在某些控件项上信号不可用时出现运行时错误。

Log: 改进了搜索框占位符文字的可见性

Influence:
1. 测试浅色和深色主题下搜索框占位符文字的可见性
2. 验证不同UI组件间的颜色一致性
3. 测试具有特殊对象名称的组件的颜色继承
4. 验证调色板更新时不会出现运行时错误
5. 检查悬停和按下状态变化是否正常工作

PMS: BUG-271269
deepin-ci-robot added a commit to linuxdeepin/dtk6declarative that referenced this pull request Sep 19, 2025
Synchronize source files from linuxdeepin/dtkdeclarative.

Source-pull-request: linuxdeepin/dtkdeclarative#529
Copy link

@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 there - I've reviewed your changes - here's some feedback:

  • Consider centralizing the list of special object names (e.g. “ColorSelectorMaster”) into a constant or enum to avoid hard-coded strings and make future updates easier.
  • Instead of manually checking signals with metaObject->indexOfSignal, evaluate using QMetaObject::connectSlotsByName or QOverload to simplify and catch missing signal issues at compile time.
  • Verify that the new placeholder text colors meet WCAG contrast ratios in both light and dark themes to ensure accessibility standards are maintained.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- Consider centralizing the list of special object names (e.g. “ColorSelectorMaster”) into a constant or enum to avoid hard-coded strings and make future updates easier.
- Instead of manually checking signals with metaObject->indexOfSignal, evaluate using QMetaObject::connectSlotsByName or QOverload to simplify and catch missing signal issues at compile time.
- Verify that the new placeholder text colors meet WCAG contrast ratios in both light and dark themes to ensure accessibility standards are maintained.

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.

@sourcery-ai
Copy link

sourcery-ai bot commented Sep 19, 2025

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Placeholder text colors updated for better contrast, TitleBar assigned an objectName for targeted color logic, and DQuickControlColorSelector refined to handle special object names and safely connect signals.

File-Level Changes

Change Details Files
Improved search box placeholder text contrast
  • Updated normal palette from semi-transparent dark gray to opaque black
  • Updated normalDark palette from semi-transparent white to opaque white
qt6/src/qml/FlowStyle.qml
Added objectName to TitleBar for color selector logic
  • Defined objectName property as "ColorSelectorMaster"
qt6/src/qml/TitleBar.qml
Extended control detection to support special object names
  • Included specialObjectNameItems check when finding control parent
src/private/dquickcontrolpalette.cpp
Enhanced signal connection safety in DQuickControlColorSelector
  • Guarded paletteChanged and hoveredChanged connections with metaObject existence checks
src/private/dquickcontrolpalette.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
Contributor

deepin pr auto review

我来对这段代码进行审查,并提出改进意见:

  1. FlowStyle.qml 中的颜色修改:
normal: Qt.rgba(0, 0, 0, 0.7)
normalDark: Qt.rgba(1, 1, 1, 0.7)
  • 修改建议:当前的颜色值从原来的半透明(0.4)和不透明(0.3)改为了完全不透明(0.7)。这可能会导致UI元素在某些背景下难以阅读。建议保持原有的透明度,或者根据具体使用场景调整到合适的透明度值。
  1. TitleBar.qml 中的添加:
objectName: "ColorSelectorMaster"
  • 修改建议:这个objectName的命名不够具体,建议改为更具描述性的名称,如"ColorSelectorTitleBar"或"TitleBarColorSelector",这样更容易在调试和自动化测试中识别。
  1. dquickcontrolpalette.cpp 中的主要修改:
if (needUpdateControl && (_d_isControlItem(parentItem) || specialObjectNameItems().contains(parentItem->objectName()))) {
  • 修改建议:这个修改增加了对特定objectName的检查,这是一个好的改进,提高了代码的灵活性。但建议添加注释说明specialObjectNameItems()的用途和预期行为。
if (m_control->metaObject()->indexOfSignal("paletteChanged()") != -1) {
    connect(m_control, SIGNAL(paletteChanged()), this, SLOT(updateControlTheme()));
}
  • 修改建议:这个修改通过检查信号是否存在再进行连接,提高了代码的健壮性。建议将这种信号检查封装成一个辅助函数,如connectIfSignalExists(),以提高代码复用性。
  1. 性能优化建议:
  • 在dquickcontrolpalette.cpp中,频繁的metaObject查询可能会影响性能。建议在初始化时缓存这些信号索引。
  • 考虑使用QMetaObject::Connection来管理信号连接,这样可以更好地控制连接的生命周期。
  1. 代码安全建议:
  • 在使用objectName进行匹配时,建议添加空值检查,防止可能的空指针异常。
  • 对于特殊objectName的处理,建议使用常量或配置文件来管理,而不是硬编码在代码中。
  1. 代码质量建议:
  • 添加适当的注释说明代码的意图和实现逻辑。
  • 考虑将特殊objectName的检查逻辑抽象到一个单独的类中,以提高代码的可维护性。
  • 对于信号连接部分,建议使用Qt5的新式信号槽语法,即connect(&sender, &Sender::signal, &receiver, &Receiver::slot),这种方式类型更安全。

总体而言,这些修改提高了代码的健壮性和灵活性,但在颜色选择、命名规范和代码组织方面还有改进空间。建议根据具体的使用场景和需求进一步优化这些改动。

@deepin-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: 18202781743, BLumia

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

1 similar comment
@deepin-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: 18202781743, BLumia

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

@18202781743 18202781743 merged commit 526fa2c into linuxdeepin:master Sep 22, 2025
18 of 21 checks passed
18202781743 pushed a commit to linuxdeepin/dtk6declarative that referenced this pull request Sep 22, 2025
Synchronize source files from linuxdeepin/dtkdeclarative.

Source-pull-request: linuxdeepin/dtkdeclarative#529
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