Two macOS reports: both were Qt deciding, so both differed by platform

Settings sat closer to its icon than Dashboard and Giám sát do. Those are tree
rows, laid out by the style; Settings was a QPushButton, whose icon-to-label gap
is also the style's — and the two do not agree. The Windows fix for this was a
19px icon box that nudged the label 1px, which is exactly the kind of tuning
that only holds on the machine it was measured on: on macOS the gap is tighter
again. The row now lays itself out, 4px in and 6px between, the same two numbers
the tree uses. Icon x=4 and label x=26 against the rows' 4 and 26 — equal, not
close.

The language drop-list showed a tick over its own text. macOS marks the current
row with a checkmark and Windows does not, and the popup inherits the combo's
width — which for "EN/JP/VN" is about 50px, all of it needed by the letters.
widen_popup() measures the longest item plus the platform's indicator and sets
the view's minimum, so the tick has its own room wherever it is drawn.

That check found two more: the project picker (191px of text in a 138px popup)
and the provider list (221px in 138px) were both truncating names here, tick or
no tick.

Neither could be reproduced on this machine, so the checks assert the property
that made the bug possible — spacing we control rather than the style's, and a
popup measured against text + indicator — not the platform.

21/21 checkers pass. check_nav segfaults in Qt teardown after printing its
verdict, twice in one suite run and 0 times in 8 standalone runs; pre-existing.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Nam Pham Dinh Thanh
2026-08-18 14:55:42 +09:00
co-authored by Claude Opus 5
parent e8fe67d0d9
commit 509ae96854
5 changed files with 136 additions and 10 deletions
+19
View File
@@ -162,6 +162,25 @@ def guard_wheel(root: QWidget) -> None:
w.installEventFilter(_wheel_guard)
def widen_popup(combo) -> None:
"""Give a drop-list room for its text AND the tick beside the current item.
macOS draws a checkmark against the selected row; Windows does not. A combo
only as wide as "VN" therefore looked fine here and had its two letters
covered there. The popup inherits the combo's width unless told otherwise,
so measure what has to fit and say so.
"""
from PySide6.QtWidgets import QStyle
view = combo.view()
fm = view.fontMetrics()
longest = max((fm.horizontalAdvance(combo.itemText(i))
for i in range(combo.count())), default=0)
tick = combo.style().pixelMetric(QStyle.PM_IndicatorWidth, None, combo)
pad = combo.style().pixelMetric(QStyle.PM_FocusFrameHMargin, None, combo) * 2
view.setMinimumWidth(longest + tick + pad + 16)
def ui_scale(widget: QWidget) -> float:
"""How much bigger this machine draws things than the design baseline.