Skip to content

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

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

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

Conversation

@dayfine

@dayfine dayfine commented Nov 15, 2026

Copy link
Copy Markdown
Owner

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 (seen on AutoStory's checkpoint dropdowns). 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. Compile-checked only; to be confirmed on the lab build in dark mode.

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.
if (color){
palette.setColor(QPalette::Text, QColor((uint32_t)color));
}
line_edit.setPalette(palette);

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.

what really happens when we set line_edit with a default palette?

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.

A default-constructed QPalette has no roles set, so setPalette() with it drops the line edit's own override and the widget resolves every color from its parent, i.e. the app's theme (white text in dark mode). Setting only Text, as before, overrode that one role. It also matters when the selection changes: switching from a colored entry back to one without a color now goes back to the theme color instead of keeping the old one.


// 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.

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