Skip to content

[GUI] Match the Windows checked checkbox blue to MATLAB - #848

Open
arnodelorme wants to merge 6 commits into
developfrom
agent/issue-811
Open

arnodelorme wants to merge 6 commits into
developfrom
agent/issue-811

Conversation

@arnodelorme

@arnodelorme arnodelorme commented Nov 29, 2026 •

Copy link
Copy Markdown
Collaborator

A checked box in a Windows dialog is now drawn as MATLAB draws it: a white check mark on the dark blue #005fb8. The earlier version of this branch had the right blue but kept the navy mark of the label (2.8 to 1 contrast). The mark is now white (6.3 to 1, as in MATLAB). The native Windows 11 style still draws the box, the mark, the border and the focus state.

Checked box on Windows 11: EEGLAB, EEGPrep before, EEGPrep at the earlier head of this branch

Left to right, from Windows 11 captures at the same zoom: EEGLAB in MATLAB, EEGPrep before this pull request, and EEGPrep at the earlier head of this branch (navy mark). The capture of the new head with the white mark on Windows is not in this picture yet: it has to be taken on the Windows 11 guest. Until then the evidence for the white mark is the Windows test below and the Qt source.

Editable Word report · PDF report (both still show the earlier head)

Cause and change

Qt's Windows 11 style fills a checked box with the Accent colour of the palette and, from Qt 6.11, draws the mark with ButtonText when that role is set (QWindows11Style::controlTextColor), and in white otherwise. The dialog style sheet gives QCheckBox the navy text colour, which also sets ButtonText, so the mark came out navy. The shared checkbox builder now uses, on Windows only, a QCheckBox whose style option carries the two colours of the box: Accent #005fb8 and ButtonText white. The label does not read that option, so it stays navy. Unchecked and greyed boxes, macOS and Linux do not change. The two colours are constants in guifunc/theme.py.

Verification

The CI jobs of the new head were still queued when this was written, so the Windows result of the new test is not known yet. The Windows test builds a dialog with the Windows 11 style, grabs the checked box and checks its pixels: the exact fill #005fb8 is present, no pixel inside the box is darker than the fill (a navy mark would be), and the mark is at least half way to white. On the Mac, tests/test_guifunc_primitives.py gives 10 passed and 1 skipped (the Windows test). Ruff passed. No numerical code changes, so no EEGLAB parity run is needed.

Fixes #811
Part of #745

@claude claude Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Code review skipped — your organization has no extra usage available to pay for this review.

If your organization's extra usage balance is empty, an organization admin can add extra usage credits at claude.ai/admin-settings/usage. If its monthly spend limit was reached, an admin can raise it on the same page. If neither applies, contact Anthropic support.

Once extra usage is available, someone with write access to this repository can comment @claude review on this pull request to trigger a review.

@claude

claude Bot commented Nov 29, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @arnodelorme's task in 40s —— View job


Code review

  • Overall assessment: Looks good. The change is small. Only checkboxes built by the shared builder get the new color, and only on Windows. Qt added QPalette.ColorRole.Accent in 6.6, and pyproject.toml already requires PySide6>=6.6, so the role is always there. The palette is set explicitly on each checkbox, so the dialog's own palette won't override it. On macOS and Linux nothing changes. QtGui falls back to None like the other optional Qt imports. I found no other QCheckBox( builder outside the vendored EEGLAB code that would miss the change.
  • Highest-risk area: The new test only runs on Windows, so CI on Linux never runs it. That's acceptable for a style that only exists on Windows, and the PR body describes a manual check on a real Windows 11 machine.
  • Merge recommendation: Safe to merge.

Blocking

None.

Important

None.

Nits

  • src/eegprep/functions/guifunc/qt.py:330: #005fb8 is written inline. The other EEGLAB colors are constants in guifunc/theme.py, for example EEGLAB_PROGRESS_CHUNK. Move it to a constant such as EEGLAB_WINDOWS_CHECKED_BLUE and use that constant in the test too (inline comment posted).
  • docs/source/user_guide/gui_console_session.rst:311: the new sentence sits at the end of the event-import paragraph, just before "Stream 9 audit dispositions", where it reads out of place. The wording is also slightly off: EEGLAB doesn't choose this color; MATLAB's Windows rendering does. Something like "On Windows, checked boxes in dialogs use the same dark blue (#005fb8) as MATLAB.", placed near other dialog appearance notes, would be clearer.

Test gaps

None. The test uses the real dialog builder and checks the color a user would see, and being Windows-only matches the code path.

EEGLAB parity notes

None. The change only affects how the checked box looks, which now matches MATLAB's Windows 11 checkbox (#005fb8 measured in both).

Checked for correctness bugs, EEGLAB parity, data structure compatibility, tests for the changed behavior, and CLAUDE.md/AGENTS.md compliance.

Comment thread src/eegprep/functions/guifunc/qt.py Outdated
widget = QtWidgets.QCheckBox(control.string)
if sys.platform == "win32":
palette = widget.palette()
palette.setColor(QtGui.QPalette.ColorRole.Accent, QtGui.QColor("#005fb8"))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Nit: #005fb8 is the only color in qt.py that's written inline. Every other EEGLAB color is a named constant in theme.py, like EEGLAB_PROGRESS_CHUNK = "#0078d7". AGENTS.md asks for semantically important magic values to live in top-level constants.

Suggested fix: add EEGLAB_WINDOWS_CHECKED_BLUE = "#005fb8" to src/eegprep/functions/guifunc/theme.py, import it here, and use it in the new test as well. Doing that touches several places, so I didn't attach a suggestion block.

@arnodelorme

Copy link
Copy Markdown
Collaborator Author

Review (Claude Fable): needs more work

  • The fill now matches MATLAB (#005fb8), but the check mark does not. MATLAB draws a white mark. EEGPrep keeps its navy mark, which is now hard to see on the dark blue.
  • The code change is small and sits in the shared checkbox builder, so every dialog gets it. That part is right.
  • The pull request shows EEGPrep alone. One image with MATLAB next to it would have shown the problem.
  • CI: the only failure (Windows) is the known row height test of test_window_without_a_height_is_as_high_as_its_rows fails on Windows (57 vs 56) #834, which also fails on develop.

Checked box on Windows 11: EEGLAB, EEGPrep before, EEGPrep after

Same zoom for the three boxes. EEGLAB and "before" are cut from the Windows 11 captures of pop_export in the report of November 28 (file-edit-native-2026-11-28). "After" is the capture of this pull request.

Details

1. Check mark colour (blocking). Measured on the captures above:

Fill Check mark Contrast of the mark on the fill
EEGLAB (MATLAB) #005fb8 white 6.3 to 1
EEGPrep before #4cc2ff navy 8.8 to 1
EEGPrep after #005fb8 navy 2.8 to 1

The contrast is the WCAG ratio, computed with white and with EEGLAB_TEXT (#66) as the mark colours. The darkest mark pixel of the "after" capture is #000e82, which gives 2.4 to 1. WCAG 2.1 asks for at least 3 to 1 for a graphic such as a check mark (criterion 1.4.11). So the change fixes the fill and makes the mark less readable than before. Arno asked for a box "like on MATLAB", and MATLAB's mark is white.

The mark has the navy of the label, so it very likely follows the text colour that the shared style sheet gives to QCheckBox (qt.py, _apply_eeglab_style). What is needed, on Windows only:

  • Find on the Windows guest which palette role the windows11 style uses for the mark, and set it to white on the same palette, next to Accent, if the label stays navy.
  • If the mark and the label share one role, the palette cannot separate them. The other route is then a Windows only QCheckBox::indicator:checked rule with a packaged white mark.

I could not run the windows11 style here (it exists only on Windows), so the choice between the two has to be made on the guest.

2. Capture (important). Rule 27 asks for EEGLAB, EEGPrep before and EEGPrep after side by side. Arno asked for one capture only, so one image holding the three boxes, as above, meets both. Please replace the image of the body with the new one after the fix, and put the same image in the Word and PDF report, which also shows EEGPrep alone.

3. To check on the guest: a greyed checked box. palette.setColor(role, colour) sets the colour for the active, inactive and disabled groups. If the windows11 style reads the palette for a disabled box, a greyed checked box is now as blue as an active one. One look at a disabled checked box settles it. If it is too blue, set the colour for the active and inactive groups only.

4. Nits.

  • #005fb8 is written in qt.py and again in the test. The other colours are constants in guifunc/theme.py. One constant there, used in both places, is enough (the inline comment of the first review says the same).
  • The new sentence in gui_console_session.rst sits at the end of the section on importing events, where no reader will look for it. It also says "used by EEGLAB", but the colour is MATLAB's, and "a checked dialog box" should read "a checked box in a dialog". A line in docs/source/changelog.rst would fit better.

What I checked.

— orchestrator review

@arnodelorme

Copy link
Copy Markdown
Collaborator Author

Code review

Independent review by Codex (OpenAI, model gpt-6.1-terra), run read-only on commit 3cc905b8. The change itself was written by Claude Fable, so this is a second opinion from another vendor. Its text is below, unchanged except for local file paths.

What was done with its findings (commit cd60430e):

  • Blocking, fixed. Qt 6.10 takes the colour of the mark from the Window role, and Qt 6.7 to 6.9 from HighlightedText (checked in the Qt sources of each version). The box now sets the three roles, so the mark is white from Qt 6.7 on. Qt 6.6 has no Windows 11 style, so nothing changes there.
  • Important, fixed. The white mark is now set only for an enabled, checked box. A greyed box keeps the colours of the Windows style.
  • Important, fixed. The changelog line now says "with Qt 6.7 or later".
  • Test gaps, partly fixed. The test now uses the blue measured on MATLAB as a literal, waits for the animation of the mark, and asks for a contrast of at least 3 to 1 between the mark and the fill. Left as they are: tests of the greyed box, of the unchecked box and of several Qt versions or screen scales, because CI installs one Qt version (6.11.0) and the pixels of a greyed box are not measured on MATLAB yet.
  • Not verified by anyone yet: the picture of the new head on a real Windows 11 screen. It has to be captured on the Windows guest and put in the description next to MATLAB.

— orchestrator


Overall assessment

Changes are needed before merging. The approach is plausible for the normal checked state under Qt 6.11, but it changes the disabled mark and does not produce a white mark under at least one older permitted Qt version.

The review is based on checkout 3cc905b82b06d8ee9cd0f9799a5a0bd32876e61f. The applicable repository instructions are AGENTS.md and CLAUDE.md, which imports AGENTS.md. I found no additional scoped instruction files.

Blocking

Qt 6.10 does not use the overridden mark color. At qt.py:100, the code sets ButtonText to white. Qt 6.10’s Windows 11 checkbox instead paints its mark using QPalette::Window, while its fill can use Accent. The result is therefore not guaranteed to be white on blue for the permitted PySide6>=6.6 range. Support the older rendering path or change the supported version requirement with an appropriate migration decision. Qt 6.10 source, credibility 10/10.

Important

The disabled checked mark changes. qt.py:102 sets ButtonText for all palette groups, including disabled. In Qt 6.11, the checkbox uses that explicitly set role for its mark even when disabled, replacing its previous disabled color with white. Apply the override only for the intended enabled checked state and verify the disabled result. Qt 6.11 source, credibility 10/10.

The changelog overstates the result. changelog.rst:24 claims the appearance for Windows 11 without the Qt version qualification. Correct the implementation across supported versions, or qualify the statement to match verified behavior.

Nits

None.

Test gaps

The new test detects the reported dark navy mark if that mark falls within the sampled area, because it lowers the green channel below the asserted threshold. However, test_guifunc_primitives.py:204 does not establish that the mark is white. For example, a sufficiently light nonwhite mark can satisfy both channel checks. It also derives the expected fill from the production constant, so changing that constant to the wrong blue would not by itself fail the test. Assert the independent target color and test mark pixels against a suitable white or contrast criterion.

The test captures immediately after showing the dialog at test_guifunc_primitives.py:188. Qt has checkbox transition animation, and scaling or antialiasing can affect the exact sampled pixels. A settled rendering and checks across relevant scale factors would reduce false failures. Add explicit checks for enabled and disabled labels, unchecked boxes, and disabled checked boxes. Run the checked appearance test against both Qt 6.11 and an older supported version.

What I could not verify

I could not run a Windows 11 rendering test or compare screenshots with MATLAB. Qt 6.11 source indicates that the checked indicator delegates from the style sheet to the native style when its indicator rule has no drawable, then uses Accent for the enabled fill and the explicitly set ButtonText for the mark. That supports the intended result under those conditions, but does not prove the PySide virtual override and full rendering path in this environment. Qt style sheet source, credibility 10/10.

The label normally uses WindowText, and the unchecked indicator has its own existing style sheet rule. Those paths suggest they remain unchanged in ordinary conditions, but I cannot confirm every Windows style or high contrast setting. The platform branch leaves macOS and Linux checkbox construction unchanged at qt.py:348, though I did not run visual comparisons there.

The lazy class creation and cache look coherent, and the optional import remains guarded at qt.py:67. I did not execute the import without PySide6 or verify every supported binding version. GitHub API access failed, so I could not confirm that the live PR head still matches the checkout or inspect its current review history. No files were modified.

# Conflicts:
#	src/eegprep/functions/guifunc/qt.py
#	src/eegprep/functions/guifunc/theme.py

@arnodelorme arnodelorme left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

This review was written by an AI assistant during a nightly check, not by Arno.

Code review

  • Overall assessment: The code change is ready, pending the updated Windows 11 comparison capture noted in the description.
  • Highest-risk area: Palette role overrides on QStyleOptionButton in WindowsCheckBox.initStyleOption (src/eegprep/functions/guifunc/qt.py) across Qt 6.7 through 6.11.
  • Merge recommendation: Safe to merge once the Windows 11 capture of the current head (7adb1ad3e2b7ecd3323cfeceacc43d939f518be5) is attached.

Blocking

None.

Important

  • Missing Windows 11 comparison capture for the current head (pull request description and AGENTS.md GUI comparison requirement): The attached comparison image and linked reports still show the earlier head with the navy check mark (2.8 to 1 contrast) rather than 7adb1ad3e2b7ecd3323cfeceacc43d939f518be5. Capture the current head on Windows 11 and update the side by side image next to MATLAB before merging.

Nits

None.

Test gaps

  • Checked checkbox label color on Windows 11 (tests/test_guifunc_primitives.py, lines 306 to 333): _sample_checked_box builds ControlSpec("checkbox", tag="box", value=True) with an empty label string, so the Windows test verifies the indicator fill and mark contrast but never checks that the label text stays navy (#000066). Because QCheckBox::paintEvent passes the same QStyleOptionButton to CE_CheckBox for both the indicator and CE_CheckBoxLabel (Qt 6 qcheckbox.cpp, primary upstream source, credibility 10/10), giving the test control a non empty label and asserting that SE_CheckBoxContents still contains #000066 (and not #ffffff) would guard against any style path reading ButtonText for the label.

EEGLAB parity notes

  • EEGLAB's supergui.m (primary upstream source, credibility 10/10) delegates checkbox indicator drawing to MATLAB on Windows, which renders a white mark on #005fb8 (WCAG 2.1 contrast ratio 6.3 to 1, W3C Recommendation, credibility 10/10). Scoping WindowsCheckBox to sys.platform == "win32" in QtDialogRenderer._build_widget (src/eegprep/functions/guifunc/qt.py, line 448) leaves macOS and Linux unchanged while matching MATLAB on Windows 11 across Qt 6.7 through 6.11 (qwindows11style.cpp, primary upstream source, credibility 10/10).

Verification and tests run

  • Ran PYTHONPATH=<worktree>/src .venv/bin/python -m pytest <worktree>/tests/test_guifunc_primitives.py in a detached worktree at 7adb1ad3e2b7ecd3323cfeceacc43d939f518be5 on macOS: 17 passed, 1 skipped (the Windows native checkbox test), 1 deselected reference test.
  • Ran .venv/bin/ruff check and .venv/bin/ruff format --check on src/eegprep/functions/guifunc/qt.py, src/eegprep/functions/guifunc/theme.py, and tests/test_guifunc_primitives.py: all passed.
  • Checked the completed Test Python 3.12 on windows-latest CI job (142479927433, PySide6 6.11.0) on this pull request: tests/test_guifunc_primitives.py passed all 17 tests with 0 skipped, confirming test_windows_checked_box_is_the_matlab_blue_with_a_white_mark ran on the windows platform plugin with the windows11 style. (The 3 failures in that job are in tests/test_gui_pop_erpimage.py and tests/test_stream11_datasets.py, which come from develop.)

Checked for correctness bugs, optional PySide6 import guards, stylesheet and supergui layout interactions, EEGLAB parity, changed behavior tests, and CLAUDE.md and AGENTS.md compliance.

@arnodelorme

Copy link
Copy Markdown
Collaborator Author

🤖 Second round (commit 7adb1ad3): the branch includes develop, and the Windows test now measures the real mark.

  • Why the test failed on the Windows runner before. The Windows 11 style draws the check mark as a glyph of an icon font. The tests run Qt with the offscreen platform, which has no system fonts, so no mark was drawn at all: the brightest pixel in the box was the blue fill itself.
  • What changed. The test now draws the box in a child process with the native windows platform, and reports the Qt version, the platform, the style, the icon fonts found and the colours it sampled in every assertion message. The code under test is unchanged.
  • Result on windows-latest. The test ran and passed on this head: the fill #005fb8 is present, no pixel is darker than the fill, and the mark has a contrast of at least 3 to 1 against it. Windows job: https://github.com/sccn/eegprep/actions/runs/46596608736/job/142479927433
  • The three failures of that job are not from this pull request. They are on develop: the ERP image column gap (repaired by [GUI] Run the ERP image MATLAB pixel gap check on Linux only #1058) and the two pop_mergeset dialog tests that fail since [GUI] Match the Append datasets dialog to EEGLAB #904.
  • Still missing, as the new review says: the capture of this head on a real Windows 11 screen next to MATLAB, and a check that the label stays navy when the box has a label. This pull request is not merged.

This branch has not been deployed

No deployments
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.

Checked checkboxes on Windows: use a darker blue, as in MATLAB

1 participant