Skip to content

StringSelect: keep the theme's text color for entries without a color - #585

Draft
dayfine wants to merge 4 commits into
mainfrom
fix/string-select-text-color
Draft

dayfine wants to merge 4 commits into
mainfrom
fix/string-select-text-color

Conversation

@dayfine

@dayfine dayfine commented Nov 15, 2026 •

Copy link
Copy Markdown
Owner

The Probelm

A StringSelect dropdown drew its selected value in the entry's text_color, and an entry with no color has Color() == 0, which Qt draws as black, so in dark mode the selected value was unreadable

The Fix

The line edit now keeps the theme's palette unless the entry sets a color, the same rule the popup list already uses (if (item.text_color)). The three copies of the palette code become one helper.

Testing

Before

截圖 2026-11-15 下午4 14 49

After

截圖 2026-11-15 下午4 10 54

The selected entry's text was always drawn in the entry's text_color, and an
entry with no color has Color() == 0, which Qt draws as black. In dark mode
the selected value was unreadable. Now the line edit keeps the default palette
unless the entry sets a color, matching how the popup list already treats
items without a color.

// Shows the selected entry's text in its own color. An entry with no color
// keeps the theme's text color: Color() is 0, which Qt draws as black.
static void set_selected_text_color(QLineEdit& line_edit, Color color){

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

please fix codehealth finding

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Fixed in 3e86c5f: the color (input) now comes before the QLineEdit& (output). The other two advisories are the existing function lengths, unchanged by this PR.


// Shows the selected entry's text in its own color. An entry with no color
// keeps the theme's text color: Color() is 0, which Qt draws as black.
static void set_selected_text_color(QLineEdit& line_edit, Color color){

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

static unncessary?

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

It's what keeps the helper private to this file (internal linkage). Without it, clang's -Wmissing-prototypes flags it as an error, and a same-named free function in another .cpp in PokemonAutomation would collide at link time. So I kept it.

@dayfine

dayfine commented Nov 16, 2026

Copy link
Copy Markdown
Owner Author

Upstream: PokemonAutomation#1916 (one commit f8ed1ce on upstream/string-select-text-color, based on upstream main).

dayfine and others added 2 commits November 18, 2026 07:00
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AKYzhrMnPK61XHWEch4a6E
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AKYzhrMnPK61XHWEch4a6E
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.

1 participant