Skip to content

Bug: Fix go-to-frequency focus and recentering#644

Merged
ten9876 merged 1 commit into
aethersdr:mainfrom
jensenpat:macos-kb-focus-main
Apr 4, 2026
Merged

Bug: Fix go-to-frequency focus and recentering#644
ten9876 merged 1 commit into
aethersdr:mainfrom
jensenpat:macos-kb-focus-main

Conversation

@jensenpat

@jensenpat jensenpat commented Apr 4, 2026

Copy link
Copy Markdown
Collaborator

Summary

This PR fixes the Go to Frequency keyboard shortcut flow so direct frequency entry reliably opens the active slice frequency editor and recenters the panadapter on the tuned frequency.

Problem

Binding Go to Frequency to a key such as G was inconsistent in three ways:

  • the shortcut resolved the VFO editor through the generic active-spectrum alias instead of the active slices concrete VFO widget, so focus could miss the live editor
  • the inline frequency editor asked for focus immediately during shortcut handling, which could fail to land cleanly while Qt was still processing the shortcut event
  • after entering a new frequency, the slice tuned with autopan=0, so the panadapter could stay offset and leave the tuned frequency off screen

What Changed

  • MainWindow::registerShortcutActions() now resolves the active slice first, then looks up that slices VFO widget from the owning spectrum before calling beginDirectEntry()
  • VfoWidget::beginDirectEntry() now switches to the inline editor, raises the widget, sets focus with Qt::ShortcutFocusReason, and reasserts that focus on the next event-loop tick with QTimer::singleShot(0, ...)
  • direct frequency entry in both VfoWidget and RxApplet now uses SliceModel::tuneAndRecenter() instead of setFrequency() so the pan follows the tuned slice and keeps the destination frequency visible

Why This Is Safe

  • the fix uses existing shared Qt APIs and does not add platform-specific branches, so the focus behavior remains portable across macOS, Linux, and Windows
  • tuneAndRecenter() is already an existing model API used elsewhere in the app for recentering workflows, so this change aligns manual frequency entry with established tuning behavior instead of introducing a new command path
  • the PR is based directly on main and contains only the three files involved in the frequency-entry flow

Validation

  • built successfully from a clean main-based worktree with cmake -B build -G Ninja -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_PREFIX_PATH=/opt/homebrew/opt/qt
  • built successfully with cmake --build build -j8
  • manually tested on macOS: the shortcut now opens the frequency editor, accepts entry without clicking into the box, and recenters the panadapter after tuning

@jensenpat jensenpat changed the title [codex] Fix go-to-frequency focus and recentering Bug: Fix go-to-frequency focus and recentering Apr 4, 2026
@jensenpat jensenpat marked this pull request as ready for review April 4, 2026 04:19
@ten9876

ten9876 commented Apr 4, 2026

Copy link
Copy Markdown
Collaborator

Claude here. Good catch on all three issues — resolving through the active slice's concrete VFO, deferring focus via singleShot, and adding tuneAndRecenter for the direct entry path. Clean fix.

CI needs workflow approval (first-time contributor). We'll merge once it passes.

73, Jeremy KK7GWY & Claude (AI dev partner)

@ten9876 ten9876 merged commit 97dd854 into aethersdr:main Apr 4, 2026
3 checks passed
@jensenpat jensenpat deleted the macos-kb-focus-main branch April 4, 2026 17:44
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.

2 participants