Skip to content

Widen VFO frequency display for transverter/SHF bands (#844)#851

Merged
ten9876 merged 1 commit into
aethersdr:mainfrom
AetherClaude:aetherclaude/issue-844
Apr 6, 2026
Merged

Widen VFO frequency display for transverter/SHF bands (#844)#851
ten9876 merged 1 commit into
aethersdr:mainfrom
AetherClaude:aetherclaude/issue-844

Conversation

@AetherClaude

Copy link
Copy Markdown
Collaborator

Summary

  • Fixes Display frequency #844 — VFO frequency display truncates leading digit(s) for frequencies above 999 MHz (e.g. 1296.090.000 displayed as 296.090.000)
  • Widens the QStackedWidget sizing template from "000.000.000" to "0000.000.000" to accommodate 4-digit MHz values used with transverters through SHF bands

Root 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

  • Verify VFO displays correctly for frequencies below 999 MHz (no regression)
  • Verify VFO displays correctly for transverter frequencies above 999 MHz (e.g. 1296.090.000)
  • Confirm no layout overflow or visual artifacts at various window sizes

🤖 Generated with Claude Code

…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>
@aethersdr-agent aethersdr-agent Bot mentioned this pull request Apr 6, 2026
2 tasks
@ten9876 ten9876 marked this pull request as ready for review April 6, 2026 14:54
@ten9876 ten9876 self-requested a review as a code owner April 6, 2026 14:54
@ten9876 ten9876 merged commit d4539b5 into aethersdr:main Apr 6, 2026
5 checks passed
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)
![RxApplet dark
before/after](https://raw.githubusercontent.com/jensenpat/AetherSDR/assets-vfo-freq-clip/pr-rxapplet-dark.png)

**RX Controls box — light theme, 21.074 MHz** (only `074.000` visible →
full)
![RxApplet light
before/after](https://raw.githubusercontent.com/jensenpat/AetherSDR/assets-vfo-freq-clip/pr-rxapplet-light.png)

**VFO slice flag — light theme, 21.074 MHz** (leading `2` clipped →
full)
![VfoWidget light
before/after](https://raw.githubusercontent.com/jensenpat/AetherSDR/assets-vfo-freq-clip/pr-vfo-light.png)

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

Display frequency

2 participants