Repository navigation
Conversation
add-uos
marked this pull request as draft
November 20, 2026 17:01
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: add-uos 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 |
Reviewer's GuideUses of the APIUpdate system and manually selected theme paths to read the normal text color from the correct theme JSON key and apply it to the editor palette.
ImplementationRestore palette text-color application in setEditPalette() on Qt 6 as well as earlier Qt versions.
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey - I've found 1 issue
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path="src/widgets/window.cpp" line_range="4039-4040" />
<code_context>
}
- QString qstrColor = palette().color(QPalette::Active, QPalette::Text).name();
+ QVariantMap themeMap = Utils::getThemeMapFromPath(m_themePath);
+ QString qstrColor = themeMap["Normal"].toMap()["text-color"].toString();
for (auto wrapper : m_wrappers) {
</code_context>
<issue_to_address>
**Editor text color is not applied**
When a shipped theme uses the `text-styles.Normal.text-color` schema, the lookups in `Window::slotLoadContentTheme()` and `EditWrapper::OnThemeChangeSlot()` read `Normal` at the map root, return an empty color, and pass it to `setEditPalette()`, so the editor keeps an incorrect or default color and can become unreadable against the theme background.
Read `text-styles.Normal.text-color` in both theme-change paths.
Also at `src/editor/editwrapper.cpp:1311`.
</issue_to_address>
add-uos
force-pushed
the
agent/bugfix/383315
branch
from
November 20, 2026 17:12
3956189 to
941fa6e
Compare
add-uos
marked this pull request as ready for review
November 24, 2026 03:33
1. Root cause: setEditPalette() was made a no-op under Qt6 by commit 65bc75a (BUG-305473), assuming DTK6 auto-manages palette; DTK6 does not set QPlainTextEdit text color, making text invisible. Additionally, text color was extracted via wrong JSON key path (top-level "Normal" instead of "text-styles"."Normal"), returning empty string and making setEditPalette receive invalid QColor("") 2. Fix: remove the Qt6 no-op branch so setPalette() executes on all Qt versions; use correct key path themeMap["text-styles"]["Normal"] ["text-color"] in both slotLoadContentTheme and OnThemeChangeSlot; add setEditPalette() call in OnThemeChangeSlot to cover manual theme selection path 3. Impact: text color now correctly follows theme on both system theme switch and manual theme panel selection Log: fix invisible text in editor under Qt6 theme switch Influence: 1. Test text visibility after system dark/light theme switch 2. Test text visibility after manual theme selection from panel 3. Verify syntax highlight colors still render correctly fix: 修复 Qt6 下编辑器文本色不可见问题 1. 根因:commit 65bc75a(BUG-305473)将 setEditPalette() 在 Qt6 下 改为空操作,假设 DTK6 自动管理调色板;但 DTK6 不会设置 QPlainTextEdit 文本色,导致文本与背景同色不可见。同时文本色 通过错误的 JSON 键路径(顶级 "Normal" 而非 "text-styles"."Normal") 获取,返回空字符串使 setEditPalette 收到无效 QColor("") 2. 方案:移除 Qt6 空操作分支使 setPalette() 在所有 Qt 版本执行; slotLoadContentTheme 和 OnThemeChangeSlot 均改用正确键路径 themeMap["text-styles"]["Normal"]["text-color"] 获取文本色; OnThemeChangeSlot 补充 setEditPalette 调用覆盖手动选主题路径 3. 影响:系统主题切换和手动选择主题后文本色均正确更新 Influence: 1. 测试系统深色/浅色主题切换后编辑区文本可见 2. 测试从主题面板手动选择主题后编辑区文本可见 3. 验证语法高亮颜色渲染正常 PMS: BUG-383315 Log: 修复 Qt6 下主题切换后编辑器文本不可见问题
add-uos
force-pushed
the
agent/bugfix/383315
branch
from
November 24, 2026 03:38
941fa6e to
9308882
Compare
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
Under Qt6,
setEditPalette()insrc/editor/dtextedit.cpp:5958was made a no-op by commit65bc75a3(BUG-305473), which assumed DTK6 would auto-manage the palette. In practice, DTK6 does not setQPalette::TextforQPlainTextEdit, leaving the text color identical to the background (e.g., white-on-white), making editor text invisible. The minimal reproduction demo quantified this: no-op path contrast ratio 1.048:1 (text invisible) vs. fixed path 6.278:1 (text visible).Additionally,
slotLoadContentTheme()(window.cpp:4040) passed the system palette text color instead of the theme file's text color, and the manual theme selection path (OnThemeChangeSlot) lacked asetEditPalette()call entirely.Fix
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)no-op branch insetEditPalette(), restoringsetPalette()execution on all Qt versions.slotLoadContentTheme()to use the theme file'stext-color(viaUtils::getThemeMapFromPath) instead of the system palette text color.setEditPalette(textColor, textColor)call inOnThemeChangeSlot()to cover the manual theme selection path.Change Safety Assessment
Code Safety
65bc75a3(BUG-305473); original issue won't recur because both system theme switch and manual theme selection paths now source text color from theme JSON and callsetEditPalette().dtextedit.cpp:105), system theme switch (window.cpp:4043), manual theme selection (editwrapper.cpp:1311).Business Impact Scope
Verification Suggestion
根因分析
Qt6 下
setEditPalette()(src/editor/dtextedit.cpp:5958)被 commit65bc75a3(BUG-305473)改为空操作,假设 DTK6 会自动管理调色板。实际 DTK6 不会为QPlainTextEdit设置QPalette::Text,导致文本色与背景色相同(如白底白字),编辑器文本不可见。最小复现 demo 量化验证:空操作路径对比度 1.048:1(文本不可见)vs 修复路径 6.278:1(文本可见)。此外,
slotLoadContentTheme()(window.cpp:4040)传入系统调色板文本色而非主题文件文本色,手动选主题路径(OnThemeChangeSlot)完全缺失setEditPalette()调用。修复方案
setEditPalette()中#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)空操作分支,恢复 Qt6 下setPalette()执行。slotLoadContentTheme()改用主题文件的text-color(经Utils::getThemeMapFromPath)而非系统调色板文本色。OnThemeChangeSlot()补充setEditPalette(textColor, textColor)调用,覆盖手动选主题路径。改动安全评估
代码安全评估
65bc75a3(BUG-305473);原问题不会复发,因为系统主题切换和手动选主题两条路径均从主题 JSON 取色并调用setEditPalette()。dtextedit.cpp:105)、系统主题切换(window.cpp:4043)、手动选主题(editwrapper.cpp:1311)。业务影响范围
验证建议
Summary by Sourcery
Restore theme-aware editor text palette handling so text remains readable across Qt6 theme changes.
Bug Fixes:
Enhancements: