Skip to content

Apply wasVisible-guard for setGeometry(geom) to PropDashboardDialog, RadioSetupDialog, PanFloatingWindow #2603

Description

@ten9876

Background

PR #2580 (b94d0d48) fixed a macOS first-open placement bug in 5 dialogs where setGeometry(geom) was called unconditionally inside setFramelessMode(bool), even when the dialog hadn't been shown yet. On macOS, restoring geometry during the hidden-construction phase captures the pre-show default position (top-left), which prevents Qt's normal placement logic (centering on parent, last position, etc.) from running.

The established fix is:

if (wasVisible) {
    setGeometry(geom);   // only on runtime toggle, when dialog IS already placed
}

PR #2580's scope was "Network Diagnostics, AetherDSP Settings, Memory Channels, SpotHub, and the newly updated popouts." Three more dialogs in the same code-shape were left for follow-up.

Sites needing the same fix

1. src/gui/PropDashboardDialog.cppPropDashboardDialog::setFramelessMode()

const QRect geom = geometry();
const bool wasVisible = isVisible();
Qt::WindowFlags flags = (windowFlags() & ~Qt::WindowType_Mask) | Qt::Dialog;
flags.setFlag(Qt::FramelessWindowHint, on);
setWindowFlags(flags);
setGeometry(geom);     // ← unguarded, same bug class
if (m_titleBar) {
    m_titleBar->setVisible(on);
}
...

2. src/gui/RadioSetupDialog.cppRadioSetupDialog::setFramelessMode()

const QRect geom = geometry();
const bool wasVisible = isVisible();
Qt::WindowFlags flags = (windowFlags() & ~Qt::WindowType_Mask) | Qt::Dialog;
flags.setFlag(Qt::FramelessWindowHint, on);
setWindowFlags(flags);
setGeometry(geom);     // ← unguarded
if (m_titleBar)
    m_titleBar->setVisible(on);
...

3. src/gui/PanFloatingWindow.cpp — flag-change handler

flags |= Qt::FramelessWindowHint;    // (or &= ~ depending on toggle direction)
setWindowFlags(flags);
setGeometry(geom);     // ← unguarded
if (wasVisible) show();

(slightly different shape — no setFramelessMode method, the toggle is inline — but same setGeometry(geom) after flag change without the wasVisible guard)

Fix

Wrap each setGeometry(geom) in if (wasVisible) { setGeometry(geom); }. Trivial, mechanical, ~6 lines added across 3 files.

Verification

  • Build clean
  • On macOS: open each dialog from a cold app launch. Pre-fix, expect top-left placement; post-fix, expect Qt's normal centering/last-position behavior.
  • Runtime frameless toggle (View → Use frameless windows) should still preserve geometry on already-visible dialogs.

Scope and risk

Context

  • Surfaced during review of Add frameless support for popout dialogs #2580
  • AetherClaude-suitable: pattern is identical to the 5 fixed sites in that PR
  • Not urgent (these dialogs are reachable but the misplacement is cosmetic, not functional)

73, Jeremy KK7GWY & Claude (AI dev partner)

Metadata

Metadata

Assignees

No one assigned

    Labels

    GUIUser interfaceawaiting-responseWaiting for reporter to provide additional informationbugSomething isn't workingmacOSmacOS-specific issuemaintainer-reviewRequires maintainer review before any action is taken

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions