Skip to content

fix(gui): prevent status bar text clipping at narrow widths#3500

Open
rfoust wants to merge 2 commits into
aethersdr:mainfrom
rfoust:codex/issue-3488-radio-label
Open

fix(gui): prevent status bar text clipping at narrow widths#3500
rfoust wants to merge 2 commits into
aethersdr:mainfrom
rfoust:codex/issue-3488-radio-label

Conversation

@rfoust

@rfoust rfoust commented Jun 10, 2026

Copy link
Copy Markdown
Collaborator

Summary

Fixes #3488.

This updates the SmartSDR-style status bar so text-bearing controls are no longer clipped when the main window is resized to a narrow width. The reported case was the center station nickname badge showing only part of the radio nickname, but the same resize pressure could also clip the UTC date/time stack at the far right.

Root Cause

The status bar used a fixed 46 px height and a dense horizontal layout, but the top-level MainWindow minimum width stayed fixed at 1024 px. Several status-bar children had their own minimum widths, yet the window itself could still be resized below the aggregate width needed by the visible status-bar content. In that state Qt squeezed labels such as the station nickname and UTC time, causing text to render cropped.

The parent status bar stylesheet also applied a broad QLabel { font-size: 21px; ... } rule. Compact two-line status widgets were intended to use 12 px labels, so this patch gives those compact labels an explicit higher-specificity selector to avoid inheriting the large status-label metrics.

Changes

  • Adds a compact status-bar label styling helper for the two-line 12 px stacks.
  • Tracks the status bar container and recomputes the normal-mode MainWindow minimum width from the visible status-bar minimum size.
  • Recomputes that minimum width when status content can change: initial construction, radio nickname updates, connect/disconnect, TUN/AMP visibility changes, and minimal-mode exit.
  • Gives the station nickname badge a minimum horizontal policy and recalculates its minimum width from the polished text size.
  • Leaves minimal mode behavior unchanged; minimal mode still uses its fixed narrow applet width with the status bar hidden.

Validation

  • git diff --check
  • python3 tools/check_a11y.py src/gui/MainWindow.cpp
  • cmake -B build -G Ninja -DCMAKE_BUILD_TYPE=RelWithDebInfo
  • cmake --build build --parallel 8

@rfoust rfoust requested a review from a team as a code owner June 10, 2026 02:45
Copilot AI review requested due to automatic review settings June 10, 2026 02:45

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Updates the SmartSDR-style status bar sizing/styling so text-bearing widgets (notably the station nickname badge and UTC stack) don’t get clipped when the main window is resized narrower than the status bar’s aggregate minimum width.

Changes:

  • Adds a compact-label styling helper for the 12px two-line telemetry stacks and removes the overly-broad QStatusBar QLabel { font-size: 21px; } rule.
  • Tracks the status bar container widget and recomputes MainWindow minimum width from the visible status bar’s minimum size.
  • Recomputes station nickname label minimum width based on polished text metrics, and triggers minimum-width recomputation on relevant status content/visibility changes.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
src/gui/MainWindow.h Adds updateStatusBarMinimumWidth() and stores the status bar container pointer for later minimum-width calculations.
src/gui/MainWindow.cpp Implements compact label styling helpers, station label min-width sizing, and dynamic MainWindow minimum width recomputation based on status bar content.

Comment thread src/gui/MainWindow.cpp

@aethersdr-agent aethersdr-agent 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.

Thanks @rfoust — this is a careful fix and the recompute call sites are well chosen. I verified the main interaction points against the codebase:

  • All three m_stationLabel->setText call sites are covered (m_stationLabel is an alias for m_stationNickLabel, so the badge min-width updates everywhere the nickname changes).
  • Minimal mode is safe in both directions: entering resets via setMinimumSize(0, 0) / setFixedWidth(260), and since m_minimalMode = on is assigned at the top of toggleMinimalMode(), the new updateStatusBarMinimumWidth() call on exit isn't a no-op behind its own guard.
  • Dropping font-size: 21px from the status-bar-wide QLabel rule is safe — I scanned the whole status-bar build section and every text-bearing label (TUN/AMP 18px/11px, TX, separators, indicators, compact 12px stacks) sets its own font-size; the only unstyled labels are pixmap-only.
  • Repeated ThemeManager::applyStyleSheet calls from the CPU timer are fine — the tracker overwrites the recorded template on subsequent calls rather than accumulating registrations.

Re: Copilot's linkage comment — false positive. The new helpers are inserted inside the anonymous namespace that opens at MainWindow.cpp:245 (within namespace AetherSDR) and closes at line 636, same as the neighboring tmate2*DefaultAction helpers. They already have internal linkage; no static needed.

One real concern — unbounded minimum width on small displays:

updateStatusBarMinimumWidth() sets the window minimum to whatever the status bar content demands, with no upper bound:

setMinimumSize(qMax(1024, statusMinWidth), qMax(400, minimumHeight()));

With TUN + AMP visible, GPS, CPU/Mem, network, UTC stacks, and a long station nickname (which now feeds directly into the badge's minimum width via setStatusBarStationText), statusMinWidth can plausibly exceed the width of a 1366×768 laptop screen — common in shacks. Qt will then force the window wider than the display with no way for the user to shrink it, which is arguably worse than clipped text. Suggest clamping against the screen, e.g.:

const int cap = screen() ? screen()->availableGeometry().width() : statusMinWidth;
setMinimumSize(qBound(1024, statusMinWidth, qMax(1024, cap)), qMax(400, minimumHeight()));

and optionally eliding the nickname badge when it's the component pushing past the cap, so the original #3488 symptom degrades gracefully instead of returning.

Minor (take or leave): the recompute fires on nickname/connect/TUN/AMP/minimal-mode-exit, but not on theme or font changes — a theme with wider metrics could under-reserve until the next connect event. Fine to defer given how rare live theme switches are.

Builds on the existing patterns nicely otherwise — nothing out of scope, no AppSettings/RAII issues.


🤖 aethersdr-agent · cost: $10.9890 · model: claude-fable-5

@rfoust rfoust self-assigned this Jun 11, 2026
@rfoust

rfoust commented Jun 11, 2026

Copy link
Copy Markdown
Collaborator Author

Reviewed the PR feedback. Copilot's helper-linkage thread is a false positive because the helpers are inside the existing anonymous namespace in MainWindow.cpp. I addressed the actionable AetherClaude concern in 3dfd0c8 by capping updateStatusBarMinimumWidth() to the current screen's available width while preserving the existing 1024 px floor.

Local validation after the follow-up: git diff --check, python3 tools/check_a11y.py src/gui/MainWindow.cpp, and cmake --build build --parallel 8.

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.

Bug: Cosmetic - Flex radio name box display needs to resize based on radio name

2 participants