From 3c5c9ea27e4f75f3ecb2b55329e341c37419d015 Mon Sep 17 00:00:00 2001 From: Dan Paulat Date: Thu, 28 Aug 2025 18:30:23 -0500 Subject: [PATCH 1/2] Only restore geometry on first show, not restore from minimize --- scwx-qt/source/scwx/qt/main/main_window.cpp | 28 ++++++++++++++------- 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/scwx-qt/source/scwx/qt/main/main_window.cpp b/scwx-qt/source/scwx/qt/main/main_window.cpp index 4fa2f28a..723db052 100644 --- a/scwx-qt/source/scwx/qt/main/main_window.cpp +++ b/scwx-qt/source/scwx/qt/main/main_window.cpp @@ -463,18 +463,28 @@ void MainWindow::keyReleaseEvent(QKeyEvent* ev) void MainWindow::showEvent(QShowEvent* event) { QMainWindow::showEvent(event); - auto& uiSettings = settings::UiSettings::Instance(); - // restore the geometry state - std::string uiGeometry = uiSettings.main_ui_geometry().GetValue(); - restoreGeometry( - QByteArray::fromBase64(QByteArray::fromStdString(uiGeometry))); + static bool firstShowEvent = true; + bool restored = false; - // restore the UI state - std::string uiState = uiSettings.main_ui_state().GetValue(); + if (firstShowEvent) + { + auto& uiSettings = settings::UiSettings::Instance(); + + // restore the geometry state + std::string uiGeometry = uiSettings.main_ui_geometry().GetValue(); + restoreGeometry( + QByteArray::fromBase64(QByteArray::fromStdString(uiGeometry))); + + // restore the UI state + std::string uiState = uiSettings.main_ui_state().GetValue(); + + restored = restoreState( + QByteArray::fromBase64(QByteArray::fromStdString(uiState))); + + firstShowEvent = false; + } - bool restored = - restoreState(QByteArray::fromBase64(QByteArray::fromStdString(uiState))); if (!restored) { resizeDocks({ui->radarToolboxDock}, {194}, Qt::Horizontal); From b6797eee7e65296ba935d8bb63ad3b86d2da6494 Mon Sep 17 00:00:00 2001 From: Dan Paulat Date: Thu, 28 Aug 2025 19:08:50 -0500 Subject: [PATCH 2/2] Adding const to uiGeometry and uiState --- scwx-qt/source/scwx/qt/main/main_window.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scwx-qt/source/scwx/qt/main/main_window.cpp b/scwx-qt/source/scwx/qt/main/main_window.cpp index 723db052..331f25e1 100644 --- a/scwx-qt/source/scwx/qt/main/main_window.cpp +++ b/scwx-qt/source/scwx/qt/main/main_window.cpp @@ -472,12 +472,12 @@ void MainWindow::showEvent(QShowEvent* event) auto& uiSettings = settings::UiSettings::Instance(); // restore the geometry state - std::string uiGeometry = uiSettings.main_ui_geometry().GetValue(); + const std::string uiGeometry = uiSettings.main_ui_geometry().GetValue(); restoreGeometry( QByteArray::fromBase64(QByteArray::fromStdString(uiGeometry))); // restore the UI state - std::string uiState = uiSettings.main_ui_state().GetValue(); + const std::string uiState = uiSettings.main_ui_state().GetValue(); restored = restoreState( QByteArray::fromBase64(QByteArray::fromStdString(uiState)));