Skip to content

[GUI] Measure the dialog row height as the layout sizes an edit box - #835

Merged
arnodelorme merged 2 commits into
developfrom
agent/20261128-fix-834
Nov 29, 2026
Merged

arnodelorme merged 2 commits into
developfrom
agent/20261128-fix-834

Conversation

@claude

@claude claude Bot commented Nov 28, 2026

Copy link
Copy Markdown
Contributor

Qt layouts give a widget at least its minimum size hint, and with Segoe UI on Windows an edit box's minimum size hint is one pixel taller than its size hint, so the edit row of a dialog with no fixed height came out one pixel taller than the other rows. The row height now takes the larger of the two hints.

Fixes #834

🤖 Generated with Claude Code

Qt layouts give a widget at least its minimum size hint; with Segoe UI on
Windows a QLineEdit's minimum size hint exceeds its size hint by one pixel,
so the edit-box row was one pixel taller than the computed row height.

Fixes #834

Co-Authored-By: Claude Opus 5.5 <[email protected]>

@claude claude Bot left a comment

Copy link
Copy Markdown
Contributor Author

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 28, 2026 •

Copy link
Copy Markdown
Contributor Author

Claude finished @claude[bot]'s task in 38s —— View job


Code review

  • Gate checks: the PR is open and not a draft, the checked-out commit matches the PR head (c4f6e8b), and there is no earlier review

  • Read the diff and the code and test around it

  • Checked against AGENTS.md, repo conventions, correctness, and EEGLAB parity

  • Overall assessment: Looks good. _row_height now uses sizeHint().expandedTo(minimumSizeHint()), which is the height a Qt layout actually gives the probe widget. So on a platform where QLineEdit's minimum hint is taller than its size hint (because of font leading, as with Segoe UI), the edit row no longer comes out one pixel taller than the computed row. On Linux and macOS, where the minimum hint is not taller, the result does not change. The fix covers both probes (QLineEdit and QComboBox), and the only caller (qt.py:232) still gets the same int | None contract.

  • Highest-risk area: None identified. The change is limited to dialogs with no fixed height and no scrolling.

  • Merge recommendation: Safe to merge.

Blocking

None.

Important

None.

Nits

None.

Test gaps

None. test_window_without_a_height_is_as_high_as_its_rows checks the laid-out row offsets of the real widgets. The windows-latest CI job runs it, and on that job the old code fails it because the edit row comes out at 2*row + 1.

EEGLAB parity notes

None. supergui gives every row the same platform height. This change takes away a Qt sizing artifact that broke that rule, so it moves EEGPrep closer to EEGLAB.

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

@arnodelorme

Copy link
Copy Markdown
Collaborator

Review (Claude Fable): needs more work

Details

What I ran

  • Head c4f6e8b. CI is green on every job, Test Python 3.12 on windows-latest included, which failed with [57, 28] == [56, 28] before.
  • tests/test_guifunc_primitives.py on the Mac (offscreen): 10 passed, 1 deselected (the EEGLAB reference test).
  • Cause confirmed. With Rockwell 13 pt (leading 3) the edit box has sizeHint 25 and minimumSizeHint 26. With the measure of develop the test fails with [57, 28] == [58, 29]: the edit row is 29 and the other rows 28, the same numbers as the Windows job. With this pull request it passes and every row is 29.
  • No change where the two hints are equal: the native Mac style (edit box 21 and 21, popup 32 and 32) and the offscreen style (23 and 23). More generally, wherever the old test passed the new row height equals the old one, so the macOS and Ubuntu layouts of CI do not move.

Minimal and shared

qt.py +3 −1 (one line of logic, two lines of comment that say why), test +2 −3, changelog +3. No refactoring. The change is in the function that sets the row height of every window with no fixed height, not in one window.

EEGLAB

supergui.m (lines 417 to 429) takes one row height for all the rows of a figure: the height of a line of text times a platform factor. This pull request restores that rule where Qt broke it. No parameter of supergui or inputgui is read differently.

One note for later, not for this pull request. On Windows the row is now 29, one pixel above EEGLAB_ROW_HEIGHT["win32"] (28), because a row is never shorter than its edit box. That 28 is the Linux measurement (comment in theme.py). It was never measured on EEGLAB under Windows.

Test

No tolerance was added. The test still reads the laid out positions of real widgets. The expected row is computed with the same measure as the code, as it was before. What the test really checks is that the three rows are equal, and only the Windows job catches a regression.

Other open pull requests

What is needed

  1. Rebase on develop and resolve the changelog entry.
  2. In the body, two lines on the visible effect (Windows: rows without an edit box 28 to 29 pixels, Linux and Mac unchanged) and one pair of captures on Windows, before and after, of one window such as pop_importdata, visible without a click.

— orchestrator review

@arnodelorme
arnodelorme merged commit 382ec3c into develop Nov 29, 2026
10 of 12 checks passed
@arnodelorme

Copy link
Copy Markdown
Collaborator

After the merge: the fix is right, but it only ever mattered on the Windows CI job.

What the Fable review found. Nothing blocking in the code or the test. The stated cause was wrong, though. The Windows CI job runs Qt offscreen with no fonts at all, and Qt's fallback box font has a leading of 3 pixels, which is what made the edit rows one pixel taller ([57, 28] reproduced exactly on the Mac with a font-less Qt). Segoe UI has no leading.

Windows captures, before and after. File > Import data captured on the Windows guest from develop c6f4804 (before) and 382ec3c (after): the EEGPrep pictures are identical byte for byte, edit boxes 29 pixels in both. So no window moves on a real Windows desktop. Pictures and measurements: project_eegprep reports/pr-835.

Done since. #862 corrects the code comment and the changelog entry, with the two captures. #863 tracks that the Windows CI job tests layouts without fonts. Develop was also red on Ubuntu from a test of #850 that depends on test order; #861 fixes that test.

Not taken. The review also suggested a stronger test (equal heights of all three row kinds, popup included, with a font whose leading exceeds 2 pixels on every platform). It is not blocking and is left for later.

— orchestrator

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.

test_window_without_a_height_is_as_high_as_its_rows fails on Windows (57 vs 56)

1 participant