fix(gui): prevent status bar text clipping at narrow widths#3500
fix(gui): prevent status bar text clipping at narrow widths#3500rfoust wants to merge 2 commits into
Conversation
There was a problem hiding this comment.
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
QStatusBarQLabel { font-size: 21px; }rule. - Tracks the status bar container widget and recomputes
MainWindowminimum 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. |
There was a problem hiding this comment.
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->setTextcall sites are covered (m_stationLabelis an alias form_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 sincem_minimalMode = onis assigned at the top oftoggleMinimalMode(), the newupdateStatusBarMinimumWidth()call on exit isn't a no-op behind its own guard. - Dropping
font-size: 21pxfrom the status-bar-wideQLabelrule 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::applyStyleSheetcalls 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
|
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. |
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
MainWindowminimum 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
MainWindowminimum width from the visible status-bar minimum size.Validation
git diff --checkpython3 tools/check_a11y.py src/gui/MainWindow.cppcmake -B build -G Ninja -DCMAKE_BUILD_TYPE=RelWithDebInfocmake --build build --parallel 8