Repository navigation
Conversation
1. Root cause: TermCommandLinkButton constructor unconditionally set ButtonText to TextWarning (red), causing delete buttons to appear as error/warning indicators rather than normal action buttons 2. Fix: remove TextWarning color assignment from constructor and redundant reassignment in handleThemeTypeChanged() 3. Impact: delete buttons in custom command and remote server dialogs now use theme default ButtonText color, no functional change Log: fix delete button text color from red to theme default Influence: 1. Test delete button color in custom command edit dialog 2. Test delete button color in remote server config dialog 3. Test theme switching does not restore red color fix: 移除删除按钮误导性的警告色 1. 根因:TermCommandLinkButton 构造函数无条件将 ButtonText 设为 TextWarning(红色),导致删除按钮被误读为错误/警示 2. 方案:移除构造函数中的 TextWarning 颜色赋值,以及 handleThemeTypeChanged 中冗余的重复赋值 3. 影响:自定义命令和远程服务器对话框中的删除按钮恢复主题 默认文字颜色,不改变功能逻辑 Log: 修复删除按钮文字颜色为红色的问题 Influence: 1. 测试自定义命令编辑窗口中删除按钮文字颜色 2. 测试远程服务器配置对话框中删除按钮文字颜色 3. 测试主题切换后删除按钮颜色不恢复为红色 PMS: BUG-378945
pengfeixx
marked this pull request as draft
November 6, 2026 21:44
Reviewer's GuideUIRemove the warning-color palette overrides so delete buttons use the theme’s default text color, including after theme changes.
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: pengfeixx The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Root Cause Analysis
TermCommandLinkButtonconstructor unconditionally setButtonTexttoTextWarning(red), causing all delete buttons using this widget to display red text. This made delete buttons look like error/warning indicators rather than normal action buttons. The redundantTextWarningreassignment inServerConfigOptDlg::handleThemeTypeChanged()perpetuated the red color across theme switches.Evidence:
src/views/termcommandlinkbutton.cpp:25setspalette.setColor(DPalette::ButtonText, palette.color(DPalette::TextWarning)); standalone demo confirmedTextWarningresolves to rgb(255,87,54) andButtonTextturns red after assignment, while removing it keepsButtonTextat rgb(0,0,0).Fix
Removed the
TextWarningcolor assignment fromTermCommandLinkButtonconstructor (including the#include <DPaletteHelper>that became unused) and the redundantTextWarningreassignment inhandleThemeTypeChanged(). Buttons now use the theme defaultButtonTextcolor. No functional logic changed.Change Safety Assessment
Code Safety
TextWarningassignment existed since file creation (commit6b3bef59, 2020-05-22, structural refactor) and was carried through cppcheck cleanup (commitdb11fe027, 2021-02-22). This change does not revert any historical fix.customcommandoptdlg.cpp:172,serverconfigoptdlg.cpp:58) only use theclickedsignal and do not depend on text color.Business Impact Scope
Verification Suggestion
Verify delete button text color in custom command edit dialog and remote server config dialog under both light and dark themes. Confirm theme switching does not restore red color.
根因分析
TermCommandLinkButton构造函数无条件将ButtonText设为TextWarning(红色),导致所有使用该控件的删除按钮文字呈红色,易被误读为错误/警示。ServerConfigOptDlg::handleThemeTypeChanged()中冗余的TextWarning重复赋值在主题切换时维持了红色。证据:
src/views/termcommandlinkbutton.cpp:25执行palette.setColor(DPalette::ButtonText, palette.color(DPalette::TextWarning));独立 demo 确认TextWarning解析为 rgb(255,87,54),赋值后ButtonText变红;移除后ButtonText保持 rgb(0,0,0)。修复方案
移除
TermCommandLinkButton构造函数中的TextWarning颜色赋值(含不再使用的#include <DPaletteHelper>),以及handleThemeTypeChanged()中冗余的TextWarning重复赋值。按钮恢复主题默认ButtonText颜色,不改变功能逻辑。改动安全评估
代码安全评估
TextWarning赋值自文件创建时即存在(commit6b3bef59,2020-05-22,结构调整),cppcheck 清理时保留(commitdb11fe027,2021-02-22)。本次改动不撤销任何已有修复。customcommandoptdlg.cpp:172、serverconfigoptdlg.cpp:58)仅使用clicked信号,不依赖文字颜色。业务影响范围
验证建议
在浅色和深色主题下验证自定义命令编辑窗口和远程服务器配置对话框中删除按钮的文字颜色,确认主题切换后颜色不恢复为红色。
PMS: BUG-378945
Summary by Sourcery
Use the theme’s default button text color for delete buttons instead of presenting them as warning indicators.
Bug Fixes: