Repository navigation
Conversation
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); |
There was a problem hiding this comment.
what really happens when we set line_edit with a default palette?
There was a problem hiding this comment.
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){ |
There was a problem hiding this comment.
please fix codehealth finding
There was a problem hiding this comment.
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){ |
There was a problem hiding this comment.
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.
A StringSelect dropdown drew its selected value in the entry's
text_color, and an entry with no color hasColor() == 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.