Skip to content

refactor(spectrum): decouple drawSwrSweep from m_overlayMenu pointer (#2205). Principle XIII.#3035

Merged
ten9876 merged 1 commit into
mainfrom
aetherclaude/issue-2205
May 24, 2026
Merged

refactor(spectrum): decouple drawSwrSweep from m_overlayMenu pointer (#2205). Principle XIII.#3035
ten9876 merged 1 commit into
mainfrom
aetherclaude/issue-2205

Conversation

@aethersdr-agent

Copy link
Copy Markdown
Contributor

Summary

Fixes #2205

What was changed

refactor(spectrum): decouple drawSwrSweep from m_overlayMenu pointer (#2205). Principle XIII.

Files modified

  • src/gui/SpectrumWidget.cpp
  • src/gui/SpectrumWidget.h
 src/gui/SpectrumWidget.cpp | 19 ++++++++++++++-----
 src/gui/SpectrumWidget.h   |  1 +
 2 files changed, 15 insertions(+), 5 deletions(-)

Generated by AetherClaude (automated agent for AetherSDR)


🤖 aethersdr-agent · cost: $6.7502 · model: claude-opus-4-7

…2205). Principle XIII.

Introduces a private SpectrumWidget::leftOccludedRect() helper that
returns the visible overlay-menu geometry (or a null QRect when the
menu is hidden or absent). Both paint-path callers — drawSwrSweep()
label-collision avoidance and drawOffScreenSlices() left-margin
computation — now go through the helper instead of reading
m_overlayMenu->geometry() / ->width() directly.

Behavior-preserving: the helper preserves the existing null + isVisible
guards. If the overlay menu is ever replaced, wrapped, or made
optional, only leftOccludedRect() needs updating.

Maintainer (KK7GWY) approved the leftOccludedRect() shape proposed in
the triage analysis on issue #2205; honoring that direct steering is
Principle XIII (The Operator Outranks Every Agent).

Blast radius: change is purely additive at the header (new private
method declaration) and internal to drawSwrSweep / drawOffScreenSlices
in the cpp. Public API of SpectrumWidget is unchanged, so the codegraph
high-risk callers (MainWindow::wirePanadapter, ::buildMenuBar, etc.)
cannot regress on this refactor.

@aethersdr-agent aethersdr-agent Bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Nice, focused refactor. The new leftOccludedRect() helper cleanly encapsulates the overlay-menu-as-occluder concern, and the generic name avoids leaking the specific child-widget pointer through the abstraction — exactly what #2205 asked for.

A couple of small observations, none blocking:

  • Scope creep is welcome here. The issue only called out drawSwrSweep, but applying the same helper to drawOffScreenSlices (which had the identical m_overlayMenu->isVisible() + width() pattern at SpectrumWidget.cpp:7505-7506) is the right call — keeps both occlusion-avoidance paths converged so they can't drift apart later. Worth mentioning in the PR body for reviewers, since the title only references drawSwrSweep.

  • Sentinel semantics. Returning QRect{} and testing isNull() is fine — a default-constructed QRect has width=0 and height=0, so isNull() is true. Just note that in drawSwrSweep, the !occluded.isNull() guard is now technically redundant with the labelRect.intersects(...) check (intersecting against an empty rect returns false anyway), but it short-circuits cleanly and reads well, so no need to change.

  • Other m_overlayMenu references untouched and that's correct — the remaining usages in the file (raise/stack-order management, syncDisplaySettings, etc.) are owner-style operations on the menu itself, not occlusion queries, so they don't belong behind this helper.

LGTM. Thanks @aethersdr-agent!


🤖 aethersdr-agent · cost: $2.0519 · model: claude-opus-4-7

@ten9876 ten9876 merged commit 1d54764 into main May 24, 2026
5 checks passed
@ten9876 ten9876 deleted the aetherclaude/issue-2205 branch May 24, 2026 13:39
G6PWY-Chris pushed a commit to G6PWY-Chris/AetherSDR that referenced this pull request Jun 22, 2026
…ethersdr#2205). Principle XIII. (aethersdr#3035)

## Summary

Fixes aethersdr#2205

### What was changed

refactor(spectrum): decouple drawSwrSweep from m_overlayMenu pointer
(aethersdr#2205). Principle XIII.

### Files modified

- `src/gui/SpectrumWidget.cpp`
- `src/gui/SpectrumWidget.h`

```
 src/gui/SpectrumWidget.cpp | 19 ++++++++++++++-----
 src/gui/SpectrumWidget.h   |  1 +
 2 files changed, 15 insertions(+), 5 deletions(-)
```

---
Generated by AetherClaude (automated agent for AetherSDR)

---
<sub>🤖 aethersdr-agent · cost: $6.7502 · model: claude-opus-4-7</sub>

Co-authored-by: aethersdr-agent[bot] <273844287+aethersdr-agent[bot]@users.noreply.github.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.

AetherSweep: decouple drawSwrSweep from m_overlayMenu pointer

1 participant