Widen VFO frequency display for transverter/SHF bands (#844)#851
Merged
Conversation
…aethersdr#844) The frequency label widget was sized for 000.000.000 (max 999 MHz), causing frequencies above 999 MHz (e.g. 1296 MHz transverter) to be truncated on the left. Widen the template to 0000.000.000. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
NF0T
pushed a commit
that referenced
this pull request
Jun 26, 2026
… Principle XI. (#3839) ## The bug The frequency readout **clips its leading (most-significant) digits** in two places — the VFO slice flag (`VfoWidget`) and the RX Controls box (`RxApplet`). The operator loses the MHz digits, the worst ones to lose. Reported in #3463 (Default Light, Windows/FLEX‑6400, "first number cut"); also visible on macOS default **dark** in the RX Controls box. ## Root cause Both surfaces render the frequency as a plain `QLabel` styled by the theme tokens `font.size.freq` / `font.family.freq` (DSEG7 Modern, 20px dark / 26px light), poured into a **fixed-width box with no shrink-to-fit and no elision**. When the rendered DSEG7 string is wider than the box, the right-aligned label clips on the left: - **`RxApplet`** — the freq stack shares its row with TX/mode/WFM inside the fixed **~248px** `AppletPanel` column. The leftover is **~124px** (measured live via the bridge), narrower than even `21.074.000` at the default 20px → the leading **`2`** clips **on the default dark theme**. In light theme (26px) only `074.000` survives. - **`VfoWidget`** — the 252px flag fits 2-digit-MHz HF in dark, but the light-theme 26px digits (and the wider Windows metrics in #3463) overflow and clip the leading digit. This is the unfinished half of #844/#851 (which widened the digit *template* for 4-digit MHz but left a hardcoded pixel probe), and it mirrors the font-derived-sizing precedent from #3503. ## The fix A QSS `font-size` **overrides** `setFont()` (verified empirically), which is why the size couldn't be adjusted in code before. So: - Drop `font-size` from each freq label's stylesheet (family/weight/colour stay, theme-reactive) and drive the pixel size via **`setFont()` with a width-fitted size**, capped at the theme nominal — new shared `src/gui/FreqLabelFit.h`. - Re-fit on text update, label `QEvent::Resize`, and `ThemeManager::themeChanged` (so Dark↔Light and Theme-Editor font edits stay correct). - `RxApplet`'s freq stack is made `Expanding` (stretch removed) so it fills a **font-independent** width — avoids a fit↔reflow oscillation. Digits stay **full-size whenever they fit** and shrink only as much as needed to keep the leading digits on screen. (This fixes the clipping; making the digits *larger* — #3515 — remains a separate enhancement.) ## Proof — agent automation bridge Driven against a live FLEX‑8400M (RX-only, `tune` + `grab`), before vs after, both themes. Top row = before (clipped), bottom row = after (fixed): **RX Controls box — default dark, 21.074 MHz** (leading `2` clipped → full)  **RX Controls box — light theme, 21.074 MHz** (only `074.000` visible → full)  **VFO slice flag — light theme, 21.074 MHz** (leading `2` clipped → full)  | Surface / case | Before | After | |---|---|---| | RxApplet, dark, 21.074 MHz | leading `2` clipped | full `21.074.000` | | RxApplet, dark, 144.2 MHz | `1` gone, `4` clipped (`~44.200.000`) | full `144.200.000` | | RxApplet, light, 21.074 MHz | only `074.000` | full `21.074.000` | | VfoWidget, light, 21.074 MHz | leading `2` clipped | full `21.074.000` | | VfoWidget, dark (already fit) | — | unchanged, no regression | ## Files - `src/gui/FreqLabelFit.h` (new) — `fitFreqPixelSize()` + `applyFittedFreqFont()` - `src/gui/VfoWidget.{h,cpp}`, `src/gui/RxApplet.{h,cpp}` — drop QSS font-size, `applyFreqFit()`, re-fit hooks, RxApplet stack `Expanding` Closes #3463. Refs #3515. 💻 Generated with Claude Code (Opus 4.8) with architecture by @jensenpat Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
QStackedWidgetsizing template from"000.000.000"to"0000.000.000"to accommodate 4-digit MHz values used with transverters through SHF bandsRoot cause
The frequency label widget was sized using
QFontMetrics::horizontalAdvance("000.000.000"), which only fits 3-digit MHz values (max 999 MHz). Transverter frequencies like 1296 MHz have a 4-digit MHz part that overflows the fixed width, causing Qt to clip the leftmost digit(s).Change
One-line change in
src/gui/VfoWidget.cpp— the sizing template and comment.Test plan
🤖 Generated with Claude Code