Resolve DVK F1-F12 shortcut ambiguity with CwxPanel (#2464)#2469
Conversation
Both DvkPanel and CwxPanel registered F1-F12 QShortcuts. When the DVK panel was shown, both contexts matched the same key event, so Qt's shortcut map emitted activatedAmbiguously and dropped the event silently — mouse clicks on the DVK button still played the recording, but the keyboard shortcut did nothing. Move both panels' F1-F12 + ESC shortcuts onto window() with Qt::ApplicationShortcut and toggle setEnabled() from showEvent/hideEvent so exactly one set is live at any time. The two panels are mutually exclusive in the splitter, so visibility-driven toggling cleanly avoids ambiguity without per-panel coordination. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
There was a problem hiding this comment.
Thanks for the fix — the approach is sound. Toggling setEnabled() on show/hide is the right way to handle this since disabled QShortcuts are skipped by Qt's ambiguity detection, and mutual exclusion of the panels is enforced both at toggle time (MainWindow.cpp:5302, 5328) and on mode change (10943, 10955), so exactly one set ends up live. The comments cross-referencing #2464 between the two files are nice — anyone touching either panel in the future will see the coupling.
Two small things worth flagging, no blockers:
1. DvkPanel goes from window-scoped to application-scoped shortcuts. Before this PR, DvkPanel's F1–F12 + ESC were QShortcut(..., this) with no ApplicationShortcut context, so they only fired when focus was inside the panel. They're now app-wide whenever the panel is visible. That's almost certainly desirable (matches CwxPanel's long-standing behavior), but worth a manual smoke test that ESC doesn't interfere with modal dialogs (e.g. settings dialog) opened while DvkPanel is visible — ApplicationShortcut ESC + a modal dialog's QDialog::reject() is the classic collision point, even though the same risk has existed for CwxPanel for a while.
2. CwxPanel macros now silent when panel is hidden. Previously CwxPanel's F1–F12 fired app-wide as long as the panel object existed (mode-gated inside the lambda). Now the user must keep the panel visible for macros to work. This is probably the right call (the new behavior matches user intent), but if anyone was relying on hiding the panel to free screen space while still using F-keys in CW mode, they'll notice. Probably worth a one-liner in the release notes.
Both points are intentional simplifications of the previous behavior — flagging only so they don't surprise anyone in QA.
Summary
Fixes #2464
What was changed
Resolve DVK F1-F12 shortcut ambiguity with CwxPanel (#2464)
Files modified
src/gui/CwxPanel.cppsrc/gui/CwxPanel.hsrc/gui/DvkPanel.cppsrc/gui/DvkPanel.hGenerated by AetherClaude (automated agent for AetherSDR)